diff options
| -rw-r--r-- | completions/bash/apt | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/completions/bash/apt b/completions/bash/apt index b615c578f..59a8eaa94 100644 --- a/completions/bash/apt +++ b/completions/bash/apt @@ -52,7 +52,7 @@ _apt() "policy") local command i - for (( i=0; i < ${#words[@]}-1; i++ )); do + for (( i=1; i < ${#words[@]}; i++ )); do if [[ " ${COMMANDS[*]} " == *" ${words[i]} "* ]]; then command=${words[i]} break @@ -67,8 +67,9 @@ _apt() ;; esac - # supported options per command - if [[ "$cur" == -* ]]; then + # When the cursor (cword) is before the command word (i), only suggest + # options but not package or file names: + if [[ $cur == -* || ( -v command && $cword -le $i ) ]]; then case ${command-} in install|reinstall|remove|purge|upgrade|dist-upgrade|full-upgrade|autoremove|autopurge) COMPREPLY=( $( compgen -W '--show-progress @@ -167,6 +168,8 @@ _apt() return 0 ;; esac + + return fi # specific command arguments |
