scaleway-cli
scaleway-cli copied to clipboard
Autocompletion script wrongly generated (at least) for bash if using path to call `scw`
https://github.com/scaleway/scaleway-cli/blob/d17343311bb0f7645dea2d01ecb2cb00adbacbac/internal/namespaces/autocomplete/autocomplete.go#L81
…because the basename of binaryName should be extracted. In the following test, scw is called with full path, resulting in wrongly named bash function:
$ ~/bin/scw autocomplete script shell=bash
_/home/mid/bin/scw() {
_get_comp_words_by_ref -n = cword words
output=$(/home/mid/bin/scw autocomplete complete bash -- "$COMP_LINE" "$cword" "${words[@]}")
COMPREPLY=($output)
# apply compopt option and ignore failure for older bash versions
[[ $COMPREPLY == *= ]] && compopt -o nospace 2> /dev/null || true
return
}
complete -F _/home/mid/bin/scw /home/mid/bin/scw
:wink:
Similar to #1959