diff options
-rw-r--r-- | completions/bash/apt | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/completions/bash/apt b/completions/bash/apt index 3a6b0682f..35716e7a7 100644 --- a/completions/bash/apt +++ b/completions/bash/apt @@ -53,7 +53,7 @@ _apt() local command i for (( i=0; i < ${#words[@]}-1; i++ )); do - if [[ ${COMMANDS[@]} =~ ${words[i]} ]]; then + if [[ " ${COMMANDS[*]} " == *" ${words[i]} "* ]]; then command=${words[i]} break fi @@ -198,9 +198,13 @@ _apt() return 0 ;; source|build-dep|showsrc|policy) - COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ - 2> /dev/null ) $( apt-cache dumpavail | \ - command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) ) + if [[ "$command" == build-dep && ( "$cur" == .* || "$cur" == /* || "$cur" == ~* ) ]]; then + _filedir "dsc" + else + COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ + 2> /dev/null ) $( apt-cache dumpavail | \ + command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) ) + fi return 0 ;; edit-sources) |