Skip to content

Commit bdcb887

Browse files
authored
Merge pull request #129 from yassun7010/fix_bash_delegate_logic
fix: bash delegate logic.
2 parents cbed485 + b995141 commit bdcb887

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

cmdcomp/v2/templates/bash.sh.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ COMP_POINT=$((COMP_POINT + {{ command.targets | join(" ") | length + 1 }}))
7979
COMP_WORDS=({{ command.targets | join(" ") }} "${COMP_WORDS[{{ depth + 1 }}, -1]}")
8080
COMP_CWORD={{ "${#COMP_WORDS[@]}" }}
8181

82-
_command_offset 0
82+
[ -x "$(command -v _command_offset)" ] && _command_offset 0
8383
{%- elif command.has_subcommands -%}
8484
if [[ ${COMP_WORDS[COMP_CWORD]} == -* ]] ; then
8585
opts="{{ command.keyword_names_with_alias|join(' ') }}"

examples/demo/output.bash

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ _mycli() {
143143
COMP_WORDS=(aws "${COMP_WORDS[4, -1]}")
144144
COMP_CWORD=${#COMP_WORDS[@]}
145145

146-
_command_offset 0
146+
[ -x "$(command -v _command_offset)" ] && _command_offset 0
147147

148148
return 0
149149
;;
@@ -168,7 +168,7 @@ _mycli() {
168168
COMP_WORDS=(aws s3 "${COMP_WORDS[4, -1]}")
169169
COMP_CWORD=${#COMP_WORDS[@]}
170170

171-
_command_offset 0
171+
[ -x "$(command -v _command_offset)" ] && _command_offset 0
172172

173173
return 0
174174
;;
@@ -193,7 +193,7 @@ _mycli() {
193193
COMP_WORDS=(gcloud "${COMP_WORDS[4, -1]}")
194194
COMP_CWORD=${#COMP_WORDS[@]}
195195

196-
_command_offset 0
196+
[ -x "$(command -v _command_offset)" ] && _command_offset 0
197197

198198
return 0
199199
;;
@@ -218,7 +218,7 @@ _mycli() {
218218
COMP_WORDS=(gcloud storage "${COMP_WORDS[4, -1]}")
219219
COMP_CWORD=${#COMP_WORDS[@]}
220220

221-
_command_offset 0
221+
[ -x "$(command -v _command_offset)" ] && _command_offset 0
222222

223223
return 0
224224
;;
@@ -243,7 +243,7 @@ _mycli() {
243243
COMP_WORDS=(gcloud composer operations "${COMP_WORDS[4, -1]}")
244244
COMP_CWORD=${#COMP_WORDS[@]}
245245

246-
_command_offset 0
246+
[ -x "$(command -v _command_offset)" ] && _command_offset 0
247247

248248
return 0
249249
;;

examples/v2/output.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ _cliname() {
283283
COMP_WORDS=(gcloud storage "${COMP_WORDS[3, -1]}")
284284
COMP_CWORD=${#COMP_WORDS[@]}
285285

286-
_command_offset 0
286+
[ -x "$(command -v _command_offset)" ] && _command_offset 0
287287

288288
return 0
289289
;;

0 commit comments

Comments
 (0)