Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fish: allow arguments to functions #1063

Closed
wants to merge 1 commit into from

Conversation

cole-h
Copy link
Member

@cole-h cole-h commented Mar 1, 2020

This allows the ability to provide arguments to a function, such as
--on-event in order to trigger a function on the
fish_command_not_found event, for example.


The main reason for this was so that I could change
__fish_command_not_found_handler because, on Arch, it looks for any
packages that might contain the misspelled binary. Previously, you might
have been able to get away with a hack like specifying the flags in the
function name, but now all you need to do is specify the submodule and
desired flags.

I added a test and news for this, but is there any better way to
document the available options? As it stands, I believe any interested
parties would need to browse the source to find out what is available
and what isn't.

I formatted the mapAttrs' block with nixfmt, but it looks really
ugly. I left as-is because the fish module hasn't been blacklisted in
the format script yet, but it would look better if I went back and
manually formatted it.

Finally, please let me know if anything is not ideal, or is bad Nix, or
whatever. I'm still new to the language and stumbling around, but
interested in becoming more comfortable with it.

(Special thanks to @d-goldin for pointing me in the right direction)

This allows the ability to provide arguments to a function, such as
`--on-event` in order to trigger a function on the
`fish_command_not_found` event, for example.
@rycee
Copy link
Member

rycee commented Mar 1, 2020

@cole-h Thanks for the contribution!

@Jomik, @ryanorendorff, mind having a quick look at this change? I don't know anything about fish.

rycee pushed a commit that referenced this pull request Mar 7, 2020
This allows the ability to provide arguments to a function, such as
`--on-event` in order to trigger a function on the
`fish_command_not_found` event, for example.

PR #1063
@rycee
Copy link
Member

rycee commented Mar 7, 2020

I'll merge for now. Can always fix any issue later. Many thanks for the contribution! Rebased to master in a11cf1d.

@rycee rycee closed this Mar 7, 2020
@cole-h cole-h deleted the fish-functions branch March 7, 2020 17:40
jorsn pushed a commit to jorsn/home-manager that referenced this pull request Apr 25, 2020
This allows the ability to provide arguments to a function, such as
`--on-event` in order to trigger a function on the
`fish_command_not_found` event, for example.

PR nix-community#1063
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants