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-05-18 11:13:49 -05:00
|
|
|
opts=(-a --add -c --comment -d --delete -h --help -k --unlock -l --lock -o --open
|
2016-05-18 12:56:35 -05:00
|
|
|
-p --print -r --replace -s --sany -S --sall --st --stag -t --title -u --update)
|
2016-05-15 02:05:13 -05:00
|
|
|
opts_with_arg=(-a --add -o --open -r --replace -s --sany -S --sall)
|
|
|
|
|
|
|
|
# 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
|