_geeknote 3.71 KB
Newer Older
Ján Koščo's avatar
Ján Koščo committed
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
#compdef geeknote
# --------------- ------------------------------------------------------------
#           Name : _geeknote
#       Synopsis : zsh completion for geeknote
#         Author : Ján Koščo <3k.stanley@gmail.com>
#       HomePage : http://www.geeknote.me
#        Version : 0.1
#            Tag : [ shell, zsh, completion, evernote ]
#      Copyright : © 2014 by Ján Koščo,
#                  Released under current GPL license.
# --------------- ------------------------------------------------------------

local -a _1st_arguments
_1st_arguments=(
  'login'
  'logout'
  'settings'
  'create'
  'edit'
  'find'
  'show'
  'remove'
  'notebook-list'
  'notebook-create'
  'notebook-edit'
  'tag-list'
  'tag-create'
  'tag-edit'
Ján Koščo's avatar
Ján Koščo committed
29
  'tag-remove'
Ján Koščo's avatar
Ján Koščo committed
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
  'gnsync'
  'user'
)

_arguments '*:: :->command'

if (( CURRENT == 1 )); then
  _describe -t commands "geeknote command" _1st_arguments
  return
fi

local -a _command_args
case "$words[1]" in
  user)
    _command_args=(
      '(--full)--full' \
    )
    ;;
  logout)
    _command_args=(
      '(--force)--force' \
    )
    ;;
  settings)
    _command_args=(
      '(--editor)--editor' \
    )
    ;;
  create)
    _command_args=(
      '(-t|--title)'{-t,--title}'[note title]' \
      '(-c|--content)'{-c,--content}'[note content]' \
      '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
      '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
    )
    ;;
  edit)
    _command_args=(
      '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
      '(-t|--title)'{-t,--title}'[note title]' \
      '(-c|--content)'{-c,--content}'[note content]' \
      '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
      '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
    )
    ;;
  remove)
    _command_args=(
      '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
      '(--force)--force' \
    )
    ;;
  show)
    _command_args=(
      '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
    )
    ;;
  find)
    _command_args=(
      '(-s|--search)'{-s,--search}'[text to search]' \
      '(-tg|--tags)'{-tg,--tags}'[notes with which tag/tags to search]' \
      '(-nb|--notebook)'{-nb,--notebook}'[in which notebook search the note]' \
      '(-d|--date)'{-d,--date}'[date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy]' \
      '(-cn|--count)'{-cn,--count}'[how many notes show in the result list]' \
Ján Koščo's avatar
Ján Koščo committed
93
      '(-uo|--url-only)'{-uo,--url-only}'[add direct url of each note in results to Evernote web-version]' \
Ján Koščo's avatar
Ján Koščo committed
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
      '(-ee|--exact-entry)'{-ee,--exact-entry}'[search for exact entry of the request]' \
      '(-cs|--content-search)'{-cs,--content-search}'[search by content, not by title]' \
    )
    ;;
  notebook-create)
    _command_args=(
      '(-t|--title)'{-t,--title}'[notebook title]' \
    )
    ;;
  notebook-edit)
    _command_args=(
      '(-nb|--notebook)'{-nb,--notebook}'[name of notebook to rename]' \
      '(-t|--title)'{-t,--title}'[new notebook title]' \
    )
    ;;
  notebook-remove)
    _command_args=(
      '(-nb|--notebook)'{-nb,--notebook}'[name of notebook to remove]' \
      '(--force)--force' \
    )
    ;;
  tag-create)
    _command_args=(
      '(-t|--title)'{-t,--title}'[title of tag]' \
    )
    ;;
Ján Koščo's avatar
Ján Koščo committed
120
  tag-edit)
Ján Koščo's avatar
Ján Koščo committed
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
    _command_args=(
      '(-tgn|--tagname)'{-tgn,--tagname}'[tag to edit]' \
      '(-t|--title)'{-t,--title}'[new tag name]' \
    )
    ;;
  tag-remove)
    _command_args=(
      '(-tgn|--tagname)'{-tgn,--tagname}'[tag to remove]' \
      '(--force)--force' \
    )
    ;;
  esac

_arguments \
  $_command_args \
  &&  return 0