Permalink
Browse files

python: Split module completion to separate helper

Avoids cwd in sys.path when using -c.
  • Loading branch information...
scop committed Jun 1, 2017
1 parent 9e5522f commit abb3016cac990ffacf66a05ecd7a8d657589d817
Showing with 10 additions and 3 deletions.
  1. +3 −2 completions/python
  2. +1 −1 helpers/Makefile.am
  3. +6 −0 helpers/python
View
@@ -2,8 +2,9 @@
_python_modules()
{
COMPREPLY+=( $( compgen -W "$( ${1:-python} -c 'import pkgutil
for mod in pkgutil.iter_modules(): print(mod[1])' 2>/dev/null )" -- "$cur" ) )
COMPREPLY+=( $( compgen -W \
"$( ${1:-python} ${BASH_SOURCE[0]%/*}/../helpers/python 2>/dev/null )" \
-- "$cur" ) )
}
_python()
View
@@ -1,4 +1,4 @@
helpersdir = $(pkgdatadir)/helpers
helpers_DATA = perl
helpers_DATA = perl python
EXTRA_DIST = $(helpers_DATA)
View
@@ -0,0 +1,6 @@
# -*- python -*-
import pkgutil
for mod in pkgutil.iter_modules():
print(mod[1])

0 comments on commit abb3016

Please sign in to comment.