vsoch / qme

QueueMe is a job queue, manager, and dashboard
https://vsoch.github.io/qme/
Mozilla Public License 2.0
12 stars 4 forks source link

argcomplete or other method for argument completion #25

Open yarikoptic opened 4 years ago

yarikoptic commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

yarikoptic commented 4 years ago

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 commented 4 years ago

ohhhh.... oh no, lol.

vsoch commented 4 years ago

But that would require using it.

yarikoptic commented 4 years ago

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

yarikoptic commented 4 years ago

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