diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 4ce02c09..e4d0087e 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -22,6 +22,12 @@ Version: 1.7.0 - cligen/mslice.initSep allows eliding backslash for special chars: 0, t, n + - BREAKING CHANGE only under -d:cgCfgToml & in config.toml:[color] section + where color specification becomes like the `[render]` section and more + like non-TOML color specs instead of a more awkward TOML list of strings. + Existing TOML users likely need to simplify just 1 file in a user config + (although running under `NO_COLOR=1` is another option). + Version: 1.6.18 --------------- - Add cligen/mslice.within to test if one slice entirely brackets another diff --git a/cligen/clCfgToml.nim b/cligen/clCfgToml.nim index 2fa822cd..f54ecaa7 100644 --- a/cligen/clCfgToml.nim +++ b/cligen/clCfgToml.nim @@ -60,11 +60,10 @@ proc apply(c: var ClCfg, cfgFile: string, plain=false) = else: stderr.write(&"{cfgFile}: unknown keyword {k2} in the [{k1}] section\n") of "color": - stderr.write "toml parsing\n" if not plain: for k2, v2 in v1.getTable().pairs: - let val = textAttrOn(v2.getElems().mapIt(it.getStr())) - var on = ""; var off = textAttrOff + let val = v2.getStr() + var on, off: string if ';' in val: let c = val.split(';') if c.len != 2: @@ -72,7 +71,7 @@ proc apply(c: var ClCfg, cfgFile: string, plain=false) = on = textAttrOn(c[0].strip.split, plain) off = textAttrOn(c[1].strip.split, plain) else: - on = textAttrOn(val.split, plain) + on = textAttrOn(val.strip.split, plain); off = textAttrOff case k2.toLowerAscii() of "optkeys", "options", "switches", "optkey", "option", "switch": c.helpAttr["clOptKeys"] = on; c.helpAttrOff["clOptKeys"] = off diff --git a/configs/config.toml b/configs/config.toml index 56aad84b..ab68ff9a 100644 --- a/configs/config.toml +++ b/configs/config.toml @@ -9,13 +9,13 @@ # includes = ["LC_THEME"] # This can define aliases like: colors = "fhot5 = RED" [color] - switches = ["RED"] # These example colors are likely very ugly to you. - valtype = ["CYAN"] # The full syntax for all these color/attr specs is.. - defaultvalue = ["GREEN", "bold"] # .. implemented in `cligen/humanUt.nim:textAttrParse` - description = ["PURPLE"] # .. `cligen/humanUt.nim:attrNames` is a good start. - command = ["bold"] # Command name in one-liners & in multi-cmd tables - doc = ["YELLOW"] # Overall documentation - args = ["RED"] # Positional args in one-liners + switches = "RED" # These example colors are likely very ugly to you. + valtype = "CYAN" # The full syntax for all these color/attr specs is.. + defaultvalue = "GREEN bold" # .. implemented in `cligen/humanUt.nim:textAttrParse` + description = "PURPLE" # .. `cligen/humanUt.nim:attrNames` is a good start. + command = "bold" # Command name in one-liners & in multi-cmd tables + doc = "YELLOW" # Overall documentation + args = "RED" # Positional args in one-liners [render] singleStar = "italic ; -italic"