-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid key in config when using dash #2198
Comments
This is a deliberate extra check added by chezmoi. Keys with dashes in them cannot be used unquoted in templates. See #1438. |
@twpayne It isn't even getting that far to let me quote it. It appears to be doing the check prior to templating. I did find out that it appears to work with the I'm curious on the design decision to use different rules from I've worked around this to some extent by just converting the casing using Sprig template functions in the templates, but there are some this won't work due to multiple uppercase letters in key names (e.g. Regardless thank you for this amazing project and your time!
Footnotes |
Thank you for the detailed follow-up and for your kind words :)
This was an oversight. I initially added the check to disallow dashes in keys as a way to reduce the support burden on me when users hit the problem: instead of getting confused with invalid template variable names, they would instead get an early warning. However, I didn't apply the same checks to
Yeah, case preservation (#463) is a long-standing bug in a dependency that is sadly quite hard to fix. I would question whether preserving case is so important that a major work-around is preferable to losing case.
Please do open separate issues for these so we can track them. |
Describe the bug
Whenever trying to use a key with a dash in `~/.config/chezmoi/chezmoi.toml, it gives an error. According to the TOML v1.0.0 spec1 this should be valid.
To reproduce
Add a key with a dash/hypen in the chezmoi
config.toml
Expected behavior
Allow key with dash/hyphen.
Output of command with the
--verbose
flagchezmoi: invalid config: /home/user/.config/chezmoi/chezmoi.toml: key-name: invalid key
Output of
chezmoi doctor
Additional context
Unsure if this is an issue with the module or version of module being used. If so, then I can report upstream if desired.
Footnotes
https://toml.io/en/v1.0.0#keys ↩
The text was updated successfully, but these errors were encountered: