-
Notifications
You must be signed in to change notification settings - Fork 116
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
Suggestion: Bash completion arguments only by default #173
Comments
Your suggestions are pretty reasonable (including #172). I'll have to think about edge cases a bit though and write some tests first. If you're interested in putting up a PR of implementation or tests, both would be appreciated. Otherwise I'll look into it a after the next minor release. |
Sweet as, it's quite a busy time right now so I'll have a look into it in the new year :). |
I'm currently doing a stint on completions and will tackle this too. The implementation is simple enough, in that if there are any argument of command completions available, then flag and option ones will not be shown. |
I'd like to add my vote for this as well. I have an option parser that includes this:
The "foo" argument is mandatory, but the "bar" argument is optional. However, when I hit in the foo argument position to get completions I get the completions for both foo and bar. Since foo is mandatory, I would expect to not see any bar completions. |
I have a user of a program using optparse-applicative who also requested this. They said they often use I also notice that common commands like rm and mv tab complete without options in both bash and zsh. |
I have a working implementation of this. Still considering if I should put it behind a parser preference. |
Looking at the bash completions for some common command-line programs
(as included in the bash-completions package in Debian), I have not
found any that complete dashed options as well as filenames when
completing the empty string. Most complete only filenames; a few such as
cpio complete only dashed options.
Notably, the default completion used when there's no specific one for a
command, which parses the command's --help to automatically try to find
options, only does so when the completed string starts with a dash.
Based on that, I feel it would make sense for optparse-applicative to
default to similar behavior.
…--
see shy jo
|
I think for bash that's probably fine, but zsh is more flexible and allows nicer ways of showing both options and arguments together. At work we use this and it looks pretty good. So I don't particularly want to break these more obscure use cases. I can add a |
Right now when typing
binary <TAB>
optparse-applicative will auto complete to all options and arguments. I'd like to suggest changing this to auto completing only arguments, provided aHasCompleter
modifier was added to them.My reason for this is that it would help to make it clearer when auto completing for files and directories. It would still be possible to tab complete options as well by just typing the initial
-
.The text was updated successfully, but these errors were encountered: