##// END OF EJS Templates
Merge pull request #4528 from ivanov/completion-update...
Paul Ivanov -
r13596:e89ef78f merge
parent child Browse files
Show More
@@ -24,7 +24,7 b' _ipython()'
24 {
24 {
25 local cur=${COMP_WORDS[COMP_CWORD]}
25 local cur=${COMP_WORDS[COMP_CWORD]}
26 local prev=${COMP_WORDS[COMP_CWORD - 1]}
26 local prev=${COMP_WORDS[COMP_CWORD - 1]}
27 local subcommands="notebook qtconsole console kernel profile locate"
27 local subcommands="notebook qtconsole console kernel profile locate history nbconvert"
28 local opts=""
28 local opts=""
29 if [ -z "$__ipython_complete_baseopts" ]; then
29 if [ -z "$__ipython_complete_baseopts" ]; then
30 _ipython_get_flags baseopts
30 _ipython_get_flags baseopts
@@ -43,30 +43,33 b' _ipython()'
43 fi
43 fi
44 done
44 done
45
45
46 if [[ $mode == "profile" ]]; then
46
47 opts="list create"
47 if [[ ${cur} == -* ]]; then
48 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
48 case $mode in
49 elif [[ ${cur} == -* ]]; then
49 "notebook" | "qtconsole" | "console" | "kernel")
50 if [[ $mode == "notebook" ]]; then
50 _ipython_get_flags $mode
51 _ipython_get_flags notebook
51 opts=$"${opts} ${baseopts}"
52 opts=$"${opts} ${baseopts}"
52 ;;
53 elif [[ $mode == "qtconsole" ]]; then
53 "locate" | "history" | "profile")
54 _ipython_get_flags qtconsole
54 _ipython_get_flags $mode
55 opts="${opts} ${baseopts}"
55 opts=$"${opts}"
56 elif [[ $mode == "console" ]]; then
56 ;;
57 _ipython_get_flags console
57 *)
58 elif [[ $mode == "kernel" ]]; then
58 opts=$baseopts
59 _ipython_get_flags kernel
59 esac
60 opts="${opts} ${baseopts}"
61 elif [[ $mode == "locate" ]]; then
62 opts=""
63 else
64 opts=$baseopts
65 fi
66 # don't drop the trailing space
60 # don't drop the trailing space
67 local IFS=$'\t\n'
61 local IFS=$'\t\n'
68 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
62 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
69 return 0
63 return 0
64 elif [[ $mode == "profile" ]]; then
65 opts="list create locate"
66 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
67 elif [[ $mode == "history" ]]; then
68 opts="trim"
69 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
70 elif [[ $mode == "locate" ]]; then
71 opts="profile"
72 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
70 elif [[ ${prev} == "--pylab"* ]] || [[ ${prev} == "--gui"* ]]; then
73 elif [[ ${prev} == "--pylab"* ]] || [[ ${prev} == "--gui"* ]]; then
71 if [ -z "$__ipython_complete_pylab" ]; then
74 if [ -z "$__ipython_complete_pylab" ]; then
72 __ipython_complete_pylab=`cat <<EOF | python -
75 __ipython_complete_pylab=`cat <<EOF | python -
@@ -99,8 +102,10 b' EOF'
99 local IFS=$'\t\n'
102 local IFS=$'\t\n'
100 COMPREPLY=( $(compgen -W "${__ipython_complete_profiles}" -- ${cur}) )
103 COMPREPLY=( $(compgen -W "${__ipython_complete_profiles}" -- ${cur}) )
101 else
104 else
102 if [ -z "$mode" ]; then
105 if [ "$COMP_CWORD" == 1 ]; then
103 COMPREPLY=( $(compgen -f -W "${subcommands}" -- ${cur}) )
106 local IFS=$'\t\n'
107 local sub=$(echo $subcommands | sed -e "s/ / \t/g")
108 COMPREPLY=( $(compgen -W "${sub}" -- ${cur}) )
104 else
109 else
105 COMPREPLY=( $(compgen -f -- ${cur}) )
110 COMPREPLY=( $(compgen -f -- ${cur}) )
106 fi
111 fi
General Comments 0
You need to be logged in to leave comments. Login now