aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Joshua Elliott <joshuacelliott@gmail.com>2015-07-30 16:04:39 -0600
committerGravatar Joshua Elliott <joshuacelliott@gmail.com>2015-07-30 16:04:39 -0600
commitbc7eb397818774d5d5bd95f48eaa7508b5808d53 (patch)
tree86186cd0be8cd52c2b4b9d2a7882a0dce6b5eb43
parent299a383d98f67fdd8ec5ce91f72b5d560ef4441e (diff)
Improve completion for python -m flag
-rw-r--r--share/completions/python.fish2
-rw-r--r--share/completions/python2.fish2
-rw-r--r--share/completions/python3.fish2
3 files changed, 3 insertions, 3 deletions
diff --git a/share/completions/python.fish b/share/completions/python.fish
index 764478de..64ab4d9b 100644
--- a/share/completions/python.fish
+++ b/share/completions/python.fish
@@ -4,7 +4,7 @@ complete -c python -s d --description "Debug on"
complete -c python -s E --description "Ignore environment variables"
complete -c python -s h -l help --description "Display help and exit"
complete -c python -s i --description "Interactive mode after executing commands"
-complete -c python -s m -d 'Run library module as a script (terminates option list)' -xa "( find /usr/lib/(eval python -V 2>| sed 's/ //; s/\..\$//; s/P/p/') \$PYTHONPATH -maxdepth 1 -name '*.py' -printf '%f\n' | sed 's/.py//')"
+complete -c python -s m -d 'Run library module as a script (terminates option list)' -xa '(python -c "import pkgutil; print(\'\n\'.join([p[1] for p in pkgutil.iter_modules()]))")'
complete -c python -s O --description "Enable optimizations"
complete -c python -o OO --description "Remove doc-strings in addition to the -O optimizations"
complete -c python -s s --description 'Don\'t add user site directory to sys.path'
diff --git a/share/completions/python2.fish b/share/completions/python2.fish
index 3064545a..4e2fc5f3 100644
--- a/share/completions/python2.fish
+++ b/share/completions/python2.fish
@@ -1,3 +1,3 @@
complete -c python2 -w python
# Override this to use python2 instead of python
-complete -c python2 -s m -d 'Run library module as a script (terminates option list)' -xa "( find /usr/lib/(eval python2 -V 2>| sed 's/ //; s/\..\$//; s/P/p/') \$PYTHONPATH -maxdepth 1 -name '*.py' -printf '%f\n' | sed 's/.py//')"
+complete -c python2 -s m -d 'Run library module as a script (terminates option list)' -xa '(python2 -c "import pkgutil; print(\'\n\'.join([p[1] for p in pkgutil.iter_modules()]))")'
diff --git a/share/completions/python3.fish b/share/completions/python3.fish
index a90c40a1..7e0e0d25 100644
--- a/share/completions/python3.fish
+++ b/share/completions/python3.fish
@@ -1,4 +1,4 @@
complete -c python3 -w python
# Override this to use python2 instead of python
-complete -c python3 -s m -d 'Run library module as a script (terminates option list)' -xa "( find /usr/lib/(eval python3 -V 2>| sed 's/ //; s/\..\$//; s/P/p/') \$PYTHONPATH -maxdepth 1 -name '*.py' -printf '%f\n' | sed 's/.py//')"
+complete -c python3 -s m -d 'Run library module as a script (terminates option list)' -xa '(python3 -c "import pkgutil; print(\'\n\'.join([p[1] for p in pkgutil.iter_modules()]))")'