@@ -49,16 +49,6 @@ _cliname() {
4949
5050 case " ${cmd} " in
5151 _cliname)
52- if [[ ${COMP_WORDS[COMP_CWORD]} == -* ]] ; then
53- opts=" --verbose --no-verbose --version -V --config --help"
54- COMPREPLY=( $( compgen -W " ${opts} " -- " ${COMP_WORDS[COMP_CWORD]} " ) )
55- return 0
56- elif [ $cur -eq $COMP_CWORD ] ; then
57- opts=" list ls cd test"
58- COMPREPLY=( $( compgen -W " ${opts} " -- " ${COMP_WORDS[COMP_CWORD]} " ) )
59- return 0
60- fi
61-
6252 cmd_cur=$cur
6353 while [ $cur -lt $COMP_CWORD ] ; do
6454 cur=$(( cur + 1 ))
@@ -95,16 +85,20 @@ _cliname() {
9585 esac
9686 done
9787
98- return 0
99- ;;
100-
101- _cliname_list)
10288 if [[ ${COMP_WORDS[COMP_CWORD]} == -* ]] ; then
103- opts=" --all -a"
89+ opts=" --verbose --no-verbose --version -V --config --help"
90+ COMPREPLY=( $( compgen -W " ${opts} " -- " ${COMP_WORDS[COMP_CWORD]} " ) )
91+ return 0
92+ elif [ $cur -eq $COMP_CWORD ] ; then
93+ opts=" list ls cd test"
10494 COMPREPLY=( $( compgen -W " ${opts} " -- " ${COMP_WORDS[COMP_CWORD]} " ) )
10595 return 0
10696 fi
10797
98+ return 0
99+ ;;
100+
101+ _cliname_list)
108102 cmd_cur=$cur
109103 while [ $cur -lt $COMP_CWORD ] ; do
110104 cur=$(( cur + 1 ))
@@ -118,30 +112,25 @@ _cliname() {
118112 ;;
119113 esac
120114 done
115+
116+ if [[ ${COMP_WORDS[COMP_CWORD]} == -* ]] ; then
117+ opts=" --all -a"
118+ COMPREPLY=( $( compgen -W " ${opts} " -- " ${COMP_WORDS[COMP_CWORD]} " ) )
119+ return 0
120+ fi
121121 cur=$COMP_CWORD
122- case $(( COMP_CWORD - cmd_cur + 1 )) in
123- * )
124- cur=$COMP_CWORD
125- if [ $cur -eq $COMP_CWORD ] ; then
126- file_completion " ."
122+ if [ $cur -eq $COMP_CWORD ] ; then
123+ file_completion " ."
127124
128- return 0
129- else
130- cmd_cur=$(( cmd_cur + 2 ))
131- fi
132- ;;
133- esac
125+ return 0
126+ else
127+ cmd_cur=$(( cmd_cur + 2 ))
128+ fi
134129
135130 return 0
136131 ;;
137132
138133 _cliname_cd)
139- if [[ ${COMP_WORDS[COMP_CWORD]} == -* ]] ; then
140- opts=" -P"
141- COMPREPLY=( $( compgen -W " ${opts} " -- " ${COMP_WORDS[COMP_CWORD]} " ) )
142- return 0
143- fi
144-
145134 cmd_cur=$cur
146135 while [ $cur -lt $COMP_CWORD ] ; do
147136 cur=$(( cur + 1 ))
@@ -155,23 +144,36 @@ _cliname() {
155144 ;;
156145 esac
157146 done
158- cur=$COMP_CWORD
159- case $(( COMP_CWORD - cmd_cur + 1 )) in
160- 1)
161- if [ $cur -eq $COMP_CWORD ] ; then
147+ if [[ ! ${COMP_WORDS[COMP_CWORD]} == -* ]] ; then
148+ cur=$COMP_CWORD
149+ case $(( COMP_CWORD - cmd_cur + 1 )) in
150+ 1)
151+ if [ $cur -eq $COMP_CWORD ] ; then
162152 file_completion " $HOME "
163153
164154 return 0
165155 else
166156 cmd_cur=$(( cmd_cur + 2 ))
167157 fi
168- ;;
169- esac
158+ ;;
159+ esac
160+ fi
161+
162+ if [[ ${COMP_WORDS[COMP_CWORD]} == -* ]] ; then
163+ opts=" -P"
164+ COMPREPLY=( $( compgen -W " ${opts} " -- " ${COMP_WORDS[COMP_CWORD]} " ) )
165+ return 0
166+ fi
170167
171168 return 0
172169 ;;
173170
174171 _cliname_test)
172+ cmd_cur=$cur
173+ while [ $cur -lt $COMP_CWORD ] ; do
174+ cur=$(( cur + 1 ))
175+ done
176+
175177 if [[ ${COMP_WORDS[COMP_CWORD]} == -* ]] ; then
176178 opts=" "
177179 COMPREPLY=( $( compgen -W " ${opts} " -- " ${COMP_WORDS[COMP_CWORD]} " ) )
@@ -182,19 +184,10 @@ _cliname() {
182184 return 0
183185 fi
184186
185- cmd_cur=$cur
186- while [ $cur -lt $COMP_CWORD ] ; do
187- cur=$(( cur + 1 ))
188- done
189-
190187 return 0
191188 ;;
192189
193190 _cliname_test_rubocop)
194- opts=" --auto-correct -A"
195- COMPREPLY=( $( compgen -W " ${opts} " -- " ${COMP_WORDS[COMP_CWORD]} " ) )
196- return 0
197-
198191 cmd_cur=$cur
199192 while [ $cur -lt $COMP_CWORD ] ; do
200193 cur=$(( cur + 1 ))
@@ -209,19 +202,21 @@ _cliname() {
209202 esac
210203 done
211204
205+ opts=" --auto-correct -A"
206+ COMPREPLY=( $( compgen -W " ${opts} " -- " ${COMP_WORDS[COMP_CWORD]} " ) )
207+
212208 return 0
213209 ;;
214210
215211 _cliname_test_pytest)
216- opts=" "
217- COMPREPLY=( $( compgen -W " ${opts} " -- " ${COMP_WORDS[COMP_CWORD]} " ) )
218- return 0
219-
220212 cmd_cur=$cur
221213 while [ $cur -lt $COMP_CWORD ] ; do
222214 cur=$(( cur + 1 ))
223215 done
224216
217+ opts=" "
218+ COMPREPLY=( $( compgen -W " ${opts} " -- " ${COMP_WORDS[COMP_CWORD]} " ) )
219+
225220 return 0
226221 ;;
227222
0 commit comments