Saturday, October 13, 2012

googlecl = blog in vim

This post was uploaded from my Ubuntu box by running the command:
$ google blogger --blog "Curiosity heals the cat" post --title "googlecl = blog in vim" --src googlecl.txt

where googlecl.txt contains the content you are reading. Talk about making it easier to post! :)

Now I can type out on vim snuggled in the dark, warm comfort of the terminal without resorting to browser plugins supporting vim.

A small note on the setup - googlecl works with gdata library. Using the latest versions of googlecl and gdata caused problems for me.

But googlecl worked like a charm when I used the following packages:

googlecl-0.9.13.tar.gz + gdata-2.0.14.tar.gz= vimvana!

Be sure to set/unset http_proxy and https_proxy environment variables before starting to use googlecl. I had moved to a different network without proxy and googlecl gave me a stack trace, instead of a meaningful error message to disable my proxy.

When you run blogger operations for the first time, googlecl will check if you have obtained an access token to perform this action. If you haven't, it will try to obtain one (by opening a browser window and asking you to sign in)

Once you are signed in googlecl will put the authentication token in /home/your_user/.local/share/googlecl with the name as access_tok_your.google.user.name

I find it useful to delete this file once I am done with my work so that my acccess is revoked once I am done with my work. You can also invalidate the access token by going to Google settings => Security => Connected application and sites  and removing the access token manually.

googlecl supports editing of google-docs but not of blog posts. So you have to do a:

$ google blogger --blog "Curiosity heals the cat" delete --title "googlecl = blog in vim"
$ google blogger --blog "Curiosity heals the cat" post --title "googlecl = blog in vim" --src googlecl.txt

May be a deal breaker for some people.

More info about googlecl at googlecl manual