mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-19 20:29:45 +01:00
geeknote: update completion (#4986)
Fixes Completion only working for first parameter
This commit is contained in:
parent
08b04f5df2
commit
3e16d64347
2 changed files with 156 additions and 128 deletions
|
@ -1,12 +1,19 @@
|
||||||
## ZSH-Geeknote
|
ZSH-Geeknote
|
||||||
|
============
|
||||||
|
|
||||||
[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for oh-my-zsh.
|
[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for oh-my-zsh.
|
||||||
|
|
||||||
Plugins provides:
|
Plugins provides:
|
||||||
|
|
||||||
- auto completion of commands and their options
|
* auto completion of commands and their options
|
||||||
- alias `gn`
|
* alias `gn`
|
||||||
|
|
||||||
You can find information how to install Geeknote and it's available commands on the [project website](http://www.geeknote.me/).
|
## Installation
|
||||||
|
|
||||||
Maintainer : Ján Koščo ([@s7anley](https://twitter.com/s7anley))
|
### oh-my-zsh
|
||||||
|
This plugin is already bundled in oh-my-zsh. To enable just configure plugin definition
|
||||||
|
|
||||||
|
plugins=( ... geeknote ...)
|
||||||
|
|
||||||
|
### Antigen
|
||||||
|
Use [Antigen's](https://github.com/zsh-users/antigen) bundle command to install by adding `antigen bundle s7anley/zsh-geeknote` to your `.zshrc` along with your other plugins.
|
||||||
|
|
|
@ -1,136 +1,157 @@
|
||||||
#compdef geeknote
|
#compdef geeknote
|
||||||
# --------------- ------------------------------------------------------------
|
|
||||||
# Name : _geeknote
|
# Geeknote Autocomplete plugin for Zsh
|
||||||
# Synopsis : zsh completion for geeknote
|
# Requires: Geeknote installed
|
||||||
# Author : Ján Koščo <3k.stanley@gmail.com>
|
# Author : Ján Koščo (@s7anley)
|
||||||
# HomePage : http://www.geeknote.me
|
|
||||||
# Version : 0.1
|
__login() {
|
||||||
# Tag : [ shell, zsh, completion, evernote ]
|
# no arguments
|
||||||
# Copyright : © 2014 by Ján Koščo,
|
}
|
||||||
# Released under current GPL license.
|
|
||||||
# --------------- ------------------------------------------------------------
|
__logout() {
|
||||||
|
_arguments \
|
||||||
|
'--force[Do not ask about logging out.]'
|
||||||
|
}
|
||||||
|
|
||||||
|
__settings() {
|
||||||
|
_arguments \
|
||||||
|
"--editor+[Set the editor, which use to edit and create notes.]::"
|
||||||
|
}
|
||||||
|
|
||||||
|
__create() {
|
||||||
|
_arguments \
|
||||||
|
'--title+[The note title.]::' \
|
||||||
|
'--content+[The note content.]::' \
|
||||||
|
'--tags+[One tag or the list of tags which will be added to the note.]::' \
|
||||||
|
'--notebook+[Set the notebook where to save note.]::' \
|
||||||
|
'--resource+[Add a resource to the note.]::'
|
||||||
|
}
|
||||||
|
|
||||||
|
__edit() {
|
||||||
|
_arguments \
|
||||||
|
'--note+[The name or ID from the previous search of a note to edit.]::' \
|
||||||
|
'--title+[Set new title of the note.]::' \
|
||||||
|
'--content+[Set new content of the note.]::' \
|
||||||
|
'--tags+[Set new list o tags for the note.]::' \
|
||||||
|
'--notebook+[Assign new notebook for the note.]::' \
|
||||||
|
'--resource+[Add a resource to the note.]::'
|
||||||
|
}
|
||||||
|
|
||||||
|
__find() {
|
||||||
|
_arguments \
|
||||||
|
'--search+[Text to search.]::' \
|
||||||
|
'--tags+[Notes with which tag/tags to search.]::' \
|
||||||
|
'--notebook+[In which notebook search the note.]::' \
|
||||||
|
'--date+[Set date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy.]::' \
|
||||||
|
'--count+[How many notes show in the result list.]::' \
|
||||||
|
'--with-url[Add direct url of each note in results to Evernote web-version.]' \
|
||||||
|
'--content-search[Search by content, not by title.]' \
|
||||||
|
'--exact-entry[Search for exact entry of the request.]'
|
||||||
|
}
|
||||||
|
|
||||||
|
__show() {
|
||||||
|
_arguments \
|
||||||
|
'--note+[The name or ID from the previous search of a note to show.]::' \
|
||||||
|
'--raw[Show the raw note body.]'
|
||||||
|
}
|
||||||
|
|
||||||
|
__remove() {
|
||||||
|
_arguments \
|
||||||
|
'--note+[The name or ID from the previous search of a note to remove.]::' \
|
||||||
|
'--force[Do not ask about removing.]'
|
||||||
|
}
|
||||||
|
|
||||||
|
__notebook-list() {
|
||||||
|
# no arguments
|
||||||
|
}
|
||||||
|
|
||||||
|
__notebook-create() {
|
||||||
|
_arguments \
|
||||||
|
'--title+[Set the title of new notebook.]::'
|
||||||
|
}
|
||||||
|
|
||||||
|
__notebook-edit() {
|
||||||
|
_arguments \
|
||||||
|
'--title+[Set the title of new notebook.]::' \
|
||||||
|
'--notebook+[The name of a notebook to rename.]::'
|
||||||
|
}
|
||||||
|
|
||||||
|
__tag-list() {
|
||||||
|
# no arguments
|
||||||
|
}
|
||||||
|
|
||||||
|
__tag-create() {
|
||||||
|
_arguments \
|
||||||
|
'--title+[Set the title of new tag.]::'
|
||||||
|
}
|
||||||
|
|
||||||
|
__tag-edit() {
|
||||||
|
_arguments \
|
||||||
|
'--tagname+[The name of a tag to rename.]::' \
|
||||||
|
'--title+[Set the new name of tag.]::'
|
||||||
|
}
|
||||||
|
|
||||||
|
__user() {
|
||||||
|
_arguments \
|
||||||
|
'--full[Show full information.]'
|
||||||
|
}
|
||||||
|
|
||||||
local -a _1st_arguments
|
local -a _1st_arguments
|
||||||
_1st_arguments=(
|
_1st_arguments=(
|
||||||
'login'
|
'login':'Authorize in Evernote.'
|
||||||
'logout'
|
'logout':'Logout from Evernote.'
|
||||||
'settings'
|
'settings':'Show and edit current settings.'
|
||||||
'create'
|
'create':'Create note in Evernote.'
|
||||||
'edit'
|
'edit':'Edit note in Evernote.'
|
||||||
'find'
|
'find':'Search notes in Evernote.'
|
||||||
'show'
|
'show':'Output note in the terminal.'
|
||||||
'remove'
|
'remove':'Remove note from Evernote.'
|
||||||
'notebook-list'
|
'notebook-list':'Show the list of existing notebooks in your Evernote.'
|
||||||
'notebook-create'
|
'notebook-create':'Create new notebook.'
|
||||||
'notebook-edit'
|
'notebook-edit':'Edit/rename notebook.'
|
||||||
'tag-list'
|
'tag-list':'Show the list of existing tags in your Evernote.'
|
||||||
'tag-create'
|
'tag-create':'Create new tag.'
|
||||||
'tag-edit'
|
'tag-edit':'Edit/rename tag.'
|
||||||
'tag-remove'
|
'user':'Show information about active user.'
|
||||||
'gnsync'
|
|
||||||
'user'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
_arguments '*:: :->command'
|
_arguments '*:: :->command'
|
||||||
|
|
||||||
if (( CURRENT == 1 )); then
|
if (( CURRENT == 1 )); then
|
||||||
_describe -t commands "geeknote command" _1st_arguments
|
_describe -t commands "geeknote command" _1st_arguments
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local -a _command_args
|
local -a _command_args
|
||||||
case "$words[1]" in
|
case "$words[1]" in
|
||||||
user)
|
login)
|
||||||
_command_args=(
|
__login ;;
|
||||||
'(--full)--full' \
|
logout)
|
||||||
)
|
__logout ;;
|
||||||
;;
|
settings)
|
||||||
logout)
|
__settings ;;
|
||||||
_command_args=(
|
create)
|
||||||
'(--force)--force' \
|
__create ;;
|
||||||
)
|
edit)
|
||||||
;;
|
__edit ;;
|
||||||
settings)
|
find)
|
||||||
_command_args=(
|
__find ;;
|
||||||
'(--editor)--editor' \
|
show)
|
||||||
)
|
__show ;;
|
||||||
;;
|
remove)
|
||||||
create)
|
__remove ;;
|
||||||
_command_args=(
|
notebook-list)
|
||||||
'(-t|--title)'{-t,--title}'[note title]' \
|
__notebook-list ;;
|
||||||
'(-c|--content)'{-c,--content}'[note content]' \
|
notebook-create)
|
||||||
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
|
__notebook-create ;;
|
||||||
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
|
notebook-edit)
|
||||||
)
|
__notebook-edit ;;
|
||||||
;;
|
tag-list)
|
||||||
edit)
|
__tag-list ;;
|
||||||
_command_args=(
|
tag-create)
|
||||||
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
|
__tag-create ;;
|
||||||
'(-t|--title)'{-t,--title}'[note title]' \
|
tag-edit)
|
||||||
'(-c|--content)'{-c,--content}'[note content]' \
|
__tag-edit ;;
|
||||||
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
|
user)
|
||||||
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
|
__user ;;
|
||||||
)
|
esac
|
||||||
;;
|
|
||||||
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]' \
|
|
||||||
'(-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]' \
|
|
||||||
)
|
|
||||||
;;
|
|
||||||
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-edit)
|
|
||||||
_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
|
|
||||||
|
|
Loading…
Reference in a new issue