52 comments

[ 4.4 ms ] story [ 120 ms ] thread
This is a nice little utility. It'd be good if it supported more google services (reader, gmail?) but hopefully they'll add to it as time goes on.
It'd be nice, but I wouldn't count on it happening too soon: the necessary APIs don't seem to exist.

It's based on the gdata-python-client library (http://code.google.com/p/gdata-python-client/) for accessing Google Data APIs, and the complete list of them (http://code.google.com/apis/gdata/docs/directory.html) doesn't include Gmail/reader. It does include a bunch of things that this doesn't support yet though.

Yea, I saw that too and thought it was a bit short-sighted to base it on that library. The calendar command is nice if you're integrating with something that doesn't play nicely with .ics, but other than that this is pretty ho-hum at the moment.
Apologies for a clumsy touch-screen downvote.
I've put a bit of work into a python library for Google Reader: http://github.com/askedrelic/libgreader

There is another Perl library on github that supports pretty much everything Reader does.

The Reader API has unofficially existed for awhile, but they don't seem to mind you using it. They just added OAuth support a few months ago as well.

That's cute, but Goosh (www.goosh.org) is better. I'm not affiliated with goosh, just a fan. Check it out!
Goosh is neat, but isn't it actually browser-oriented (i.e. doesn't actually work in your command line)? Also, they cover completely different services (AFAIK). For example, Goosh does search and gmail. GoogleCL does picasa, blogger, post youtube videos, docs, contacts, and calendar.
I use this to check my gmail from the command line (they don't include gmail in the examples). Ugly but fun:

    alias gm1='curl -u USERNAME:PASSWORD --silent "https://mail.google.com/mail/feed/atom" |
    tr -d '\''\n'\'' |
    awk -F '\''<entry>'\'' '\''{for (i=2; i<=NF; i++) {print $i}}'\'' |
    sed -n "s/<title>\(.*\)<\/title.*name>\(.*\)<\/name>.*/\2 - \1/p" |
    sed '\''s/&lt;/>/g'\'' '
EDIT and send mail by setting the headers (including MAIL FROM:<USERNAME@gmail.com>) and body (using uuencode for attachments) in email, and then:

    echo "$email" | netcat ISPs_MAILSERVER 25
Interesting and fun, but it doesn't spit out any info for me, despite the atom having an email appearing in it.

I'll poke into it when I get more time. I quite like the idea :)

I use wget for the same. I usually call it from gnu screen, to update the status line with the no. of unread mails

  unread="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \
  https://${gmail_login}:${gmail_password}@mail.google.com/mail/feed/atom |
  sed -n "s/<fullcount>\(.*\)<\/fullcount>/\1/p")"

  unread=${unread:-0}

  echo $unread
And also worth checking out http://groups.google.com/group/emacs-g-client?pli=1 if you are into emacs side of the things.
Quite cool but there isn't there just one rather obvious google service that is missing. Nudge nudge, wink wink? Wouldn't it be handy to run an internet wide grep with all the various search arguments and a nice filterable output?
Google Grep would be awesome, but Google Find would be more useful, especially if were augmented with a rich and extensible set of semantic switches.

   google find .org -type domain -owner "Gawker Media" -pagerank ">4" > ndenton.orgs.list
Would, for instance, find all .org domains registered by gawker media with a pagerank greater than 4.
Not quite a command line tool but you can try 80legs API (http://80legs.com/) for that sort of thing.
Makes me wonder how many other web services could offer useful amounts of their (usually unintuitive (for non-web programmers)) API's functionality with a simple, unixy, command-line tool. This is going to save fans of scripting languages a whole lot of doc-crawling.
I have a feeling that normal people don't dream of having "simple" and "unixy" in the same sentence.
I have a feeling that normal people don't care about a website's API unless they also care (or at least use) command line tools.
I really love how the sub-command names work with the script name to mirror the full names of the Google products. Google's "Google Foo" naming scheme was mandated from the top and was a good call for sooo many reasons (legal, marketing, etc.) which now includes "makes for an awesome command line tool".
Clean living and good apis in your products makes writing awesome little apps like this not to hard... which makes life good for all of us.

This has me pretty psyched, honestly. The scripting possibilities are tantalizing.

One big cost of poor architecture and design is that you miss out on a lot of serendipity. When every new use case comes at the cost of a long, hard slog uphill over a mountain of design and implementation defects you choose your destinations carefully, so you miss out on a lot of potential wins (both big and small) just because you don't have the data to justify the changes.
Quick recipe to make a blog post from the command line.

    $ cat - > newblogpost.txt
    type in what you have to say
    ^D
Use pandoc to convert the text bits to html bits

    $ pandoc newblogpost.txt -f markdown -t html -o newblogpost.html --no-wrap
Upload the transformed bits to blogger using the Google Command Line tool.

    $ google blogger post --title "Hello, world!" newblogpost.html
And you are done!

You can see the result here: http://btbytes.blogspot.com/2010/06/how-to-make-quick-blogpo...

Just a heads-up: I think you can leave off the dash like so:

    $ cat > newblogpost.txt
Yeah, about the same as sending an email to Posterous
This is wonderful! At what point will it be ported to OSX?
It will work on any unix compatible system, which basically means Macs and Linux.

EDIT: I realized it is python based. So it will work on any system.

Update your homebrew and: 'brew install googlecl'
Thanks, it works like a charm

Now I can easily hook up my scanner to my Google Docs

outch, I think I'll soon be ready to say bye bye to my own little todo application in command line. However, there are still some details that I will miss by switching to google calendar :(
(comment deleted)

    $ google docs edit --title "Shopping list" --editor vim
You had me at hello. Too pretty.

Also, and slightly off-topic: I cannot say how much I love Homebrew + Github. I was halfway into writing a new formula for this, when I decided to check. Sure enough, there's already a formula to install. Actually, I think two people already submitted formulas. In any case, if you use Homebrew, you can install it now.

    No modifications to file, not uploading.
Not so happy with gvim. Can't use anything that returns immediately or else the code doesn't see what you're doing.
You should be able to use "gvim -f" as your editor and it won't detach itself from the terminal.
Sweet! I had to wrap it in a script to get it to work, but it's rolling now.

Thanks.

Care to share the script? I haven't been able to make it work with mvim yet. Thanks.
This is on my Ubuntu box

    #!/usr/bin/env ruby
    `gvim -f "#{ARGV.join( ' ' )}"`

Haven't installed google command line on the mac yet
Thanks for this. I ended up coming up with this as a shell script on OSX:

    #!/bin/sh
    mvim -f -c"au VimLeave * !open -a Terminal" $@
The subcommand makes sure that when MacVim exits, focus returns right to the terminal I was in before MacVim opened.
If you're using Vimperator and Firefox, pressing Ctrl-i will allow you to edit any text box in vim.
A quick update here: the googlecl package has been removed from Homebrew. The recommendation is now to install it via pip (which is available from Homebrew). Just in case someone sees this and wonders.
Thanks! I was scratching my head there for a minute.

EDIT: The pypi package is "googlecl"

I just thought of another use for this. I've been using takspaper.vim and git to manage a todo list with TaskPaper-like syntax, but without the overhead of an application devoted just to a todo list. (I feel about programs the way Alton Brown does about cooking tools: use as few unitaskers as possible.)

This will make that a lot, lot easier and more automatic.

If you use Vim, see here for the taskpaper.vim syntax script: http://www.vim.org/scripts/script.php?script_id=2027

should be named GoogleCLI for Google Command Line Interface.

CL is reserved for OpenCL, the Open Computing Language.

It was kinda used by OpenCL, to actually "reserve" something takes a lot more work. And even then I would suppose that the abbrev CL was reserved by Common Lisp during the last 25 years.
To add to that list: Changelist. Chile TLD. Microsoft's C compiler (which is roughly as old as Common Lisp). IBM's Control Language. And probably a whole bunch of other things.

And this isn't a CLI, of course. In this case, that would be the shell itself.

The Google Command Line Tool is interesting but it's missing the search (is that intentional from Google? I don't know). I made a quick and dirty one liner replace foo by your search query:

  curl -s "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&start=0&rsz=large&q=foo" | sed -e 's/[{}]/''/g' | awk '{n=split($0,s,","); for (i=1; i<=n; i++) print s[i]}' | grep -E "("url"|"titleNoFormatting")" | sed -e s/\"//g | cut -d: -f2- 
My notes about : http://www.foo.be/cgi-bin/wiki.pl/2010-06-19_Searching_Googl...
have to figure out using this can one get daily digest of all google services one is using