Add 'brief' command

This commit is contained in:
Brian Buller 2019-01-24 07:07:41 -06:00
parent 91e9e7d005
commit eb0d0a7072

11
main.go
View File

@ -37,7 +37,7 @@ var state *AppState
var parameters []string
func main() {
parameters = []string{"add", "config", "event", "defaults", "delete", "next", "refresh", "today", "ui"}
parameters = []string{"add", "config", "event", "defaults", "delete", "next", "refresh", "today", "brief", "ui"}
var err error
var op string
state = &AppState{Name: AppName, Version: AppVersion}
@ -174,7 +174,7 @@ func main() {
}
fmt.Println("Couldn't find event with ID " + strconv.Itoa(evNum))
case "today":
case "today", "brief":
events := state.account.GetTodaysActiveEvents()
if len(events) == 0 {
fmt.Println("No Events Found")
@ -190,7 +190,11 @@ func main() {
fmt.Println(err.Error())
return
}
eventString := stTmStr + CalColToAnsi(*colDef).Sprint(" ") + " " + e.Summary + " " + durStr
sum := e.Summary
if op == "brief" && len(sum) > 35 {
sum = sum[:35] + "..."
}
eventString := stTmStr + CalColToAnsi(*colDef).Sprint(" ") + " " + sum + " " + durStr
if hasMod("ids") {
idString := "@" + strconv.Itoa(e.InstanceId)
for len(idString) < 5 {
@ -398,6 +402,7 @@ func printHelp() {
fmt.Println(" Event ids change such that the next upcoming event is always event 0,")
fmt.Println(" the one after that is 1, the previous one is -1, etc.")
fmt.Println("")
fmt.Println(" brief The same as 'today' except summaries are truncated to save space.")
//fmt.Println(" ui Open galendar in UI mode")
fmt.Println("")
}