Adds basic completion for googlecl

This commit is contained in:
Ben O'Hara 2012-07-09 16:46:14 +10:00 committed by Julien Nicoulaud
parent 520443eb3b
commit 365eb78252
1 changed files with 64 additions and 0 deletions

64
_google Normal file
View File

@ -0,0 +1,64 @@
#compdef google
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for googlecl (https://code.google.com/p/googlecl/)
#
# Source: https://raw.github.com/dadrc/zsh-cfg/master/completions/_google
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * dadrc (https://github.com/dadrc)
# * Ben O'Hara (https://github.com/benohara)
#
# ------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# ------------------------------------------------------------------------------
_google() {
# init variables
local curcontext="$curcontext" state line
typeset -A opt_args
# init state
_arguments \
'1: :->service'\
'2: :->task'
case $state in
service)
_arguments '1:service:(picasa blogger youtube docs contacts calendar finance)'
;;
*)
case $words[2] in
picasa)
compadd "$@" get create list list-albums tag post delete
;;
blogger)
compadd "$@" post tag list delete
;;
youtube)
compadd "$@" post tag list delete
;;
docs)
compadd "$@" edit delete list upload get
;;
contacts)
compadd "$@" list list-groups add add-groups delete-groups delete
;;
calendar)
compadd "$@" add list today delete
;;
finance)
compadd "$@" list-txn delete-pos create-pos delete-txn create create-txn list list-pos delete
;;
*)
esac
esac
}
_google "$@"