tomerfiliba / plumbum

Plumbum: Shell Combinators
https://plumbum.readthedocs.io
MIT License
2.81k stars 183 forks source link

Command line completion support #212

Open henryiii opened 9 years ago

henryiii commented 9 years ago

I've been looking into supporting something like argcomplete for Plumbum. There's a lot of work to do, but due to clean design of plumbum.cli, it looks like it's not that hard. I have an early test at https://github.com/tomerfiliba/plumbum/tree/argcomp , just a proof of concept at the moment, but it does support argcomlete style completion with - and -- names. It does not use argcomplete, but it assumes a completion system like argcomplete has been installed. I'm planning to contact the author of argcomplete to see if I can get permission to use identical names, etc, since it would be very nice if these packages didn't conflict (it's hard to add more than one completion extender, at least it was when I was working with argcomplete a few years ago, so that's important).

The system works like this: if you include the #PYTHON_ARGCOMPLETE_OK comment at the top, the global completer tries to run the program with a few special flags and file descriptors set. plumbum.cli recognises those flags and offers completions in the same style as true argcomplete functions (without all the monkey patching!). Current code does not need changing (save for the adding the flag above).

If you checkout the referenced branch, make sure the global argcomplete script is activated, then try SimpleApp.py in /tests, it should offer completions when tab is pressed after typing one or two dashes.

stephenmm commented 8 years ago

I guess this did not make it into "1.6.0". Any idea when we might see it?

henryiii commented 8 years ago

I've got a tiny bit of progress, but I have a thesis, two papers, a new baby, and a move to France coming up, so not too soon unless someone helps. Producing suggestions is the tricky part.

tomerfiliba commented 8 years ago

i feel you bro :)