argparse icon indicating copy to clipboard operation
argparse copied to clipboard

Is there a way to generate a tab completions bash script?

Open AndriiNeverov opened this issue 5 years ago • 4 comments

What would be a recommended way to achieve something similar to https://stackoverflow.com/questions/32258362/setup-command-line-completion-with-yargs?

AndriiNeverov avatar Jul 29 '20 23:07 AndriiNeverov

For any questions it's better to search python argparse helps. Something like argparse tab completion.

https://stackoverflow.com/questions/8387924/python-argparse-and-bash-completion

As far as i see, they have https://github.com/kislyuk/argcomplete, but it was not ported to JS.

puzrin avatar Jul 30 '20 04:07 puzrin

Yep, I used Python's argcomplete in the past and it's super powerful. Nails it with a single line of code!

Thank you for confirming. I guess this is a feature request then :)

AndriiNeverov avatar Jul 30 '20 21:07 AndriiNeverov

This is useful suggestion, but i have no ideas about deadlines. All i can say, In 1-2 weeks port of 3.9.4 argparse will be ready (as v2.+ o this package, see progress in branches). Then no plans to continue - too much of other deals.

puzrin avatar Jul 31 '20 05:07 puzrin

I see. Well, maybe some more people vote on this to bump it up the list.

In the meantime, since the API is very similar, maybe there is a workaround of making the code run in Python, letting register-python-argcomplete generate the Shell stuff from there and then re-using that.

AndriiNeverov avatar Aug 04 '20 20:08 AndriiNeverov