mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
init column config menu
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user