Comments (8)
You probably should. I think this is a consequence of how I currently find the active action (the action that the parser was on when it finished or crashed). Since your argument has nargs="*", it accepts 0 words and the parser moves on to the next action. Instead of having just one active action, I should probably build a mapping of actions to words that those actions were activated on, and consider all the actions that were activated on the last word to be active (so, grab all of their completions).
from argcomplete.
I think this will help: 938ec6a but this really needs more testing (particularly I need to write test cases). Let me know if it works for you.
from argcomplete.
It does indeed. Thanks!
from argcomplete.
Spoke a bit too soon. I get autocompletion for the first occurrence of the argument with nargs="*", but none thereafter for this argument.
In my testing using your commit, I also do not get completion on a second occurrence of an optional argument with nargs="+" with a ChoicesCompleter.
You might also want to consider optional arguments with nargs="+" in combination with a positional with nargs="*". In these cases, there are two ways to deal with the multiplicity:
$ command verb positional_A positional_B --optional option_A option_B
That is, to put the optional argument at the end, or using the pseudo argument "--":
$ command verb --optional option_A option_B -- positional_A positional_B
Thanks again for looking into this!
from argcomplete.
Does this help? 0279e77 (it's in master)
(Regarding the second part, I get that for free by piggybacking on the parse process. All I need to do is make sure that I have all the actions which could have possibly eaten the next word on the command line.)
from argcomplete.
That seems to have got it. Thanks!
from argcomplete.
Cool, thanks for reporting. Gonna keep this open until I get around to adding tests for it.
from argcomplete.
Works for aero too...
from argcomplete.
Related Issues (20)
- Generate zsh completion functions HOT 2
- zsh does behave weird if choice contains colon HOT 2
- `argcomplete` adds entries to `.bash_completion`, even when action is abandoned HOT 1
- installing zsh globally adds paths to completion options introduced in v3.1.4 HOT 1
- Contributing guidelines for argcomplete? HOT 2
- How do I exclude files in the users directory from the tab completion? HOT 2
- Unable to get completion to work for NetExec HOT 2
- zsh: completion fails with script path starting with '~/' HOT 1
- 3.2.2: pytest is failing HOT 1
- Output of `argcomplete.warn` does not show HOT 4
- Generating lazy completion scripts for Bash/Zsh HOT 1
- Problem with os.get_terminal_size() and argcomplete HOT 2
- completion with a leading dash HOT 2
- Problems with trust path when packaging HOT 6
- No automatic testing on windows? HOT 2
- Python 3.13: Some tests fail when run with latest Python pre-release HOT 5
- Check recent argparse API changes for compatibility HOT 2
- completer falls back to Bash filename completion
- Python 3.12.3: Test suite fails HOT 1
- autocompletion is slow and stuck HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from argcomplete.