fix(config-settings): list values accept comma and/or whitespace separators

Previously list rows (Extra secret, OK codes) split on spaces only, so
'KOPIA, TEST' produced the malformed token 'KOPIA,'. Collapse any run of
commas/whitespace to a single space before splitting, so 'A,B', 'A, B' and
'A B' all yield the same entries.
This commit is contained in:
2026-06-24 11:17:45 -04:00
parent 0250669306
commit de349a423e
2 changed files with 8 additions and 2 deletions
+5 -1
View File
@@ -38,7 +38,11 @@ function __config_settings_set_value
else
switch $type
case list
set -U -- $varname (string split -n ' ' -- $value) 2>/dev/null
# Accept commas and/or whitespace as separators: collapse any run
# of them to a single space, then split (dropping empties). So
# "A,B", "A, B", "A B" and "A B" all yield the same two tokens.
set -U -- $varname \
(string split -n ' ' -- (string replace -ra '[,\s]+' ' ' -- $value)) 2>/dev/null
case '*'
# -- (before the name) guards typed input that begins with a dash
set -U -- $varname $value 2>/dev/null