File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,10 @@ _comp_cmd_pydoc()
23
23
_comp_compgen -- -W ' keywords topics modules'
24
24
25
25
if ! _comp_looks_like_path " $cur " ; then
26
- local python=python
27
- [[ ${1##*/ } == * 3* ]] && python=python3
28
- _comp_xfunc python modules $python
26
+ # Prefer python in the same dir for resolving modules
27
+ local pathcmd
28
+ pathcmd=$( type -P " $1 " ) && local PATH=${pathcmd%/* } :$PATH
29
+ _comp_xfunc python modules
29
30
fi
30
31
31
32
# Note that we don't do "pydoc modules" as it is known to hang on
Original file line number Diff line number Diff line change 2
2
3
3
# @since 2.12
4
4
_comp_xfunc_python_modules ()
5
+ {
6
+ local python=python
7
+ [[ ${comp_args[0]##*/ } == * 3* ]] && python=python3
8
+ _comp_cmd_python__modules " $python "
9
+ }
10
+
11
+ # @deprecated 2.12 use `_comp_xfunc_python_modules` instead
12
+ _python_modules ()
13
+ {
14
+ _comp_cmd_python__modules " ${1:- python} "
15
+ }
16
+
17
+ _comp_cmd_python__modules ()
5
18
{
6
19
COMPREPLY+=($( compgen -W \
7
- " $( " ${1 :- python} " " ${BASH_SOURCE[0]%/* } /../helpers/python" " $cur " \
20
+ " $( " $1 " " ${BASH_SOURCE[0]%/* } /../helpers/python" " $cur " \
8
21
2> /dev/null) " -- " $cur " ) )
9
22
}
10
23
@@ -15,7 +28,6 @@ _comp_xfunc_python_warning_actions()
15
28
${prefix: +-P " $prefix " }
16
29
}
17
30
18
- _comp_deprecate_func 2.12 _python_modules _comp_xfunc_python_modules
19
31
_comp_deprecate_func 2.12 _python_warning_actions \
20
32
_comp_xfunc_python_warning_actions
21
33
@@ -39,7 +51,7 @@ _comp_cmd_python()
39
51
return
40
52
;;
41
53
-${noargopts} m)
42
- _comp_xfunc_python_modules " $1 "
54
+ _comp_cmd_python__modules " $1 "
43
55
return
44
56
;;
45
57
-${noargopts} Q)
You can’t perform that action at this time.
0 commit comments