Created
June 19, 2010 16:51
-
-
Save zaach/445056 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here's a quick and dirty bash_completion script. Paste this in a file named "google" in your /etc/bash_completion.d/ directory: | |
_google() | |
{ | |
local cur prev commands options | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
commands="help picasa blogger youtube docs contacts calendar" | |
if [[ $COMP_CWORD -eq 1 ]] ; then | |
COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) | |
else | |
case "${prev}" in | |
help) | |
options='picasa blogger youtube docs contacts calendar' | |
;; | |
picasa) | |
options='get create list list-albums tag post delete' | |
;; | |
blogger) | |
options='post tag list delete' | |
;; | |
youtube) | |
options='post tag list delete' | |
;; | |
docs) | |
options='edit delete list upload get' | |
;; | |
contacts) | |
options='add list delete' | |
;; | |
calendar) | |
options='add list today delete' | |
;; | |
*) | |
COMPREPLY=( $(compgen -f ${cur}) ) | |
return 0 | |
;; | |
esac | |
COMPREPLY=( $(compgen -W "${options}" -- ${cur}) ) | |
fi | |
return 0 | |
} | |
complete -F _google google |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment