Playing with Google command line tools on MacOSX

With the release of GoogleCL, the command line tool for the Google data APIs, Google reconfirmed if that was needed that it’s a geeky company (I mean you would not expect something like this form M$, right?) and they like command line tools. They released some basic command line tools for calendar, contacts, docs, picassa, blogger and youtube. Of course, coming from google the tools are written in their preferred language, python.

~$ google
> help
Welcome to the Google CL tool!
Commands are broken into several parts: service, task, options, and arguments.
For example, in the command
"> picasa post --title "My Cat Photos" photos/cats/*"
the service is "picasa", the task is "post", the single option is a name of "My Cat Photos", and the argument is the path to the photos.
The available services are 'picasa', 'blogger', 'youtube', 'docs', 'contacts', 'calendar'
Enter "> help <service>" for more information on a service.
Or, just "quit" to quit.

There is a deb package available for ubuntu/debian_lenny, and source package for other distributions. The only requirement is Python 2.5 or 2.6 and the gdata python client library. You can install the package manually just as any python package:

sudo python setup.py install

For MacOSX if you are running MacPorts, it is easier to install gdata and googlecl from ports (also easier to keep them updated in the future). The install should be as simple as:

sudo port install googlecl

in case you don’t see it in your source list, just run a port selfupdate:

sudo port selfupdate

Usage

There are several good examples on the project page, but basically each service has the ability to list, add and delete. Here are some simple examples for calendar:

List events for today only:

google calendar today

and the same with some nicer formatting:

google calendar today when,title --delimiter " | "
Jun 21 09:30 - Jun 21 10:00 | Very important call

we can also do a query after some strinng:

google calendar list --query velocity

and adding a new event:

google calendar add "Very important call today at 10am"

or delete an event:

google calendar delete --title "Meeting with John"

Calendar is definitely the most important one for me, but contacts and docs are also great to be controlled from the command line. I would like to see the same for Gmail in the future ;).

comments powered by Disqus