fix(complete): Ensure bash does not sort, we do

This commit is contained in:
Ed Page 2024-08-10 18:31:30 -05:00
parent 3ec980e7ad
commit 34c86159a9
3 changed files with 15 additions and 3 deletions

View file

@ -317,7 +317,11 @@ _clap_complete_NAME() {
compopt -o nospace
fi
}
complete -o nospace -o bashdefault -F _clap_complete_NAME BIN
if [[ \"${{BASH_VERSINFO[0]}}\" -eq 4 && \"${{BASH_VERSINFO[1]}}\" -ge 4 || \"${{BASH_VERSINFO[0]}}\" -gt 4 ]]; then
complete -o nospace -o bashdefault -o nosort -F _clap_complete_NAME BIN
else
complete -o nospace -o bashdefault -F _clap_complete_NAME BIN
fi
"#
.replace("NAME", &escaped_name)
.replace("BIN", bin)

View file

@ -17,6 +17,10 @@ _clap_complete_exhaustive() {
compopt -o nospace
fi
}
complete -o nospace -o bashdefault -F _clap_complete_exhaustive exhaustive
if [[ \"${{BASH_VERSINFO[0]}}\" -eq 4 && \"${{BASH_VERSINFO[1]}}\" -ge 4 || \"${{BASH_VERSINFO[0]}}\" -gt 4 ]]; then
complete -o nospace -o bashdefault -o nosort -F _clap_complete_exhaustive exhaustive
else
complete -o nospace -o bashdefault -F _clap_complete_exhaustive exhaustive
fi

View file

@ -15,5 +15,9 @@ _clap_complete_my_app() {
compopt -o nospace
fi
}
complete -o nospace -o bashdefault -F _clap_complete_my_app my-app
if [[ /"${{BASH_VERSINFO[0]}}/" -eq 4 && /"${{BASH_VERSINFO[1]}}/" -ge 4 || /"${{BASH_VERSINFO[0]}}/" -gt 4 ]]; then
complete -o nospace -o bashdefault -o nosort -F _clap_complete_my_app my-app
else
complete -o nospace -o bashdefault -F _clap_complete_my_app my-app
fi