Add Readme File

Fix 'refresh' function
This commit is contained in:
Brian Buller 2017-03-09 12:16:16 -06:00
parent 89e317fd7b
commit caeb987e12
2 changed files with 28 additions and 12 deletions

13
README.md Normal file
View File

@ -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 <quick add text>` - Quickly add an event to your default google calendar
`gal refresh` - Invalidate the cache then run `gal today`

27
main.go
View File

@ -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