about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-11-26 14:48:30 +0100
committerbptato <nincsnevem662@gmail.com>2023-11-26 14:48:30 +0100
commitefae976719521ca4ed0bc7f99425a1700d3d9029 (patch)
tree15cdeb713c71701fc6a89d44d713cf9d6b8ed2f1 /src/config
parenta386b78fdc61b791b6df649326078383098bef5a (diff)
downloadchawan-efae976719521ca4ed0bc7f99425a1700d3d9029.tar.gz
config: add bare aliases for "8bit", "24bit"
Without this, setting color-mode using -o required quoting
the values, and then shell-quoting the quotes themselves
(cha -o 'display-color-mode="24bit"').

Instead of more special casing in the TOML parser, we just add aliases
for these enum values that can be parsed using TOML bare string
rules. So now this works:
cha -o display.color-mode=true-color
Diffstat (limited to 'src/config')
-rw-r--r--src/config/config.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/config/config.nim b/src/config/config.nim
index 99f9d9da..b0e33685 100644
--- a/src/config/config.nim
+++ b/src/config/config.nim
@@ -495,8 +495,8 @@ proc parseConfigValue(x: var Opt[ColorMode], v: TomlValue, k: string) =
   of "auto": x.err()
   of "monochrome": x.ok(MONOCHROME)
   of "ansi": x.ok(ANSI)
-  of "8bit": x.ok(EIGHT_BIT)
-  of "24bit": x.ok(TRUE_COLOR)
+  of "8bit", "eight-bit": x.ok(EIGHT_BIT)
+  of "24bit", "true-color": x.ok(TRUE_COLOR)
   else:
     raise newException(ValueError, "unknown color mode '" & v.s &
       "' for key " & k)