Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Free shell auto-completion #21

dknecht opened this Issue · 5 comments

4 participants


No description provided.


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.


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:


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

test the simple file as follow:

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

 """Usage: tcp <host> <port> [--timeout=<seconds>] serial <port> [--baud=9600] [--timeout=<seconds>] -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 ./  
Completion file written to /etc/bash_completion.d/

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



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 to docopt_example and see if that works.

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.