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
|
2017-01-03 18:43:47 -06:00
|
|
|
opts=(
|
|
|
|
-a --add
|
2017-08-12 17:15:56 -05:00
|
|
|
--ai
|
2017-01-03 18:43:47 -06:00
|
|
|
-c --comment
|
2018-05-27 09:45:37 -05:00
|
|
|
--cached
|
2017-08-22 17:09:43 -05:00
|
|
|
--colors
|
2017-01-03 18:43:47 -06:00
|
|
|
-d --delete
|
|
|
|
--deep
|
|
|
|
-e --export
|
|
|
|
--expand
|
|
|
|
-f --format
|
|
|
|
-h --help
|
|
|
|
-i --import
|
|
|
|
--immutable
|
|
|
|
-j --json
|
|
|
|
-k --unlock
|
|
|
|
-l --lock
|
2018-06-16 21:35:32 -05:00
|
|
|
-n --count
|
2017-02-10 07:55:05 -06:00
|
|
|
--nc
|
2017-02-10 07:59:02 -06:00
|
|
|
--np
|
2017-01-03 18:43:47 -06:00
|
|
|
-o --open
|
2017-02-04 21:40:38 -06:00
|
|
|
--oa
|
2017-01-03 18:43:47 -06:00
|
|
|
-p --print
|
2017-03-16 13:45:12 -05:00
|
|
|
-r --sreg
|
2017-03-16 13:37:51 -05:00
|
|
|
--replace
|
2017-01-03 18:43:47 -06:00
|
|
|
-s --sany
|
|
|
|
-S --sall
|
|
|
|
--shorten
|
2017-08-01 10:37:03 -05:00
|
|
|
--suggest
|
2017-03-16 13:45:12 -05:00
|
|
|
-t --stag
|
2017-01-03 18:43:47 -06:00
|
|
|
--tacit
|
|
|
|
--tag
|
|
|
|
--threads
|
2017-03-16 13:15:37 -05:00
|
|
|
--title
|
2017-01-03 18:43:47 -06:00
|
|
|
-u --update
|
|
|
|
--url
|
2017-02-10 09:04:24 -06:00
|
|
|
-V
|
2017-01-03 18:43:47 -06:00
|
|
|
-v --version
|
2017-02-04 08:45:33 -06:00
|
|
|
-w --write
|
2018-03-25 22:33:46 -05:00
|
|
|
-x --exclude
|
2017-01-03 18:43:47 -06:00
|
|
|
-z --debug
|
|
|
|
)
|
|
|
|
opts_with_arg=(
|
|
|
|
-a --add
|
2018-05-27 09:45:37 -05:00
|
|
|
--cached
|
2017-08-22 17:09:43 -05:00
|
|
|
--colors
|
2017-01-03 18:43:47 -06:00
|
|
|
-e --export
|
|
|
|
--expand
|
|
|
|
-f --format
|
|
|
|
-i --import
|
|
|
|
--immutable
|
2018-06-16 21:35:32 -05:00
|
|
|
-n --count
|
2017-03-16 13:45:12 -05:00
|
|
|
-r --sreg
|
2017-03-16 13:37:51 -05:00
|
|
|
--replace
|
2017-01-03 18:43:47 -06:00
|
|
|
-s --sany
|
|
|
|
-S --sall
|
|
|
|
--shorten
|
|
|
|
--threads
|
|
|
|
--url
|
2018-03-25 22:33:46 -05:00
|
|
|
-x --exclude
|
2017-01-03 18:43:47 -06:00
|
|
|
)
|
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
|