Documentation
¶
Overview ¶
Package setting is the list of the settings of sitrep.conf that a person may change with `sitrep config`: for each its kind and limits, the default, and a function that reads the value the program uses now, by calling the getter that the program itself calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Settings = []Setting{ num("SITREP_QUEUE_ITEMS", 1, 1000, conf.DefaultQueueItems, conf.Conf.QueueItems), {Name: "SITREP_STATUS_LINES", Kind: List, Values: conf.StatusLineNames, Default: strings.Join(conf.StatusLineNames, ","), Read: func(c conf.Conf) string { set := c.StatusLines() var on []string for _, n := range conf.StatusLineNames { if set[n] { on = append(on, n) } } return strings.Join(on, ",") }}, num("SITREP_HIGHLIGHT_SECONDS", 0, 86400, conf.DefaultHighlightSeconds, conf.Conf.HighlightSeconds), {Name: "SITREP_HIGHLIGHT_SGR", Kind: Style, Default: conf.DefaultHighlightSGR, Read: conf.Conf.HighlightSGR}, num("SITREP_ATTN_FADE", 0, 604800, conf.DefaultAttnFade, conf.Conf.AttnFade), {Name: "SITREP_DEBOUNCE", Kind: Int, Min: 0, Max: conf.MaxDebounce, Default: strconv.Itoa(conf.DefaultDebounce), Read: func(c conf.Conf) string { return strconv.Itoa(conf.DebounceSeconds(c.Get("SITREP_DEBOUNCE"))) }}, sw("SITREP_CHECK_UPDATES", "on", false, conf.Conf.CheckUpdates), {Name: "SITREP_THEME", Kind: Owned, Owner: "sitrep colors", Default: "default", Read: func(c conf.Conf) string { if t := c.Theme(); t != "" { return t } return "default" }}, {Name: "SITREP_COLORS", Kind: Owned, Owner: "sitrep colors", Default: "", Read: conf.Conf.Colors}, {Name: "SITREP_TUI_INTERVAL", Kind: Duration, Default: "3s", Restart: true, Read: func(c conf.Conf) string { return c.TUIInterval().String() }}, sw("SITREP_TUI_READONLY", "off", true, conf.Conf.TUIReadOnly), sw("SITREP_TUI_BELL", "on", true, conf.Conf.TUIBell), sw("SITREP_TUI_HINTS", "on", true, conf.Conf.TUIHints), sw("SITREP_TUI_MOUSE", "off", true, conf.Conf.TUIMouse), {Name: "SITREP_TUI_WHEEL", Kind: Int, Min: 1, Max: 60, Default: strconv.Itoa(conf.DefaultTUIWheel), Restart: true, Read: func(c conf.Conf) string { return strconv.Itoa(c.TUIWheel()) }}, sw("SITREP_LOG", "off", false, conf.Conf.LogOn), num("SITREP_LOG_MAX", 1, 128, conf.DefaultLogMaxMB, conf.Conf.LogMaxMB), num("SITREP_LOG_DAYS", 1, 3650, conf.DefaultLogDays, conf.Conf.LogDays), sw("SITREP_QUEUE_NUDGE", "off", false, conf.Conf.QueueNudge), num("SITREP_BACKUP_WARN", 0, 3650, 2, conf.Conf.BackupWarnDays), {Name: "SITREP_LANG", Kind: Language, Default: "", Restart: true, Read: func(c conf.Conf) string { return i18n.Choose(func(n string) string { if n == "SITREP_LANG" { return c.Get(n) } return os.Getenv(n) }) }}, {Name: "SITREP_SUMMARY_LANG", Kind: Tag, Default: "", Read: func(c conf.Conf) string { if t, ok := conf.ParseLanguageTag(c.Get("SITREP_SUMMARY_LANG")); ok { return t } return "" }}, }
Settings are the rows, in the order of docs/SETTINGS.md where it has one.
Functions ¶
Types ¶
type Kind ¶
type Kind int
Kind says how a value is written and checked.
const ( Switch Kind = iota // on or off Int // digits, from Min to Max List // names from Values, separated by commas Duration // seconds, or a duration such as 500ms, 5s, 1m Style // terminal SGR codes: digits and semicolons Language // a language of the dashboard Tag // a language tag, for the summaries Owned // another command writes it; config only shows it )
type Setting ¶
type Setting struct {
Name string
Kind Kind
Min, Max int // for Int
Values []string // for List: what is accepted, and what completion offers
Default string // as text, for display
Restart bool // the dashboard reads it when it starts, so a change shows after a restart
Owner string // for Owned: the command that writes it
Read func(conf.Conf) string // the value the program uses now
}
Setting is one row.
func Find ¶
Find is the row of a name. The name may be written without the SITREP_ prefix and in any case.