From e585904e1040acedd2fc3092ef99a3a9aaa0d661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Ko=C5=A1=C4=8Do?= <3k.stanley@gmail.com> Date: Thu, 2 Jan 2014 00:35:19 +0100 Subject: [PATCH 1/4] Geeknote autocomplete and alias --- plugins/geeknote/_geeknote | 135 +++++++++++++++++++++++++++ plugins/geeknote/geeknote.plugin.zsh | 2 + 2 files changed, 137 insertions(+) create mode 100644 plugins/geeknote/_geeknote create mode 100644 plugins/geeknote/geeknote.plugin.zsh diff --git a/plugins/geeknote/_geeknote b/plugins/geeknote/_geeknote new file mode 100644 index 00000000..4d5339f2 --- /dev/null +++ b/plugins/geeknote/_geeknote @@ -0,0 +1,135 @@ +#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' + '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]' \ + '(-wu|--with-url)'{-wu,--with-url}'[add direct url of each note in results to Evernote web-version]' \ + '(-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]' \ + ) + ;; + tag-create) + _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 diff --git a/plugins/geeknote/geeknote.plugin.zsh b/plugins/geeknote/geeknote.plugin.zsh new file mode 100644 index 00000000..8126d26b --- /dev/null +++ b/plugins/geeknote/geeknote.plugin.zsh @@ -0,0 +1,2 @@ +#Alias +alias gn='geeknote' From aac85f095e302c72b109801063da8d8c4d13af3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Ko=C5=A1=C4=8Do?= <3k.stanley@gmail.com> Date: Fri, 22 Aug 2014 23:11:52 +0200 Subject: [PATCH 2/4] Proper handling of tags --- plugins/geeknote/_geeknote | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/geeknote/_geeknote b/plugins/geeknote/_geeknote index 4d5339f2..2d1188e8 100644 --- a/plugins/geeknote/_geeknote +++ b/plugins/geeknote/_geeknote @@ -26,6 +26,7 @@ _1st_arguments=( 'tag-list' 'tag-create' 'tag-edit' + 'tag-remove' 'gnsync' 'user' ) @@ -116,7 +117,7 @@ case "$words[1]" in '(-t|--title)'{-t,--title}'[title of tag]' \ ) ;; - tag-create) + tag-edit) _command_args=( '(-tgn|--tagname)'{-tgn,--tagname}'[tag to edit]' \ '(-t|--title)'{-t,--title}'[new tag name]' \ From b3d27be944c36b15900c9e11a6d1495096d43ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Ko=C5=A1=C4=8Do?= <3k.stanley@gmail.com> Date: Fri, 22 Aug 2014 23:12:02 +0200 Subject: [PATCH 3/4] Update seach parameter --- plugins/geeknote/_geeknote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/geeknote/_geeknote b/plugins/geeknote/_geeknote index 2d1188e8..cf1a187d 100644 --- a/plugins/geeknote/_geeknote +++ b/plugins/geeknote/_geeknote @@ -90,7 +90,7 @@ case "$words[1]" in '(-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]' \ - '(-wu|--with-url)'{-wu,--with-url}'[add direct url of each note in results to Evernote web-version]' \ + '(-uo|--url-only)'{-uo,--url-only}'[add direct url of each note in results to Evernote web-version]' \ '(-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]' \ ) From a6ab704482f3f092b907a306eec2b3b8d908a5da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Ko=C5=A1=C4=8Do?= <3k.stanley@gmail.com> Date: Mon, 1 Sep 2014 20:08:29 +0200 Subject: [PATCH 4/4] Added a short description of the plugin --- plugins/geeknote/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plugins/geeknote/README.md diff --git a/plugins/geeknote/README.md b/plugins/geeknote/README.md new file mode 100644 index 00000000..a6b50e27 --- /dev/null +++ b/plugins/geeknote/README.md @@ -0,0 +1,12 @@ +## ZSH-Geeknote + +[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for [oh-my-zsh framework](http://github.com/robbyrussell/oh-my-zsh). + +Plugins provides: + +- auto completion of commands and their options +- alias `gn` + +You can find information how to install Geeknote and it's available commands on the [project website](http://www.geeknote.me/). + +Maintainer : Ján Koščo ([@s7anley](https://twitter.com/s7anley))