Make relative symlinks with minimal traversal.
[dput.git] / bash_completion
blob036f162c3aa6f1a498511ae7e9ad5cbfc85f54b9
1 # Bash command completion for Debian GNU/Linux dput(1).
3 # Copyright © 2015 Ben Finney <ben+debian@benfinney.id.au>
4 # Copyright © 2002 Roland Mas <lolando@debian.org>
6 have dput &&
7 _dput()
9     local cur prev options paroptions special i delayed_options hosts
11     COMPREPLY=()
12     cur=${COMP_WORDS[COMP_CWORD]}
13     prev=${COMP_WORDS[COMP_CWORD-1]}
14     options='-c --config -d --debug -D --dinstall -f --force -h --help \
15              -H --host-list -l --lintian -o --check-only -p --print \
16              -P --passive -s --simulate -u --unchecked -e --delayed \
17              -v --version -V --check-version'
19     hosts=$(
20         {
21             grep "^\[.*\]" $HOME/.dput.cf 2> /dev/null | tr -d [] || /bin/true
22             grep "^\[.*\]" /etc/dput.cf 2> /dev/null | tr -d [] || /bin/true
23         } | grep -v '^DEFAULT$' | sort -u)
25     paroptions="$options $hosts"
27     case $prev in
28         --delayed|-e)
29             delayed_options='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15'
30             COMPREPLY=( $( compgen -W "$delayed_options" | grep ^$cur ) )
31             ;;
32         --config|-c)
33             COMPREPLY=( $( compgen -o filenames -G "$cur*" ) )
34             ;;
35         *)
36             COMPREPLY=( $(
37                     compgen -G "${cur}*.changes"
38                     compgen -G "${cur}*.asc"
39                     compgen -G "${cur}*.sig"
40                     compgen -W "$paroptions" | grep "^$cur"
41                 ) )
42             ;;
43     esac
45     return 0
48 [ "$have" ] && complete -F _dput -o filenames -o plusdirs dput
51 # Local variables:
52 # coding: utf-8
53 # mode: sh
54 # End:
55 # vim: fileencoding=utf-8 filetype=sh :