Skip to content
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

Mutual exclusive followed by positional param causes incorrect tab completion #7

Open
robreiss opened this issue Oct 2, 2014 · 4 comments

Comments

@robreiss
Copy link

robreiss commented Oct 2, 2014

Tab completion does not work correctly when presented with the following usage pattern:

Usage:
  naval_fate mine (set|remove) <x>

Result: The tab completion skips the (set|remove) mutual exclusive parameter.

If I remove the positional parameter "" then tab completion works correctly. i.e.

Usage:
  naval_fate mine (set|remove)

Result: "set" and "remove" are given as tab completion options.

@wiggin15
Copy link
Contributor

wiggin15 commented Oct 3, 2014

You're right... Here's the comment in the code that explains this:

        if args:
            # when we have an argument we move the completion system to arguments-or-options only section,
            # this means we DON'T support a script that has a arguments-or-subcommands part like:
            # script-name.py (<some-arg> | (a-subcommand <command-arg>))

Since 'mine' can accept an argument 'x', the other subcommands are ignored because I couldn't suggest a subcommand-or-argument.
This is definitely a bad limitation to have. I'll leave this ticket open to deal with this and maybe give it a try later. It should be possible to output the name of the argument along with subcommand suggestions..
Just to make sure: are you using zsh or bash?

@wiggin15
Copy link
Contributor

wiggin15 commented Oct 3, 2014

There's something else going on. 'x' shouldn't be an argument to 'mine' so there's another problem here.

@robreiss
Copy link
Author

robreiss commented Oct 3, 2014

Thanks for taking a look. I am using zsh. This isn't causing a big problem for me since it is only for an in house tool but just wanted to let you know of the issue.

@satreix
Copy link

satreix commented Jan 29, 2015

👍 for this issue (using bash BTW).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants