-
Notifications
You must be signed in to change notification settings - Fork 14
history: Pass shell arguments to the custom function #21
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
base: main
Are you sure you want to change the base?
Conversation
|
Fixes #18 |
Currently there is no way to pass additional arguments to this custom function, so for example `history -R` won't do anything. Make it accept arguments to correc this behaviour. Signed-off-by: Eric Naim <[email protected]>
| end | ||
|
|
||
| # Fish command history | ||
| function history |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we're even overriding function here instead of creating an alias?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because alias is "much" slower than function. Fish specific, and generally recommended to do functions instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea, but even if we do something like
alias history="history --show-time='%F %T '"It will still use the builtin function so it's identical. I guess it's can be kept too because of #19
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because alias is "much" slower than function. Fish specific, and generally recommended to do functions instead
Fish documentation seems to say that alias does the same thing, just creating a wrapper for the command.
alias is a simple wrapper for the function builtin, which creates a function wrapping a command. It has similar syntax to POSIX shell alias. For other uses, it is recommended to define a function.
https://fishshell.com/docs/current/cmds/alias.html#alias-create-a-function
So I don't see why it should be faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it was equally good optimised after Rust rewrite
Currently there is no way to pass additional arguments to this custom function, so for example
history -Rwon't do anything. Make it accept arguments to correc this behaviour.Fixes #18
Closes #20