diff options
| author | Paul Buetow <paul@buetow.org> | 2015-01-02 14:00:56 +0100 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2015-01-02 14:00:56 +0100 |
| commit | 4f27f3ea59baa6cfca0ac1df96b1dfedbd83706c (patch) | |
| tree | 79754e3c49216f80cb3ad5579851fca0bf1a31c9 /contrib | |
initial
Diffstat (limited to 'contrib')
| -rw-r--r-- | contrib/zsh/_mon.zsh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/contrib/zsh/_mon.zsh b/contrib/zsh/_mon.zsh new file mode 100644 index 0000000..3770c60 --- /dev/null +++ b/contrib/zsh/_mon.zsh @@ -0,0 +1,46 @@ +#compdef m mon + +get_options() { + elements=`${words[1,$[${CURRENT}-1]]} --dry --nocolor 2>&1` + if [ $? -ne 0 ]; then + elements="" + fi + + echo `echo $elements | tr '\n' ' '` +} + +_mon() { + local curcontext="$curcontext" state line + typeset -A opt_args + + case $words[2] in + getfmt) + if [ $CURRENT -eq 5 ]; then + compadd "$@" "where" + return + fi + ;; + post|put) + if [ $CURRENT -eq 4 ]; then + compadd "$@" "from" + return + fi + ;; + delete|edit|get|insert|update|view) + if [ $CURRENT -eq 4 ]; then + compadd "$@" "where" + return + fi + ;; + esac + + VALUES="`get_options`" + if [ -z "${VALUES}" ]; then + _files + else + ARGS=(${=VALUES}) + compadd "$@" ${ARGS[@]} + fi +} + +_mon "$@" |
