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

argcomplete or other method for argument completion #25

Open
yarikoptic opened this issue May 29, 2020 · 8 comments
Open

argcomplete or other method for argument completion #25

yarikoptic opened this issue May 29, 2020 · 8 comments
Labels
enhancement New feature or request

Comments

@yarikoptic
Copy link
Contributor

I am still fighting to make it work for me in datalad but it used to work and works for others: https://github.com/kislyuk/argcomplete/ . Use could be as rudimentary as just following argparse spec or add fancier "dynamic" completions

@vsoch
Copy link
Owner

vsoch commented May 29, 2020

FWIW I’ve tried this a few times, and it always leads to headache. This seems like one of those pretty things that would just make maintainership hard. But maybe there is an old school way to just generate a shell script to do the completion, and then install alongside? We did this back in the day for Singularity. I’m averse you adding buggy things that don’t add a ton, so my initial response is “probably not.”

@yarikoptic
Copy link
Contributor Author

100% agree and I had exactly the same thought! is there a tool already to produce from argparse complete sourceable completion scripts? (I think I did search at some point, forgot details now)
But with that in mind I remain hopeful since idea is indeed nice and allows for dynamic handling (not that some shims could be provided for that other tool ;))

@vsoch
Copy link
Owner

vsoch commented May 29, 2020

Yeah good point! I'll leave the issue open for future thinking / discussion.

@vsoch vsoch added the enhancement New feature or request label May 29, 2020
@yarikoptic
Copy link
Contributor Author

eh, it is that day... right after this I saw a tweet about poetry, README of which says "poetry supports generating completion scripts for Bash, Fish, and Zsh", so now I am down that rabbit hole

@vsoch
Copy link
Owner

vsoch commented May 29, 2020

ohhhh.... oh no, lol.

@vsoch
Copy link
Owner

vsoch commented May 29, 2020

But that would require using it.

@yarikoptic
Copy link
Contributor Author

they use https://github.com/sdispater/cleo for cmdline interfacing. Never heard about it, but it is the one supporting generating them "natively"

@yarikoptic
Copy link
Contributor Author

I wish only if it also provided Pythonic interface for defined "Commands" (that is what we do in DataLad) -- I would have even closed by eyes on dislike of defining interface in docstrings (and not the other way around), and tried to use it where I ATM use click. ... although again -- seems more magic dust is needed:

$> ./demo_cleo.py completions bash >| demo_cleo_completions
$> bash
$> source demo_cleo_completions 
$> ./demo_cleo.py bash: _get_comp_words_by_ref: command not found
bash: __ltrim_colon_completions: command not found

@vsoch vsoch changed the title wishlist: consider using argcomplete argcomplete or other method for argument completion May 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants