Add bash-completion in the install

This commit is contained in:
lupoDharkael
2017-12-14 21:10:13 +01:00
parent fb8112a2a4
commit 5ba50ebf1d
2 changed files with 5 additions and 1 deletions

View File

@@ -0,0 +1,59 @@
# 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