-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
While there are some shell specific behaviors for options, e.g. for zsh
and fish
:
In zsh
, options are completed if at least one -
is present.
In fish
options are completed if the exact number of dashes is present, i.e. one -
for a short option and two --
for a long option.
This had an initial implementation at #5057.
We believe that with the additional knowledge available, clap can do better.
Filtering
On an empty current token, complete:
- If subcommands or positionals are present
- Subcommands
- Positional arguments
- Required pptions (prefer long)
- else
- All options (prefer long)
On a single -
complete all options, prefer short options where available.
On a double --
complete long options, this would happen either way, so not really a feature. If escaping makes sense (positionals exist), then include just --
In general, aliases are hidden, and only shown if they are the only name of an argument matching the current input.
In all cases, aliases should only show up if the main argument is not being shown
Sorting
Either
- Alphabetical
- Display order
Customization
In the future, it could make sense to make both filtering and sorting customizable by the developer.