@@ -87,11 +87,11 @@ _cliname() {
8787 --config)
8888 if [ $cur -eq $COMP_CWORD ] ; then
8989 _get_comp_words_by_ref -n : cur prev cword
90- dir=" $( echo ${cur } | grep -o " .*/" ) "
90+ dir=" $( echo ${COMP_WORDS[COMP_CWORD] } | grep -o " .*/" ) "
9191 if test " ${dir} " ; then
92- COMPREPLY=( $( compgen -W " $( ls -F " ./${dir} " | sed -E " s@(.*)@${dir} \1@g" ) " -- " ${cur } " ) )
92+ COMPREPLY=( $( compgen -W " $( ls -F " ./${dir} " | sed -E " s@(.*)@${dir} \1@g" ) " -- " ${COMP_WORDS[COMP_CWORD] } " ) )
9393 else
94- COMPREPLY=( $( compgen -W " $( ls -F " ./" ) " -- " ${cur } " ) )
94+ COMPREPLY=( $( compgen -W " $( ls -F " ./" ) " -- " ${COMP_WORDS[COMP_CWORD] } " ) )
9595 fi
9696
9797 return 0
@@ -102,7 +102,7 @@ _cliname() {
102102
103103 --type)
104104 if [ $cur -eq $COMP_CWORD ] ; then
105- COMPREPLY=( $( compgen -W " json toml" -- " $cur " ) )
105+ COMPREPLY=( $( compgen -W " json toml" -- " ${COMP_WORDS[COMP_CWORD]} " ) )
106106
107107 return 0
108108 else
@@ -156,11 +156,11 @@ _cliname() {
156156 cur=$COMP_CWORD
157157 if [ $cur -eq $COMP_CWORD ] ; then
158158 _get_comp_words_by_ref -n : cur prev cword
159- dir=" $( echo ${cur } | grep -o " .*/" ) "
159+ dir=" $( echo ${COMP_WORDS[COMP_CWORD] } | grep -o " .*/" ) "
160160 if test " ${dir} " ; then
161- COMPREPLY=( $( compgen -W " $( ls -F " ./${dir} " | sed -E " s@(.*)@${dir} \1@g" ) " -- " ${cur } " ) )
161+ COMPREPLY=( $( compgen -W " $( ls -F " ./${dir} " | sed -E " s@(.*)@${dir} \1@g" ) " -- " ${COMP_WORDS[COMP_CWORD] } " ) )
162162 else
163- COMPREPLY=( $( compgen -W " $( ls -F " ./" ) " -- " ${cur } " ) )
163+ COMPREPLY=( $( compgen -W " $( ls -F " ./" ) " -- " ${COMP_WORDS[COMP_CWORD] } " ) )
164164 fi
165165
166166 return 0
@@ -191,11 +191,11 @@ _cliname() {
191191 1)
192192 if [ $cur -eq $COMP_CWORD ] ; then
193193 _get_comp_words_by_ref -n : cur prev cword
194- dir=" $( echo ${cur } | grep -o " .*/" ) "
194+ dir=" $( echo ${COMP_WORDS[COMP_CWORD] } | grep -o " .*/" ) "
195195 if test " ${dir} " ; then
196- COMPREPLY=( $( compgen -W " $( ls -F " $HOME /${dir} " | sed -E " s@(.*)@${dir} \1@g" ) " -- " ${cur } " ) )
196+ COMPREPLY=( $( compgen -W " $( ls -F " $HOME /${dir} " | sed -E " s@(.*)@${dir} \1@g" ) " -- " ${COMP_WORDS[COMP_CWORD] } " ) )
197197 else
198- COMPREPLY=( $( compgen -W " $( ls -F " $HOME /" ) " -- " ${cur } " ) )
198+ COMPREPLY=( $( compgen -W " $( ls -F " $HOME /" ) " -- " ${COMP_WORDS[COMP_CWORD] } " ) )
199199 fi
200200
201201 return 0
@@ -256,7 +256,7 @@ _cliname() {
256256 fi
257257 cur=$COMP_CWORD
258258 if [ $cur -eq $COMP_CWORD ] ; then
259- COMPREPLY=( $( compgen -W " echo 'script1.sh script2.sh script3.sh'" -- " $cur " ) )
259+ COMPREPLY=( $( compgen -W " $( echo ' script1.sh script2.sh script3.sh' ) " -- " ${COMP_WORDS[COMP_CWORD]} " ) )
260260
261261 return 0
262262 else
0 commit comments