Open Azazel-Woodwind opened 4 hours ago
As with all things about aliases, use abbreviations instead.
They are exactly that - you enter one thing, and it tells you what it expands to.
As with all things about aliases, use abbreviations instead.
They are exactly that - you enter one thing, and it tells you what it expands to.
I did try using abbreviations before, but a small abbreviation immediately expanding to a possibly large command upon pressing space is unnatural when typing something after it, hence me switching back to aliases. I would be happy with using abbreviations if I could make it such that abbreviations only expand upon submitting the command
I want to write a fish pre-exec function that echos the command entered by the user but with aliases undone, to provide extra transparency to the user as to the command being executed. As aliases are just functions under the hood, I want to be able to differentiate between functions defined by the
alias
keyword and those that aren'tI have noticed that functions defined by the
alias
keyword consist of a--wraps
identifier in the function signature. Therefore, I use that to determine if a given command is an alias. I can then parse the function output and display it accordingly.Here's the issue: how do I know if a word is a command or not? Take this example:
alias cat bat
echo "a cat in a hat"
Clearly, the only way to do this is to have access to fish's parser, which there exists no API for.
While the main purpose of my request is so that I can undo aliases, having an API for the parser would be fine by me instead of a command that just undoes aliases. It depends on the codebase really. Thoughts?