fix(config): translate hyphens to underscores in sub-category guard variable names
__fish_config_op_enabled built the sub-category override variable name by concatenating the tag's slug verbatim, e.g. __fish_config_op_integrations_window-mgmt. Fish variable names cannot contain hyphens, so any hyphenated sub-category slug (14 of the 24 in the taxonomy) silently could never be overridden -- an unset such variable safely fell through via set -q, but attempting to set it always errored with "invalid variable name", masking the defect since no prior smoke test exercised an explicit sub-category-level toggle. The registry tag itself (as authored in # COMPONENT headers and the taxonomy docs) stays hyphenated; only the derived fish variable name is translated.
This commit is contained in:
@@ -61,7 +61,7 @@ function __fish_config_op_enabled --description 'Guard for an opinionated compon
|
||||
for tag in $tags
|
||||
set -l parts (string split -m 1 -- / $tag)
|
||||
set -l category_var "__fish_config_op_$parts[1]"
|
||||
set -l subcat_var "__fish_config_op_$parts[1]_$parts[2]"
|
||||
set -l subcat_var "__fish_config_op_$parts[1]_"(string replace -a -- '-' '_' $parts[2])
|
||||
__fish_config_op_cascade $category_var $subcat_var
|
||||
or return 1
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user