-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Filter and order completions based on input and importance for native completions #5058
Comments
This comment was marked as outdated.
This comment was marked as outdated.
I wonder if we should generalize this to all shells. In particular, I think it is useful to guess the reason and decide how we want to move forward more generally based on that reason. My guess is to not flood the screen, overwhelming the user, but try to provide more targeted information. I think that is a worthwhile cause and should be applied to all shells uniformly. This also gets me thinking of more concrete semantics
Thoughts? |
Another way of putting this is: can we provide a richer experience with the extra semantic information we have? |
Probably, e.g. if someone is currently in the process of rebasing, it would be a good idea to complete We could even go as far as having some form of score users can give options at a later stage, promoting them to be shown earlier. But it is probably a good idea to e.g. not flood the screen with aliases. On long vs short that is probably more difficult to decide, and could be shell dependent to, e.g., match the single dash -> short options behavior in |
At least for a blank screen, I think showing longs for required arguments would be better since that will be more descriptive (in case the descriptions from #5056 aren't sufficient) But for |
yeah, I think preferring short, but falling back to long makes total sense. Also, |
Unless I'm missing something, we've come to a consensus and this is ready to move forward? |
@epage I updated the description |
Made some minor tweaks. Good to go! |
With #3951 nearly done, I've reviewed the plan for this again and made a couple of tweaks. |
I think we've got this covered between
While we don't hide optional flags. I'm a bit mixed on that. If there is interest in moving forward on that, we likely should have a dedicated issue exploring the trade offs. |
While there are some shell specific behaviors for options, e.g. for
zsh
andfish
: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:
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
Customization
In the future, it could make sense to make both filtering and sorting customizable by the developer.
The text was updated successfully, but these errors were encountered: