Skip to content

Commit 763d5c0

Browse files
Add single state config for syscfg
This can be used intead of separate settings for each state.
1 parent 7a04837 commit 763d5c0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

newt/syscfg/syscfg.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,24 @@ func readSetting(name string, lpkg *pkg.LocalPackage,
463463
entry.State = CFG_SETTING_STATE_GOOD
464464
}
465465

466+
stateVal, stateExist := vals["state"]
467+
if stateExist {
468+
if entry.State != CFG_SETTING_STATE_GOOD {
469+
util.OneTimeWarning("Setting %s has duplicated state definition, using \"state\".", name)
470+
}
471+
472+
switch stringValue(stateVal) {
473+
case "defunct":
474+
entry.State = CFG_SETTING_STATE_DEFUNCT
475+
case "deprecated":
476+
entry.State = CFG_SETTING_STATE_DEPRECATED
477+
case "experimental":
478+
entry.State = CFG_SETTING_STATE_EXPERIMENTAL
479+
default:
480+
util.OneTimeWarning("Invalid \"state\" for setting %s, assuming regular state.", name)
481+
}
482+
}
483+
466484
// The value field for setting definition is required.
467485
valueVal, valueExist := vals["value"]
468486
if valueExist {

0 commit comments

Comments
 (0)