1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
#
# 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
opts=(
-a --add
--ai
-c --comment
--cached
--colors
-d --delete
--deep
-e --export
--expand
-f --format
-h --help
-i --import
--immutable
-j --json
-k --unlock
-l --lock
-n --count
--nc
--np
-o --open
--oa
-p --print
-r --sreg
--replace
-s --sany
-S --sall
--shorten
--suggest
-t --stag
--tacit
--tag
--threads
--title
-u --update
--url
-V
-v --version
-w --write
-x --exclude
-z --debug
)
opts_with_arg=(
-a --add
--cached
--colors
-e --export
--expand
-f --format
-i --import
--immutable
-n --count
-r --sreg
--replace
-s --sany
-S --sall
--shorten
--threads
--url
-x --exclude
)
# 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
|