Skip to content

Instantly share code, notes, and snippets.

@nickrw
Last active September 7, 2016 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickrw/4f7fb996010d0f3e111c to your computer and use it in GitHub Desktop.
Save nickrw/4f7fb996010d0f3e111c to your computer and use it in GitHub Desktop.
nextcal.sh
#!/bin/sh
# Fetches the next item in your google calendar (assuming pre-set-up by running gcalcli)
CALENDAR_NAME=""
cal="$(gcalcli \
--nostarted \
--calendar $CALENDAR_NAME \
--nocolor \
--military \
agenda 00:00 23:59 \
| sed -E '/^$/d; s/ +/ /g; s/^(([^ ]+ ){3}| +)//; s/ / - /' \
| head -n1)"
if [ -z "$cal" ]; then
cal="Nothing"
fi
echo "Next: $cal"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment