twpayne / chezmoi

Manage your dotfiles across multiple diverse machines, securely.
https://www.chezmoi.io/
MIT License
13.4k stars 493 forks source link

data render from chezmoi.yaml.tmpl are lower case #1972

Closed dhruvinsh closed 2 years ago

dhruvinsh commented 2 years ago

Describe the bug

I have chezmoi.yaml.tmpl to generate some data based on answers to the questions. Which can be seen by chezmoi data. But the key always render in lowercase and disregard the original variable's camelCase.

To reproduce

Steps to reproduce the behavior"

{{ $personalMachine := promptBool "Is it personal machine" -}}

data:
    personalMachine: {{ $personalMachine }}

once performed chezmoi init answered to the question, data generate as below

chezmoi init
```json
{
  .,
  .,
  "personalmachine": true,
  .,
  .,
}

Expected behavior

Data should have original variable name with intact case, that means it should be "personalMachine" not "personalmachine"

bradenhilton commented 2 years ago

This is covered in the FAQ: https://www.chezmoi.io/user-guide/frequently-asked-questions/design/#why-does-chezmoi-convert-all-my-template-variables-to-lowercase

Basically, it's caused by a dependency, and it's nontrivial to replace the dependency while remaining backwards compatible.

dhruvinsh commented 2 years ago

Thank you :) My bad that I did not read properly.