_geeknote 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. 'tag-remove'
  29. 'gnsync'
  30. 'user'
  31. )
  32. _arguments '*:: :->command'
  33. if (( CURRENT == 1 )); then
  34. _describe -t commands "geeknote command" _1st_arguments
  35. return
  36. fi
  37. local -a _command_args
  38. case "$words[1]" in
  39. user)
  40. _command_args=(
  41. '(--full)--full' \
  42. )
  43. ;;
  44. logout)
  45. _command_args=(
  46. '(--force)--force' \
  47. )
  48. ;;
  49. settings)
  50. _command_args=(
  51. '(--editor)--editor' \
  52. )
  53. ;;
  54. create)
  55. _command_args=(
  56. '(-t|--title)'{-t,--title}'[note title]' \
  57. '(-c|--content)'{-c,--content}'[note content]' \
  58. '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
  59. '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
  60. )
  61. ;;
  62. edit)
  63. _command_args=(
  64. '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
  65. '(-t|--title)'{-t,--title}'[note title]' \
  66. '(-c|--content)'{-c,--content}'[note content]' \
  67. '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
  68. '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
  69. )
  70. ;;
  71. remove)
  72. _command_args=(
  73. '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
  74. '(--force)--force' \
  75. )
  76. ;;
  77. show)
  78. _command_args=(
  79. '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
  80. )
  81. ;;
  82. find)
  83. _command_args=(
  84. '(-s|--search)'{-s,--search}'[text to search]' \
  85. '(-tg|--tags)'{-tg,--tags}'[notes with which tag/tags to search]' \
  86. '(-nb|--notebook)'{-nb,--notebook}'[in which notebook search the note]' \
  87. '(-d|--date)'{-d,--date}'[date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy]' \
  88. '(-cn|--count)'{-cn,--count}'[how many notes show in the result list]' \
  89. '(-uo|--url-only)'{-uo,--url-only}'[add direct url of each note in results to Evernote web-version]' \
  90. '(-ee|--exact-entry)'{-ee,--exact-entry}'[search for exact entry of the request]' \
  91. '(-cs|--content-search)'{-cs,--content-search}'[search by content, not by title]' \
  92. )
  93. ;;
  94. notebook-create)
  95. _command_args=(
  96. '(-t|--title)'{-t,--title}'[notebook title]' \
  97. )
  98. ;;
  99. notebook-edit)
  100. _command_args=(
  101. '(-nb|--notebook)'{-nb,--notebook}'[name of notebook to rename]' \
  102. '(-t|--title)'{-t,--title}'[new notebook title]' \
  103. )
  104. ;;
  105. notebook-remove)
  106. _command_args=(
  107. '(-nb|--notebook)'{-nb,--notebook}'[name of notebook to remove]' \
  108. '(--force)--force' \
  109. )
  110. ;;
  111. tag-create)
  112. _command_args=(
  113. '(-t|--title)'{-t,--title}'[title of tag]' \
  114. )
  115. ;;
  116. tag-edit)
  117. _command_args=(
  118. '(-tgn|--tagname)'{-tgn,--tagname}'[tag to edit]' \
  119. '(-t|--title)'{-t,--title}'[new tag name]' \
  120. )
  121. ;;
  122. tag-remove)
  123. _command_args=(
  124. '(-tgn|--tagname)'{-tgn,--tagname}'[tag to remove]' \
  125. '(--force)--force' \
  126. )
  127. ;;
  128. esac
  129. _arguments \
  130. $_command_args \
  131. && return 0