Closed yusuftaufiq closed 1 year ago
[delta] file-style = "#81A1C1" bold
This is not a valid .ini file, which is why fromIni
is complaining.
This is not a valid .ini file, which is why
fromIni
is complaining.
Thanks for your quick response, can you tell me about a valid .ini file from the example above? Because I tried another configuration like this:
[delta]
file-style = '#81A1C1'
But I seem to get the same result as I described in this issue.
There is no official .ini file specification. Different programs use different variations of the format. chezmoi's fromIni
template function uses the gopkg.in/ini.v1 package.
Note also that you're talking about modifying git's configuration, and git doesn't use the .ini format. git uses its own undocumented config file format. You can use git config
to make changes.
I use delta, but I haven’t used the colour theming like that. However, instead of doing modify_dot_gitconfig.tmpl
with a modification script, why not just go all the way with dot_gitconfig.tmpl
and drop {{ include "delta.gitconfig" }}
at the bottom? See include for the exact details?
I use delta, but I haven’t used the colour theming like that. However, instead of doing
modify_dot_gitconfig.tmpl
with a modification script, why not just go all the way withdot_gitconfig.tmpl
and drop{{ include "delta.gitconfig" }}
at the bottom? See include for the exact details?
Thanks for your suggestion but I'd rather merge .gitconfig
than replace it entirely as I have several different configurations like code editors on multiple OSes. So this is why I used modify_dot_gitconfig
before.
I thought I'd take @twpayne's suggestion to use git config to make changes and I'd use it with the chezmoi script instead.
I use delta, but I haven’t used the colour theming like that. However, instead of doing
modify_dot_gitconfig.tmpl
with a modification script, why not just go all the way withdot_gitconfig.tmpl
and drop{{ include "delta.gitconfig" }}
at the bottom? See include for the exact details? Thanks for your suggestion but I'd rather merge.gitconfig
than replace it entirely as I have several different configurations like code editors on multiple OSes. So this is why I usedmodify_dot_gitconfig
before.
I pretty much only use macOS, but I have built dynamic support for different diff tools using full templates. The same could be done for code editors, etc.
I pretty much only use macOS, but I have built dynamic support for different diff tools using full templates. The same could be done for code editors, etc.
Ah, thanks! I seem to have missed that point, I'll try to check it out.
Describe the bug
I want to use the chezmoi template to modify and merge a
.gitconfig
that uses the .ini file format. When I'm using thefromIni
function when the.gitconfig
value contains a hex color code, it looks like the parsed value is incorrect.To reproduce
.gitconfig
file inside the.chezmoitemplates
folder with the following contents:modify_dot_gitconfig
file inside the chezmoi source directory with the following code:.gitconfig
using:I get the following output:
Expected behavior
Instead of getting
file-style = "\""
, I expected to getfile-style = "#81A1C1" bold
.Output of command with the
--verbose
flagOutput of
chezmoi doctor
Additional context
Actually inside
modify_dot_gitconfig
, I used the code above to combine the.gitconfig
from the chezmoi template with the current.gitconfig
from stdin, here is the full code:Also in the real world, my
.gitconfig
would contain something like this too