[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 2.0-111-gf1100ef

Ville Skyttä ville.skytta at iki.fi
Sat Feb 2 09:36:14 UTC 2013


The following commit has been merged in the master branch:
commit 5c8a002008bd2dfdb9196b57c368193a6e05b1e2
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sat Feb 2 09:58:59 2013 +0200

    pydoc: New completion.

diff --git a/completions/.gitignore b/completions/.gitignore
index 7d80a20..23092b1 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 b0c35c1..06a1fec 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 0000000..c16295d
--- /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 0000000..9555e85
--- /dev/null
+++ b/test/completion/pydoc.exp
@@ -0,0 +1 @@
+assert_source_completions pydoc
diff --git a/test/lib/completions/awk.exp b/test/lib/completions/pydoc.exp
similarity index 80%
copy from test/lib/completions/awk.exp
copy to test/lib/completions/pydoc.exp
index 260dabc..08109f5 100644
--- a/test/lib/completions/awk.exp
+++ b/test/lib/completions/pydoc.exp
@@ -11,9 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "awk "
-
-
+assert_complete_any "pydoc "
 sync_after_int
 
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list