# bash-completion for flameshot command # To be installed in "/usr/share/bash-completion/completions/flameshot" _flameshot() { local prev cur cmd gui_opts full_opts config_opts COMPREPLY=() prev="${COMP_WORDS[COMP_CWORD-1]}" cur="${COMP_WORDS[COMP_CWORD]}" cmd="gui full config" gui_opts="--path --delay -p -d" full_opts="--path --delay --clipboard -p -d -c" config_opts="--contrastcolor --filename --maincolor --showhelp --trayicon -k -f -m -s -t" case "${prev}" in gui) COMPREPLY=( $(compgen -W "$gui_opts --help -h" -- ${cur}) ) return 0 ;; full) COMPREPLY=( $(compgen -W "$full_opts --help -h" -- ${cur}) ) return 0 ;; config) COMPREPLY=( $(compgen -W "$config_opts --help -h" -- ${cur}) ) return 0 ;; -f|--filename|-p|--path) _filedir -d return 0 ;; -s|--showhelp|-t|--trayicon) COMPREPLY=( $(compgen -W "true false" -- ${cur}) ) return 0 ;; -d|--delay|-h|--help|-c|--clipboard|--version|-v) return 0 ;; *) ;; esac # Options case "${cur}" in -*) COMPREPLY=( $( compgen -W "--version --help -v -h" -- ${cur}) ) return 0 ;; --*) COMPREPLY=( $( compgen -W "--version --help" -- ${cur}) ) return 0 ;; *) COMPREPLY=( $( compgen -W "${cmd}" -- ${cur}) ) return 0 ;; esac } complete -F _flameshot flameshot