flameshot.bash 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #compdef flameshot
  2. # Shell completion for flameshot command
  3. # To be installed in "/usr/share/bash-completion/completions/flameshot"
  4. # and "/usr/share/zsh/site-functions/"
  5. _flameshot() {
  6. local prev cur cmd gui_opts full_opts config_opts
  7. COMPREPLY=()
  8. prev="${COMP_WORDS[COMP_CWORD-1]}"
  9. cur="${COMP_WORDS[COMP_CWORD]}"
  10. cmd="gui full config launcher screen"
  11. screen_opts="--number --path --delay --raw -p -d -r -n"
  12. gui_opts="--path --delay --raw -p -d -r"
  13. full_opts="--path --delay --clipboard --raw -p -d -c -r"
  14. config_opts="--contrastcolor --filename --maincolor --showhelp --trayicon --autostart -k -f -m -s -t -a"
  15. case "${prev}" in
  16. launcher)
  17. return 0
  18. ;;
  19. screen)
  20. COMPREPLY=( $(compgen -W "$screen_opts --help -h" -- "${cur}") )
  21. return 0
  22. ;;
  23. gui)
  24. COMPREPLY=( $(compgen -W "$gui_opts --help -h" -- "${cur}") )
  25. return 0
  26. ;;
  27. full)
  28. COMPREPLY=( $(compgen -W "$full_opts --help -h" -- "${cur}") )
  29. return 0
  30. ;;
  31. config)
  32. COMPREPLY=( $(compgen -W "$config_opts --help -h" -- "${cur}") )
  33. return 0
  34. ;;
  35. -f|--filename|-p|--path)
  36. _filedir -d
  37. return 0
  38. ;;
  39. -s|--showhelp|-t|--trayicon)
  40. COMPREPLY=( $(compgen -W "true false" -- "${cur}") )
  41. return 0
  42. ;;
  43. -d|--delay|-h|--help|-c|--clipboard|--version|-v|--number|-n)
  44. return 0
  45. ;;
  46. *)
  47. ;;
  48. esac
  49. # Options
  50. case "${cur}" in
  51. -*)
  52. COMPREPLY=( $( compgen -W "--version --help -v -h" -- "${cur}") )
  53. return 0
  54. ;;
  55. --*)
  56. COMPREPLY=( $( compgen -W "--version --help" -- "${cur}") )
  57. return 0
  58. ;;
  59. *)
  60. COMPREPLY=( $( compgen -W "${cmd}" -- "${cur}") )
  61. return 0
  62. ;;
  63. esac
  64. }
  65. if [[ -n ${ZSH_VERSION} ]]; then
  66. autoload -U bashcompinit
  67. bashcompinit
  68. fi
  69. complete -F _flameshot flameshot