#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 "$@"