Fix typos with COMP_CWORD varialble

This commit is contained in:
2023-03-19 18:55:25 +01:00
parent 8fd579c2cd
commit 8dd76f3295

View File

@@ -423,7 +423,7 @@ _VBoxManage() {
# foo bar disk baz # foo bar disk baz
# will search for word disk. # will search for word disk.
_get_medium () { _get_medium () {
case "${COMP_WORDS[COMP_CWORD-2]}" in case "${COMP_WORDS[$COMP_CWORD-2]}" in
disk) disk)
_hdd_comp _hdd_comp
;; ;;
@@ -475,9 +475,9 @@ _VBoxManage() {
COMP_WORDBREAKS=${COMP_WORDBREAKS//|/} # remove pipe from comp word breaks COMP_WORDBREAKS=${COMP_WORDBREAKS//|/} # remove pipe from comp word breaks
COMPREPLY=() COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[$COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}" prev="${COMP_WORDS[$COMP_CWORD-1]}"
if [[ COMP_CWORD -ge 2 ]]; then if [[ $COMP_CWORD -ge 2 ]]; then
cmd="${COMP_WORDS[1]}" cmd="${COMP_WORDS[1]}"
if [[ $cmd == "-q" ]]; then if [[ $cmd == "-q" ]]; then
cmd="${COMP_WORDS[2]}" cmd="${COMP_WORDS[2]}"
@@ -1740,7 +1740,7 @@ _VBoxManage() {
if [[ "${prev}" == "${subcommand}" ]]; then if [[ "${prev}" == "${subcommand}" ]]; then
_vms_comp vms _vms_comp vms
elif [[ " ${items[@]} " == *" $subcommand "* ]]; then elif [[ " ${items[*]} " == *" $subcommand "* ]]; then
case "${subcommand}" in case "${subcommand}" in
get) get)
_get_excluded_items "--verbose" _get_excluded_items "--verbose"
@@ -1751,7 +1751,8 @@ _VBoxManage() {
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;; ;;
enumerate) enumerate)
_get_excluded_items "--patterns" _get_excluded_items "--no-timestamp --no-flags --relative
--old-format"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;; ;;
wait) wait)
@@ -2803,7 +2804,7 @@ _VBoxManage() {
;; ;;
unattended) unattended)
if [[ COMP_CWORD -ge 3 ]]; then if [[ $COMP_CWORD -ge 3 ]]; then
subcommand="${COMP_WORDS[2]}" subcommand="${COMP_WORDS[2]}"
if [[ $subcommand == "${cmd}" ]]; then if [[ $subcommand == "${cmd}" ]]; then
subcommand="${COMP_WORDS[3]}" subcommand="${COMP_WORDS[3]}"
@@ -2900,7 +2901,7 @@ _VBoxManage() {
;; ;;
usbdevsource) usbdevsource)
if [[ COMP_CWORD -ge 3 ]]; then if [[ $COMP_CWORD -ge 3 ]]; then
subcommand="${COMP_WORDS[2]}" subcommand="${COMP_WORDS[2]}"
if [[ $subcommand == "${cmd}" ]]; then if [[ $subcommand == "${cmd}" ]]; then
subcommand="${COMP_WORDS[3]}" subcommand="${COMP_WORDS[3]}"
@@ -2923,7 +2924,7 @@ _VBoxManage() {
;; ;;
usbfilter) usbfilter)
if [[ COMP_CWORD -ge 3 ]]; then if [[ $COMP_CWORD -ge 3 ]]; then
subcommand="${COMP_WORDS[2]}" subcommand="${COMP_WORDS[2]}"
if [[ $subcommand == "${cmd}" ]]; then if [[ $subcommand == "${cmd}" ]]; then
subcommand="${COMP_WORDS[3]}" subcommand="${COMP_WORDS[3]}"