From bc7eb397818774d5d5bd95f48eaa7508b5808d53 Mon Sep 17 00:00:00 2001 From: Joshua Elliott Date: Thu, 30 Jul 2015 16:04:39 -0600 Subject: Improve completion for python -m flag --- share/completions/python.fish | 2 +- share/completions/python2.fish | 2 +- share/completions/python3.fish | 2 +- 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()]))")' -- cgit v1.2.3