argcomplete icon indicating copy to clipboard operation
argcomplete copied to clipboard

When there are multiple optional positional arguments, their completers are combined.

Open calc84maniac opened this issue 7 years ago • 1 comments

The title is fairly self-explanatory. If you add multiple positional arguments with nargs='?', the completer for every unentered argument is called and combined, rather than just the first unentered one. As far as I can tell, this is not the behavior accepted by argparse (which always assigns optional arguments greedily in positional order). This is easiest to demonstrate by creating multiple arguments with different 'choices' lists.

This issue seems to be somewhat acknowledged by this comment, but I don't see where the ambiguity comes into play thanks to the positional ordering. I'm dealing with a choices argument followed by a filename argument, and there's no case where the file completion should need to occur if the choice hasn't been entered yet.

calc84maniac avatar Aug 02 '17 19:08 calc84maniac

You can see a bit more of the discussion on this in #133. In the case where you're only using nargs='?', I think you're right.

evanunderscore avatar Aug 06 '17 23:08 evanunderscore