Add the possibility to ignore arguments in alliases#9199
Conversation
|
You're going to have to adjust the tests as well - see tests/checks/alias.fish. They print the semicolon so you probably just have to remove it. The checks/ scripts are normal fish scripts, and their expected output is embedded in the However, in general: Alias is a cheesy compatibility function. If you want an easier time of working with more control, try defining actual functions! It's much nicer because you don't need to fiddle with that additional layer of quoting, have proper syntax highlighting, can use many more constructs, ...! It's heavily recommended, and it's also been the recommended way to handle it in bash for years. |
|
The tests have been updated. Thank you very much for your quick presentation of the tests in fish, it is heartwarming to see how welcoming you are with new contributors. Thank you as well for the details on the best practice of fish use. I do use function for the wast majority of my aliases but there is some cases were a simple alias fell more suitable. |
This can let us add a "#" in our aliases to make them ignore additional arguments.
This is now compliant with the aliases that can ignore arguments.
9621cc8 to
af2f1a5
Compare
|
Should the behavior added in this PR be documented? I feel like this is not necessary as this is a very niche behavior, it does not contradict the code example in the alias documentation, bash does not document the behavior, and functions are preferred over aliases. Yet, If you want me to document that in the alias documentation, I can do it. |
Nah, it's fine. |
|
Merged, thanks! |
In other shells such as Bash, one can end its alias with
#in order to make the alias ignore additional arguments. Example:Unfortunately, in Fish, this is not possible yet.
This PR modifies
alias.fishto make it possible to create this kind of alias.TODOs: