This is a breaking change that modifies the return type of fetchActivities() so that instead of returning a map[int]string that maps an ID with the name of the activity with such ID, it returns a map[uint]remoteActivityType. remoteActivityType is a remote activity and it holds more than just the activity name, it also includes two extra fields exposed by the API: * IsDefault (is_default): the enumerator value can be used as default when not given (i.e., default issue type, default activity type...) * Active (active): the enumerator value can be used for new entries. The ID type has changed from int to uint following the efforts of coalescing all remote identifiers to uint. The activities subcommand now outputs all the fields of the enumerator.
24 lines
423 B
Go
24 lines
423 B
Go
package main
|
|
|
|
import "github.com/rodaine/table"
|
|
|
|
func doListActivities() {
|
|
acts, err := context.fetchActivities()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
tbl := table.New("ID", "ACTIVITY", "DEF", "ACT")
|
|
for id, act := range acts {
|
|
isDefault := " "
|
|
isActive := " "
|
|
if act.IsDefault {
|
|
isDefault = "[X]"
|
|
}
|
|
if act.Active {
|
|
isActive = "[X]"
|
|
}
|
|
tbl.AddRow(id, act.Name, isDefault, isActive)
|
|
}
|
|
tbl.Print()
|
|
}
|