_geeknote 3.89 KB
Newer Older
Ján Koščo's avatar
Ján Koščo committed
1
#compdef geeknote
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

# Geeknote Autocomplete plugin for Zsh
# Requires: Geeknote installed
# Author : Ján Koščo (@s7anley)

__login() {
    # no arguments
}

__logout() {
    _arguments \
        '--force[Do not ask about logging out.]'
}

__settings() {
    _arguments \
        "--editor+[Set the editor, which use to edit and create notes.]::"
}

__create() {
    _arguments \
        '--title+[The note title.]::' \
        '--content+[The note content.]::' \
        '--tags+[One tag or the list of tags which will be added to the note.]::' \
        '--notebook+[Set the notebook where to save note.]::' \
        '--resource+[Add a resource to the note.]::'
}

__edit() {
    _arguments \
        '--note+[The name or ID from the previous search of a note to edit.]::' \
        '--title+[Set new title of the note.]::' \
        '--content+[Set new content of the note.]::' \
        '--tags+[Set new list o tags for the note.]::' \
        '--notebook+[Assign new notebook for the note.]::' \
        '--resource+[Add a resource to the note.]::'
}

__find() {
    _arguments \
        '--search+[Text to search.]::' \
        '--tags+[Notes with which tag/tags to search.]::' \
        '--notebook+[In which notebook search the note.]::' \
        '--date+[Set date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy.]::' \
        '--count+[How many notes show in the result list.]::' \
        '--with-url[Add direct url of each note in results to Evernote web-version.]' \
        '--content-search[Search by content, not by title.]' \
        '--exact-entry[Search for exact entry of the request.]'
}

__show() {
    _arguments \
        '--note+[The name or ID from the previous search of a note to show.]::' \
        '--raw[Show the raw note body.]'
}

__remove() {
    _arguments \
        '--note+[The name or ID from the previous search of a note to remove.]::' \
        '--force[Do not ask about removing.]'
}

__notebook-list() {
    # no arguments
}

__notebook-create() {
    _arguments \
        '--title+[Set the title of new notebook.]::'
}

__notebook-edit() {
    _arguments \
        '--title+[Set the title of new notebook.]::' \
        '--notebook+[The name of a notebook to rename.]::'
}

__tag-list() {
    # no arguments
}

__tag-create() {
    _arguments \
        '--title+[Set the title of new tag.]::'
}

__tag-edit() {
    _arguments \
        '--tagname+[The name of a tag to rename.]::' \
        '--title+[Set the new name of tag.]::'
}

__user() {
    _arguments \
        '--full[Show full information.]'
}
Ján Koščo's avatar
Ján Koščo committed
98
99
100

local -a _1st_arguments
_1st_arguments=(
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
    'login':'Authorize in Evernote.'
    'logout':'Logout from Evernote.'
    'settings':'Show and edit current settings.'
    'create':'Create note in Evernote.'
    'edit':'Edit note in Evernote.'
    'find':'Search notes in Evernote.'
    'show':'Output note in the terminal.'
    'remove':'Remove note from Evernote.'
    'notebook-list':'Show the list of existing notebooks in your Evernote.'
    'notebook-create':'Create new notebook.'
    'notebook-edit':'Edit/rename notebook.'
    'tag-list':'Show the list of existing tags in your Evernote.'
    'tag-create':'Create new tag.'
    'tag-edit':'Edit/rename tag.'
    'user':'Show information about active user.'
Ján Koščo's avatar
Ján Koščo committed
116
117
118
119
120
)

_arguments '*:: :->command'

if (( CURRENT == 1 )); then
121
122
    _describe -t commands "geeknote command" _1st_arguments
    return
Ján Koščo's avatar
Ján Koščo committed
123
124
125
126
fi

local -a _command_args
case "$words[1]" in
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
    login)
       __login ;;
    logout)
        __logout ;;
    settings)
        __settings ;;
    create)
        __create ;;
    edit)
        __edit ;;
    find)
        __find ;;
    show)
        __show ;;
    remove)
        __remove ;;
    notebook-list)
        __notebook-list ;;
    notebook-create)
        __notebook-create ;;
    notebook-edit)
        __notebook-edit ;;
    tag-list)
        __tag-list ;;
    tag-create)
        __tag-create ;;
    tag-edit)
        __tag-edit ;;
    user)
        __user ;;
esac