/bash_completion.d/dput

http://github.com/brinkman83/bashrc · #! · 48 lines · 40 code · 8 blank · 0 comment · 0 complexity · ce16d64e83be90e5bc4504556bc5988a MD5 · raw file

  1. #-*- mode: shell-script;-*-
  2. # Debian GNU/Linux dput(1) completion
  3. # Copyright 2002 Roland Mas <lolando@debian.org>
  4. have dput &&
  5. _dput()
  6. {
  7. local cur prev options paroptions special i delayed_options hosts
  8. COMPREPLY=()
  9. cur=${COMP_WORDS[COMP_CWORD]}
  10. prev=${COMP_WORDS[COMP_CWORD-1]}
  11. options='-c --config -d --debug -D --dinstall -f --force -h --help \
  12. -H --host-list -l --lintian -o --check-only -p --print \
  13. -P --passive -s --simulate -u --unchecked -d --delayed \
  14. -v --version -V --check-version'
  15. hosts=$(
  16. {
  17. grep "^\[.*\]" $HOME/.dput.cf 2> /dev/null | tr -d [] || /bin/true
  18. grep "^\[.*\]" /etc/dput.cf 2> /dev/null | tr -d [] || /bin/true
  19. } | grep -v '^DEFAULT$' | sort -u)
  20. paroptions="$options $hosts"
  21. case $prev in
  22. --delayed|-e)
  23. delayed_options='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15'
  24. COMPREPLY=( $( compgen -W "$delayed_options" | grep ^$cur ) )
  25. ;;
  26. --config|-c)
  27. COMPREPLY=( $( compgen -o filenames -G "$cur*" ) )
  28. ;;
  29. *)
  30. COMPREPLY=( $(
  31. compgen -G "${cur}*.changes"
  32. compgen -G "${cur}*.asc"
  33. compgen -G "${cur}*.sig"
  34. compgen -W "$paroptions" | grep "^$cur"
  35. ) )
  36. ;;
  37. esac
  38. return 0
  39. }
  40. [ "$have" ] && complete -F _dput -o filenames -o plusdirs dput