_geeknote 3.9 KB

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