Created
July 10, 2010 06:55
-
-
Save dtjm/470523 to your computer and use it in GitHub Desktop.
A command-line wrapper you can use to call WriteRoom from GoogleCL
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
#!/bin/bash -x | |
# WriteRoom command-line launcher by Sam Nguyen | |
# Made to be used with googlecl docs | |
# Works with svn rev 341 of googlecl | |
# | |
# usage: | |
# google docs edit --title "My title" --editor /path/to/writeroom-wrapper-googlecl.sh | |
######################################## | |
# 1. Create the file if it doesn't exist | |
# GoogleCL won't actually create the file for you | |
if [ ! -e "$1" ] | |
then | |
touch "$1" | |
fi | |
######################################## | |
# 2. Open the file | |
# -W block until application quits | |
# (you need to block because if you don't, googlecl will try to upload the file) | |
# -a which application to use | |
open -W -a WriteRoom "$1" | |
######################################## | |
# 3. Once WriteRoom has quit, check if the file is zero size | |
# If so, delete it so googlecl doesn't try to upload it | |
# -s file is NOT zero size | |
if [ ! -s "$1" ] | |
then | |
rm "$1" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment