File tree Expand file tree Collapse file tree 16 files changed +108
-38
lines changed
dynamic-env/exhaustive/bash Expand file tree Collapse file tree 16 files changed +108
-38
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,12 @@ impl Generator for Bash {
2525 "_{name}() {{
2626 local i cur prev opts cmd
2727 COMPREPLY=()
28- cur=\" ${{COMP_WORDS[COMP_CWORD]}}\"
29- prev=\" ${{COMP_WORDS[COMP_CWORD-1]}}\"
28+ if [[ \" ${{BASH_VERSINFO[0]}}\" -ge 4 ]]; then
29+ cur=\" $2\"
30+ else
31+ cur=\" ${{COMP_WORDS[COMP_CWORD]}}\"
32+ fi
33+ prev=\" $3\"
3034 cmd=\" \"
3135 opts=\" \"
3236
Original file line number Diff line number Diff line change @@ -37,13 +37,17 @@ _clap_complete_NAME() {
3737 else
3838 local _CLAP_COMPLETE_SPACE=true
3939 fi
40+ local words=("${COMP_WORDS[@]}")
41+ if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
42+ words[COMP_CWORD]="$2"
43+ fi
4044 COMPREPLY=( $( \
4145 _CLAP_IFS="$IFS" \
4246 _CLAP_COMPLETE_INDEX="$_CLAP_COMPLETE_INDEX" \
4347 _CLAP_COMPLETE_COMP_TYPE="$_CLAP_COMPLETE_COMP_TYPE" \
4448 _CLAP_COMPLETE_SPACE="$_CLAP_COMPLETE_SPACE" \
4549 VAR="bash" \
46- "COMPLETER" -- "${COMP_WORDS [@]}" \
50+ "COMPLETER" -- "${words [@]}" \
4751 ) )
4852 if [[ $? != 0 ]]; then
4953 unset COMPREPLY
Original file line number Diff line number Diff line change 11_my-app () {
22 local i cur prev opts cmd
33 COMPREPLY=()
4- cur=" ${COMP_WORDS[COMP_CWORD]} "
5- prev=" ${COMP_WORDS[COMP_CWORD-1]} "
4+ if [[ " ${BASH_VERSINFO[0]} " -ge 4 ]]; then
5+ cur=" $2 "
6+ else
7+ cur=" ${COMP_WORDS[COMP_CWORD]} "
8+ fi
9+ prev=" $3 "
610 cmd=" "
711 opts=" "
812
Original file line number Diff line number Diff line change 11_my-app () {
22 local i cur prev opts cmd
33 COMPREPLY=()
4- cur=" ${COMP_WORDS[COMP_CWORD]} "
5- prev=" ${COMP_WORDS[COMP_CWORD-1]} "
4+ if [[ " ${BASH_VERSINFO[0]} " -ge 4 ]]; then
5+ cur=" $2 "
6+ else
7+ cur=" ${COMP_WORDS[COMP_CWORD]} "
8+ fi
9+ prev=" $3 "
610 cmd=" "
711 opts=" "
812
Original file line number Diff line number Diff line change 11_bin-name () {
22 local i cur prev opts cmd
33 COMPREPLY=()
4- cur=" ${COMP_WORDS[COMP_CWORD]} "
5- prev=" ${COMP_WORDS[COMP_CWORD-1]} "
4+ if [[ " ${BASH_VERSINFO[0]} " -ge 4 ]]; then
5+ cur=" $2 "
6+ else
7+ cur=" ${COMP_WORDS[COMP_CWORD]} "
8+ fi
9+ prev=" $3 "
610 cmd=" "
711 opts=" "
812
Original file line number Diff line number Diff line change 11_my-app () {
22 local i cur prev opts cmd
33 COMPREPLY=()
4- cur=" ${COMP_WORDS[COMP_CWORD]} "
5- prev=" ${COMP_WORDS[COMP_CWORD-1]} "
4+ if [[ " ${BASH_VERSINFO[0]} " -ge 4 ]]; then
5+ cur=" $2 "
6+ else
7+ cur=" ${COMP_WORDS[COMP_CWORD]} "
8+ fi
9+ prev=" $3 "
610 cmd=" "
711 opts=" "
812
Original file line number Diff line number Diff line change @@ -10,13 +10,17 @@ _clap_complete_exhaustive() {
1010 else
1111 local _CLAP_COMPLETE_SPACE=true
1212 fi
13+ local words=(" ${COMP_WORDS[@]} " )
14+ if [[ " ${BASH_VERSINFO[0]} " -ge 4 ]]; then
15+ words[COMP_CWORD]=" $2 "
16+ fi
1317 COMPREPLY=( $( \
1418 _CLAP_IFS=" $IFS " \
1519 _CLAP_COMPLETE_INDEX=" $_CLAP_COMPLETE_INDEX " \
1620 _CLAP_COMPLETE_COMP_TYPE=" $_CLAP_COMPLETE_COMP_TYPE " \
1721 _CLAP_COMPLETE_SPACE=" $_CLAP_COMPLETE_SPACE " \
1822 COMPLETE=" bash" \
19- " exhaustive" -- " ${COMP_WORDS [@]} " \
23+ " exhaustive" -- " ${words [@]} " \
2024 ) )
2125 if [[ $? != 0 ]]; then
2226 unset COMPREPLY
Original file line number Diff line number Diff line change @@ -3,8 +3,12 @@ PS1='% '
33_exhaustive () {
44 local i cur prev opts cmd
55 COMPREPLY=()
6- cur=" ${COMP_WORDS[COMP_CWORD]} "
7- prev=" ${COMP_WORDS[COMP_CWORD-1]} "
6+ if [[ " ${BASH_VERSINFO[0]} " -ge 4 ]]; then
7+ cur=" $2 "
8+ else
9+ cur=" ${COMP_WORDS[COMP_CWORD]} "
10+ fi
11+ prev=" $3 "
812 cmd=" "
913 opts=" "
1014
Original file line number Diff line number Diff line change 11_my-app () {
22 local i cur prev opts cmd
33 COMPREPLY=()
4- cur=" ${COMP_WORDS[COMP_CWORD]} "
5- prev=" ${COMP_WORDS[COMP_CWORD-1]} "
4+ if [[ " ${BASH_VERSINFO[0]} " -ge 4 ]]; then
5+ cur=" $2 "
6+ else
7+ cur=" ${COMP_WORDS[COMP_CWORD]} "
8+ fi
9+ prev=" $3 "
610 cmd=" "
711 opts=" "
812
Original file line number Diff line number Diff line change 11_my-app () {
22 local i cur prev opts cmd
33 COMPREPLY=()
4- cur=" ${COMP_WORDS[COMP_CWORD]} "
5- prev=" ${COMP_WORDS[COMP_CWORD-1]} "
4+ if [[ " ${BASH_VERSINFO[0]} " -ge 4 ]]; then
5+ cur=" $2 "
6+ else
7+ cur=" ${COMP_WORDS[COMP_CWORD]} "
8+ fi
9+ prev=" $3 "
610 cmd=" "
711 opts=" "
812
You can’t perform that action at this time.
0 commit comments