_geeknote 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #compdef geeknote
  2. # --------------- ------------------------------------------------------------
  3. # Name : _geeknote
  4. # Synopsis : zsh completion for geeknote
  5. # Author : Ján Koščo <3k.stanley@gmail.com>
  6. # HomePage : http://www.geeknote.me
  7. # Version : 0.1
  8. # Tag : [ shell, zsh, completion, evernote ]
  9. # Copyright : © 2014 by Ján Koščo,
  10. # Released under current GPL license.
  11. # --------------- ------------------------------------------------------------
  12. local -a _1st_arguments
  13. _1st_arguments=(
  14. 'login'
  15. 'logout'
  16. 'settings'
  17. 'create'
  18. 'edit'
  19. 'find'
  20. 'show'
  21. 'remove'
  22. 'notebook-list'
  23. 'notebook-create'
  24. 'notebook-edit'
  25. 'tag-list'
  26. 'tag-create'
  27. 'tag-edit'
  28. 'gnsync'
  29. 'user'
  30. )
  31. _arguments '*:: :->command'
  32. if (( CURRENT == 1 )); then
  33. _describe -t commands "geeknote command" _1st_arguments
  34. return
  35. fi
  36. local -a _command_args
  37. case "$words[1]" in
  38. user)
  39. _command_args=(
  40. '(--full)--full' \
  41. )
  42. ;;
  43. logout)
  44. _command_args=(
  45. '(--force)--force' \
  46. )
  47. ;;
  48. settings)
  49. _command_args=(
  50. '(--editor)--editor' \
  51. )
  52. ;;
  53. create)
  54. _command_args=(
  55. '(-t|--title)'{-t,--title}'[note title]' \
  56. '(-c|--content)'{-c,--content}'[note content]' \
  57. '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
  58. '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
  59. )
  60. ;;
  61. edit)
  62. _command_args=(
  63. '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
  64. '(-t|--title)'{-t,--title}'[note title]' \
  65. '(-c|--content)'{-c,--content}'[note content]' \
  66. '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
  67. '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
  68. )
  69. ;;
  70. remove)
  71. _command_args=(
  72. '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
  73. '(--force)--force' \
  74. )
  75. ;;
  76. show)
  77. _command_args=(
  78. '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
  79. )
  80. ;;
  81. find)
  82. _command_args=(
  83. '(-s|--search)'{-s,--search}'[text to search]' \
  84. '(-tg|--tags)'{-tg,--tags}'[notes with which tag/tags to search]' \
  85. '(-nb|--notebook)'{-nb,--notebook}'[in which notebook search the note]' \
  86. '(-d|--date)'{-d,--date}'[date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy]' \
  87. '(-cn|--count)'{-cn,--count}'[how many notes show in the result list]' \
  88. '(-wu|--with-url)'{-wu,--with-url}'[add direct url of each note in results to Evernote web-version]' \
  89. '(-ee|--exact-entry)'{-ee,--exact-entry}'[search for exact entry of the request]' \
  90. '(-cs|--content-search)'{-cs,--content-search}'[search by content, not by title]' \
  91. )
  92. ;;
  93. notebook-create)
  94. _command_args=(
  95. '(-t|--title)'{-t,--title}'[notebook title]' \
  96. )
  97. ;;
  98. notebook-edit)
  99. _command_args=(
  100. '(-nb|--notebook)'{-nb,--notebook}'[name of notebook to rename]' \
  101. '(-t|--title)'{-t,--title}'[new notebook title]' \
  102. )
  103. ;;
  104. notebook-remove)
  105. _command_args=(
  106. '(-nb|--notebook)'{-nb,--notebook}'[name of notebook to remove]' \
  107. '(--force)--force' \
  108. )
  109. ;;
  110. tag-create)
  111. _command_args=(
  112. '(-t|--title)'{-t,--title}'[title of tag]' \
  113. )
  114. ;;
  115. tag-create)
  116. _command_args=(
  117. '(-tgn|--tagname)'{-tgn,--tagname}'[tag to edit]' \
  118. '(-t|--title)'{-t,--title}'[new tag name]' \
  119. )
  120. ;;
  121. tag-remove)
  122. _command_args=(
  123. '(-tgn|--tagname)'{-tgn,--tagname}'[tag to remove]' \
  124. '(--force)--force' \
  125. )
  126. ;;
  127. esac
  128. _arguments \
  129. $_command_args \
  130. && return 0