Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Free shell auto-completion #21

Open
dknecht opened this Issue · 5 comments

4 participants

@dknecht

No description provided.

@keleshev
Owner

Usually this requires modifying ~/.bashrc in order to work. And very few people do that even for such complex interfaces as git.

So, requiring high effort and having low impact, this is given low priority, unless someone implements that and makes a pull request.

@wiggin15

Check out infi.docopt_completion. It generates shell auto-completion for a given docopt utility.

easy_install infi.docopt_completion
docopt-completion [script name]

The code is available here:
https://github.com/Infinidat/infi.docopt_completion/

@Honghe

@wiggin15 Test at docopt.__version__ = 0.6.1 but have problems, it does not work. at Ubuntu 12.04 32bit.

test the simple file docopt_example.py as follow:

 #!/usr/bin//env python
 # coding: utf-8

 """Usage:
     docopt_example.py tcp <host> <port> [--timeout=<seconds>]
     docopt_example.py serial <port> [--baud=9600] [--timeout=<seconds>]
     docopt_example.py -h | --help | --version

 """
 from docopt import docopt

 if __name__ == '__main__':
     arguments = docopt(__doc__, version='0.1.1rc')
     print arguments

The test command is:

sudo docopt-completion ./docopt_example.py  
Completion file written to /etc/bash_completion.d/docopt_example.py.sh

I think this means is OK, but still can not use tab-completion at ./docopt_example.py
So Which steps I was wrong?

Thanks!

@wiggin15

You're right, looks like this happens because docopt-completion does not sanitize the "." in ".py". Please open an issue in the docopt-completion repository (link above) and I'll fix it. In the meantime you can change the name from docopt_example.py to docopt_example and see if that works.

@Honghe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.