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
|
2019-07-08 18:05:30 +00:00
|
|
|
local -a opts
|
2017-09-02 06:53:19 +00:00
|
|
|
opts=(
|
2018-12-09 03:06:00 +00:00
|
|
|
-b
|
2019-03-11 14:54:44 +00:00
|
|
|
-d
|
2017-09-02 06:53:19 +00:00
|
|
|
-e
|
|
|
|
-h
|
|
|
|
-i
|
|
|
|
-l
|
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
|
|
|
)
|
2019-07-08 18:05:30 +00:00
|
|
|
if [[ $prev == -b ]]; then
|
|
|
|
local bookmarks=$(echo $NNN_BMS | awk -F: -v RS=\; '{print $1}')
|
|
|
|
COMPREPLY=( $(compgen -W "$bookmarks" -- "$cur") )
|
|
|
|
elif [[ $prev == -p ]]; then
|
|
|
|
COMPREPLY=( $(compgen -f -d -- "$cur") )
|
|
|
|
elif [[ $cur == -* ]]; then
|
|
|
|
COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") )
|
|
|
|
else
|
|
|
|
COMPREPLY=( $(compgen -f -d -- "$cur") )
|
|
|
|
fi
|
2017-09-02 06:53:19 +00:00
|
|
|
}
|
|
|
|
|
2019-07-08 18:05:30 +00:00
|
|
|
complete -o filenames -F _nnn nnn
|