diff --git a/README.md b/README.md new file mode 100644 index 0000000..a7569d2 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# galendar + +Google Calendar CLI Client + +In development still. + +Current features + +`gal [today]` - Fetch and print today's agenda for all calendars flagged as 'default' +`gal config` - Open an interactive mode to configure the application +`gal add ` - Quickly add an event to your default google calendar +`gal refresh` - Invalidate the cache then run `gal today` + diff --git a/main.go b/main.go index 2ec8e94..b4c93bb 100644 --- a/main.go +++ b/main.go @@ -51,22 +51,21 @@ func main() { DoVersionCheck() - for i := range os.Args { - switch os.Args[i] { - case "--reinit": - // Reset all config - for _, v := range state.cfg.GetKeyList() { - fmt.Println("Deleting Key: " + v) - state.cfg.DeleteKey(v) - } - case "--refresh": - - case "-r": - + if op == "refresh" { + // Invalidate Cache, then just do a 'today' + if err = state.cfg.SetDateTime("calListUseBy", time.Now()); err != nil { + fmt.Println("cahceInvalidate error:", err) } + op = "today" } switch op { + case "--reinit": + // Reset all config + for _, v := range state.cfg.GetKeyList() { + fmt.Println("Deleting Key: " + v) + state.cfg.DeleteKey(v) + } case "today": // Show everything on the calendar for today InitComm() @@ -121,6 +120,10 @@ func main() { fmt.Println(err.Error()) } else { fmt.Println(e.ToCLIString()) + // Invalidate the cache + if err = state.cfg.SetDateTime("calListUseBy", time.Now()); err != nil { + fmt.Println("cahceInvalidate error:", err) + } } case "bail": // Just initialize communications and bail