2016-05-15 02:05:13 -05:00
|
|
|
#
|
|
|
|
# Bash completion definition for buku.
|
|
|
|
#
|
|
|
|
# Author:
|
|
|
|
# Arun Prakash Jana <engineerarun@gmail.com>
|
|
|
|
#
|
|
|
|
|
|
|
|
_buku () {
|
|
|
|
COMPREPLY=()
|
|
|
|
local IFS=$' \n'
|
|
|
|
local cur=$2 prev=$3
|
|
|
|
local -a opts opts_with_args
|
2016-10-23 13:11:31 -05:00
|
|
|
opts=(-a --add -c --comment --deep -d --delete -e --export -h --help
|
2016-11-05 17:43:03 -05:00
|
|
|
--immutable -i --import -k --unlock -l --lock --markdown -m --merge
|
|
|
|
--noprompt -o --open -p --print -r --replace -s --sany -S --sall
|
2016-11-07 11:35:02 -06:00
|
|
|
--stag --tacit --tag -t --title -u --update --upstream --url)
|
2016-11-05 17:43:03 -05:00
|
|
|
opts_with_arg=(-a --add -e --export --immutable -i --import -m --merge
|
2016-06-02 10:39:16 -05:00
|
|
|
-o --open -r --replace -s --sany -S --sall --url)
|
2016-05-15 02:05:13 -05:00
|
|
|
|
|
|
|
# Do not complete non option names
|
|
|
|
[[ $cur == -* ]] || return 1
|
|
|
|
|
|
|
|
# Do not complete when the previous arg is an option expecting an argument
|
|
|
|
for opt in "${opts_with_arg[@]}"; do
|
|
|
|
[[ $opt == $prev ]] && return 1
|
|
|
|
done
|
|
|
|
|
|
|
|
# Complete option names
|
|
|
|
COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") )
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
complete -F _buku buku
|