-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompspec
34 lines (34 loc) · 1.16 KB
/
compspec
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
lnotewords='create delete edit equation export figure item linebreak list
merge paragraph prune rename section text view path'
notebooks="`ls ~/data/lnote` yesterday today tomorrow first last"
_lnote()
{
local curw
COMPREPLY=()
curw=${COMP_WORDS[COMP_CWORD]}
cur1=${COMP_WORDS[1]}
if [ $COMP_CWORD == 1 ]
then
COMPREPLY=($(compgen -W '$lnotewords' -- $curw))
else
if [ "$cur1" == "figure" ] || [ "$cur1" == "f" ]
then
COMPREPLY=($(compgen -A file -- $curw))
elif [ "$cur1" == "create" ] || [ "$cur1" == "c" ] \
|| [ "$cur1" == "delete" ] || [ "$cur1" == "d" ] \
|| [ "$cur1" == "rename" ] || [ "$cur1" == "r" ] \
|| [ "$cur1" == "list" ] || [ "$cur1" == "l" ] \
|| [ "$cur1" == "edit" ] || [ "$cur1" == "e" ] \
|| [ "$cur1" == "merge" ] || [ "$cur1" == "m" ] \
|| [ "$cur1" == "view" ] || [ "$cur1" == "v" ] \
|| [ "$cur1" == "path" ] \
|| [ "$cur1" == "export" ] || [ "$cur1" == "x" ]
then
COMPREPLY=($(compgen -W '$notebooks' -- $curw))
else
COMPREPLY=($(compgen -W '' -- $curw))
fi
fi
return 0
}
complete -F _lnote -o dirnames lnote