diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2013-02-02 09:58:59 +0200 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2013-02-02 10:37:15 +0200 |
commit | 5c8a002008bd2dfdb9196b57c368193a6e05b1e2 (patch) | |
tree | f791baff13118ab0c1c14ff3a2bfcf97806cf0f6 | |
parent | 06002d04c7cbfe9ac7c92508b6dcb7323627d07a (diff) | |
download | bash-completion-5c8a002008bd2dfdb9196b57c368193a6e05b1e2.tar.gz |
pydoc: New completion.
-rw-r--r-- | completions/.gitignore | 1 | ||||
-rw-r--r-- | completions/Makefile.am | 6 | ||||
-rw-r--r-- | completions/pydoc | 31 | ||||
-rw-r--r-- | test/completion/pydoc.exp | 1 | ||||
-rw-r--r-- | test/lib/completions/pydoc.exp | 18 |
5 files changed, 57 insertions, 0 deletions
diff --git a/completions/.gitignore b/completions/.gitignore index 7d80a206..23092b1b 100644 --- a/completions/.gitignore +++ b/completions/.gitignore @@ -124,6 +124,7 @@ pvremove pvs pvscan pxz +pydoc3 python2 python3 quotacheck diff --git a/completions/Makefile.am b/completions/Makefile.am index b0c35c16..06a1fecc 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -265,6 +265,7 @@ bashcomp_DATA = a2x \ pwd \ pwdx \ pwgen \ + pydoc \ python \ qdbus \ qemu \ @@ -499,6 +500,7 @@ CLEANFILES = \ pvs \ pvscan \ pxz \ + pydoc3 \ python2 \ python3 \ quotacheck \ @@ -776,6 +778,10 @@ symlinks: $(targetdir) $(DATA) rm -f $(targetdir)/$$file && \ $(LN_S) puppet $(targetdir)/$$file ; \ done + for file in pydoc3 ; do \ + rm -f $(targetdir)/$$file && \ + $(LN_S) pydoc $(targetdir)/$$file ; \ + done for file in python2 python3 ; do \ rm -f $(targetdir)/$$file && \ $(LN_S) python $(targetdir)/$$file ; \ diff --git a/completions/pydoc b/completions/pydoc new file mode 100644 index 00000000..c16295d7 --- /dev/null +++ b/completions/pydoc @@ -0,0 +1,31 @@ +# pydoc completion -*- shell-script -*- + +_pydoc() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -k|-p) + return + ;; + -w) + _filedir + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W \ + '$( "$1" | sed -e "s/^pydoc3\{0,1\} //" | _parse_help - )' \ + -- "$cur" ) ) + return + fi + + COMPREPLY=( $( compgen -W 'keywords topics modules' -- "$cur" ) ) + _filedir py + # TODO: more completions: modules, ... +} && +complete -F _pydoc pydoc pydoc3 + +# ex: ts=4 sw=4 et filetype=sh diff --git a/test/completion/pydoc.exp b/test/completion/pydoc.exp new file mode 100644 index 00000000..9555e850 --- /dev/null +++ b/test/completion/pydoc.exp @@ -0,0 +1 @@ +assert_source_completions pydoc diff --git a/test/lib/completions/pydoc.exp b/test/lib/completions/pydoc.exp new file mode 100644 index 00000000..08109f58 --- /dev/null +++ b/test/lib/completions/pydoc.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pydoc " +sync_after_int + + +teardown |