I am working on a fish shell function named quick( see here ) and I would like to add some switches to it.
For example quick -l
to list all pathLabels.
Fish documentation does not seem to provide such information.
My questions are,
- What is the best way to enhance a functions' functionality with switches in fish ?
- Is it possible to expand an existing command with new switches ?
- Does this relate to the similar topic for bash/shell ?
I have come across several related information out there like "How do I parse command line arguments in bash?" but have not found a clear and fish specific answer to those questions. Any help please, it will be appreciated !
Note: Checking > functions alias
as an example, seems that just $argv is used within a switch statement.
You can use
getopt
. It's pretty verbose. Here's an example that just looks for-h
or--help