diff options
author | David Paleino <dapal@debian.org> | 2013-04-05 12:55:51 +0200 |
---|---|---|
committer | David Paleino <dapal@debian.org> | 2013-04-05 12:55:51 +0200 |
commit | 09dbe3eeb2e9695d171a63e14361c4099b5be978 (patch) | |
tree | 69f099aab27e28b832e627de51ed2b99e3d7445c /completions/python | |
parent | 0d099a545fed933f329f434a43b58edcb52d366c (diff) | |
parent | 3085c7e12179817a02a611016606391295c69942 (diff) | |
download | bash-completion-2.x.tar.gz |
Merge branch 'master' into 2.x2.x
Diffstat (limited to 'completions/python')
-rw-r--r-- | completions/python | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/completions/python b/completions/python index 969f3b93..9c7cec13 100644 --- a/completions/python +++ b/completions/python @@ -1,12 +1,22 @@ # bash completion for python -*- shell-script -*- +_python_modules() +{ + COMPREPLY+=( $( compgen -W "$( ${1:-python} -c 'import pkgutil +for mod in pkgutil.iter_modules(): print(mod[1])' )" 2>/dev/null -- "$cur" ) ) +} + _python() { local cur prev words cword _init_completion || return case $prev in - -'?'|-h|--help|-V|--version|-c|-m) + -'?'|-h|--help|-V|--version|-c) + return 0 + ;; + -m) + _python_modules "$1" return 0 ;; -Q) |