xkcdpass.bash-completion 824 B

123456789101112131415161718192021222324252627282930313233343536
  1. # Programmable Bash command completion for the ‘xkcdpass’ command.
  2. # See the Bash manual “Programmable Completion” section.
  3. shopt -s progcomp
  4. _xkcdpass_completion () {
  5. COMPREPLY=()
  6. local cur="${COMP_WORDS[COMP_CWORD]}"
  7. local prev="${COMP_WORDS[COMP_CWORD-1]}"
  8. local opts="-h --help -V --verbose"
  9. opts+=" -w --wordfile -v --valid-chars -a --acrostic"
  10. opts+=" -n --numwords --min --max"
  11. opts+=" -c --count -d --delimiter"
  12. case "${prev}" in
  13. -w|--wordfile)
  14. COMPREPLY=( $(compgen -A file -- ${cur}) )
  15. ;;
  16. *)
  17. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  18. ;;
  19. esac
  20. }
  21. complete -F _xkcdpass_completion xkcdpass
  22. # Local variables:
  23. # coding: utf-8
  24. # mode: shell-script
  25. # End:
  26. # vim: fileencoding=utf-8 filetype=bash :