Skip to content

Instantly share code, notes, and snippets.

@paxswill
Created October 28, 2010 11:50
Show Gist options
  • Save paxswill/651189 to your computer and use it in GitHub Desktop.
Save paxswill/651189 to your computer and use it in GitHub Desktop.
This formats a single days worth of events. Note that I have two UUIDs from my calendars in here, replace with ones from your calendar.
#!/bin/bash
#Get the date command
#DATE_CMD_LOC=`which date`
DATE_CMD_LOC=/bin/date
#Build the date command strings
START_DATE_CMD="$DATE_CMD_LOC -v+$1d +%Y-%m-%d\ 00:00:01\ -0500"
END_DATE_CMD="$DATE_CMD_LOC -v+$1d +%Y-%m-%d\ 23:59:59\ -0500"
#echo $START_DATE_CMD
#echo $END_DATE_CMD
#echo; echo;
#Eval them
START_DATE=`eval $START_DATE_CMD`
END_DATE=`eval $END_DATE_CMD`
#echo $START_DATE
#echo $END_DATE
#echo; echo;
#Get icalBuddy location
#ICAL_CMD_LOC=`which icalBuddy`
ICAL_CMD_LOC=/usr/local/bin/icalBuddy
#Build the icalBuddy command and run it
ICAL_CMD="$ICAL_CMD_LOC -tf '%I:%M %p' -df '' -nc -eep notes,url -ec 662A1173-27EF-492E-814A-8B6438CD6EA3,E51C47B4-4940-4007-B066-D791894384AE -npn eventsFrom:\"$START_DATE\" to:\"$END_DATE\" | sed -e s/'^ \ +'/' '/g -e s/' \- \+'/' \- '/g -e s/' 01:'/' 1:'/g -e s/' 02:'/' 2:'/g -e s/' 03:'/' 3:'/g -e s/' 04:'/' 4:'/g -e s/' 05:'/' 5:'/g -e s/' 06:'/' 6:'/g -e s/' 07:'/' 7:'/g -e s/' 08:'/' 8:'/g -e s/' 09:'/' 9:'/g"
eval $ICAL_CMD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment