_geeknote
3983 bytes
1#compdef geeknote
2
3# Geeknote Autocomplete plugin for Zsh
4# Requires: Geeknote installed
5# Author : Ján Koščo (@s7anley)
6
7__login() {
8 # no arguments
9}
10
11__logout() {
12 _arguments \
13 '--force[Do not ask about logging out.]'
14}
15
16__settings() {
17 _arguments \
18 "--editor+[Set the editor, which use to edit and create notes.]::"
19}
20
21__create() {
22 _arguments \
23 '--title+[The note title.]::' \
24 '--content+[The note content.]::' \
25 '--tags+[One tag or the list of tags which will be added to the note.]::' \
26 '--notebook+[Set the notebook where to save note.]::' \
27 '--resource+[Add a resource to the note.]::'
28}
29
30__edit() {
31 _arguments \
32 '--note+[The name or ID from the previous search of a note to edit.]::' \
33 '--title+[Set new title of the note.]::' \
34 '--content+[Set new content of the note.]::' \
35 '--tags+[Set new list o tags for the note.]::' \
36 '--notebook+[Assign new notebook for the note.]::' \
37 '--resource+[Add a resource to the note.]::'
38}
39
40__find() {
41 _arguments \
42 '--search+[Text to search.]::' \
43 '--tags+[Notes with which tag/tags to search.]::' \
44 '--notebook+[In which notebook search the note.]::' \
45 '--date+[Set date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy.]::' \
46 '--count+[How many notes show in the result list.]::' \
47 '--with-url[Add direct url of each note in results to Evernote web-version.]' \
48 '--content-search[Search by content, not by title.]' \
49 '--exact-entry[Search for exact entry of the request.]'
50}
51
52__show() {
53 _arguments \
54 '--note+[The name or ID from the previous search of a note to show.]::' \
55 '--raw[Show the raw note body.]'
56}
57
58__remove() {
59 _arguments \
60 '--note+[The name or ID from the previous search of a note to remove.]::' \
61 '--force[Do not ask about removing.]'
62}
63
64__notebook-list() {
65 # no arguments
66}
67
68__notebook-create() {
69 _arguments \
70 '--title+[Set the title of new notebook.]::'
71}
72
73__notebook-edit() {
74 _arguments \
75 '--title+[Set the title of new notebook.]::' \
76 '--notebook+[The name of a notebook to rename.]::'
77}
78
79__tag-list() {
80 # no arguments
81}
82
83__tag-create() {
84 _arguments \
85 '--title+[Set the title of new tag.]::'
86}
87
88__tag-edit() {
89 _arguments \
90 '--tagname+[The name of a tag to rename.]::' \
91 '--title+[Set the new name of tag.]::'
92}
93
94__user() {
95 _arguments \
96 '--full[Show full information.]'
97}
98
99local -a _1st_arguments
100_1st_arguments=(
101 'login':'Authorize in Evernote.'
102 'logout':'Logout from Evernote.'
103 'settings':'Show and edit current settings.'
104 'create':'Create note in Evernote.'
105 'edit':'Edit note in Evernote.'
106 'find':'Search notes in Evernote.'
107 'show':'Output note in the terminal.'
108 'remove':'Remove note from Evernote.'
109 'notebook-list':'Show the list of existing notebooks in your Evernote.'
110 'notebook-create':'Create new notebook.'
111 'notebook-edit':'Edit/rename notebook.'
112 'tag-list':'Show the list of existing tags in your Evernote.'
113 'tag-create':'Create new tag.'
114 'tag-edit':'Edit/rename tag.'
115 'user':'Show information about active user.'
116)
117
118_arguments '*:: :->command'
119
120if (( CURRENT == 1 )); then
121 _describe -t commands "geeknote command" _1st_arguments
122 return
123fi
124
125local -a _command_args
126case "$words[1]" in
127 login)
128 __login ;;
129 logout)
130 __logout ;;
131 settings)
132 __settings ;;
133 create)
134 __create ;;
135 edit)
136 __edit ;;
137 find)
138 __find ;;
139 show)
140 __show ;;
141 remove)
142 __remove ;;
143 notebook-list)
144 __notebook-list ;;
145 notebook-create)
146 __notebook-create ;;
147 notebook-edit)
148 __notebook-edit ;;
149 tag-list)
150 __tag-list ;;
151 tag-create)
152 __tag-create ;;
153 tag-edit)
154 __tag-edit ;;
155 user)
156 __user ;;
157esac