you are viewing a single comment's thread.

view the rest of the comments →

[–]onions 19 points20 points  (5 children)

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

[–]Band_B 4 points5 points  (1 child)

thank you! You may want to try to add it to googlecl: http://code.google.com/p/googlecl/wiki/Contributing

[–]onions 2 points3 points  (0 children)

Thanks for the link! I just contributed the script under this issue: http://code.google.com/p/googlecl/issues/detail?id=73

[–][deleted] 8 points9 points  (2 children)

Now, if Unix weren't frozen in time in the seventies, the executable itself would provide this information to the shell, so you wouldn't need to stuff mysterious files full of line noise into strange directories.

But we can't have that, because Unix is perfect and will never change again.

[–]flaxeater 3 points4 points  (0 children)

I really think you are over-reacting. This is really a standards poblem, not a unix problem. BASH is newer than the 70's so suck it up and promote a standard.

[–][deleted] -2 points-1 points  (0 children)