init column config menu

This commit is contained in:
Bradley Cicenas
2020-01-02 23:02:53 +00:00
parent 6e60fc905e
commit 22a5607012
9 changed files with 117 additions and 15 deletions

View File

@@ -69,6 +69,13 @@ func EnabledColumns() (a []string) {
return a
}
// ColumnToggle toggles the enabled status of a given column name
func ColumnToggle(name string) {
col := GlobalColumns[colIndex(name)]
col.Enabled = !col.Enabled
log.Noticef("config change [column-%s]: %t -> %t", col.Name, !col.Enabled, col.Enabled)
}
// ColumnLeft moves the column with given name up one position, if possible
func ColumnLeft(name string) {
idx := colIndex(name)

View File

@@ -72,8 +72,7 @@ func Toggle(k string) {
lock.Lock()
defer lock.Unlock()
newVal := !sw.Val
log.Noticef("config change [%s]: %t -> %t", k, sw.Val, newVal)
sw.Val = newVal
sw.Val = !sw.Val
log.Noticef("config change [%s]: %t -> %t", k, !sw.Val, sw.Val)
//log.Errorf("ignoring toggle for non-existant switch: %s", k)
}