2017-09-02 06:53:19 +00:00
|
|
|
#
|
|
|
|
# Rudimentary Bash completion definition for nnn.
|
|
|
|
#
|
|
|
|
# Author:
|
|
|
|
# Arun Prakash Jana <engineerarun@gmail.com>
|
|
|
|
#
|
|
|
|
|
|
|
|
_nnn () {
|
|
|
|
COMPREPLY=()
|
|
|
|
local IFS=$' \n'
|
|
|
|
local cur=$2 prev=$3
|
|
|
|
local -a opts opts_with_args
|
|
|
|
opts=(
|
2018-12-09 03:06:00 +00:00
|
|
|
-b
|
2018-12-04 03:58:04 +00:00
|
|
|
-C
|
2017-09-02 06:53:19 +00:00
|
|
|
-e
|
|
|
|
-h
|
|
|
|
-i
|
|
|
|
-l
|
2019-02-05 18:43:04 +00:00
|
|
|
-n
|
2018-12-09 03:06:00 +00:00
|
|
|
-p
|
2019-02-05 19:08:55 +00:00
|
|
|
-s
|
2017-09-02 06:53:19 +00:00
|
|
|
-S
|
|
|
|
-v
|
2019-02-27 15:33:14 +00:00
|
|
|
-w
|
2017-09-02 06:53:19 +00:00
|
|
|
)
|
|
|
|
opts_with_arg=(
|
2018-12-09 03:06:00 +00:00
|
|
|
-b
|
|
|
|
-p
|
2017-09-02 06:53:19 +00: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 _nnn nnn
|