Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

wkentaro/auto-argcomplete

Repository files navigation

auto-argcomplete

image

image

auto-argcomplete is automatic shell completion generator for script which uses argparse.

The behavior is like:

$ python example/simple_script.py <TAB>
$ python example/simple_script.py --
--dry-run   --help      --kick-off  --module

If you're using zsh:

% python example/simple_script.py --
--dry-run   -- display what to do
--help      -- show this help message and exit
--module    -- specify module name
--kick-off

example/simple_script.py is:

import argparse

parser = argparse.ArgumentParser()
parser.add_argument('-m', '--module', help='specify module name')
parser.add_argument('-n', '--dry-run', help='display what to do')
parser.add_argument('-k', '--kick-off')
parser.parse_args()

Nothing to import in the script! 😄

auto-argcomplete can automatically understand the output of --help option, so automatically supports all script which use argparse.

Installation

$ pip install auto-argcomplete

Test

$ nosetests -v auto_argcomplete

License

Copyright (C) 2015 Kentaro Wada
Released under the MIT license
http://opensource.org/licenses/mit-license.php

About

🐍 Auto argument completion util for human.

Resources

Stars

Watchers

Forks

Packages

No packages published