-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_note
More file actions
65 lines (59 loc) · 1.63 KB
/
Copy path_note
File metadata and controls
65 lines (59 loc) · 1.63 KB
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
#compdef note
# Add competion for shell(zsh)
function _subcommands
{
local -a subcmds
subcmds=(
"create:create new note file"
"random:show random selected note"
"select:show note selected by tag"
"select_all:show all notes selected by tag"
"tag:add new tag"
"edit:edit note file by his name/path"
"clear:delete all note files"
"update:update git remote repository"
"search:search notes that contain word"
"hide:hide note"
"image:add/show/remove images"
"video:save video from youtube"
"notification:set/show notification with note content"
"open:open notes directory"
"stat:show number of notes in each tag(directory)"
"history:history of adding new notes"
"learn:show notes, step by step on selected tag"
"wallpaper:set random wallpaper"
"sync:make local and remote git repositories be in the same state"
)
_describe 'command' subcmds
}
function _show_tags
{
local -a tags
note_dir=$(dirname $(whereis note | cut -d: -f2))
tags=($(cat $note_dir/tags))
_describe 'tags' tags
}
function _note
{
local ret=1
_arguments -C \
'*::arg:->args' \
&& ret=0
case "$state" in
(args)
case $words[1] in
(create)
_show_tags && ret=0
;;
(select_all)
_show_tags && ret=0
;;
("")
_subcommands && ret=0
;;
esac
;;
esac
return ret
}
_note