Skip to content

How to ignore values frequently changed in a file managed by chezmoi? #3493

Answered by bradenhilton
nagromc asked this question in Q&A
Discussion options

You must be logged in to vote

A modify template is the solution. Here is my scoop config:

modify_config.json:

// chezmoi:modify-template
// chezmoi:template:line-endings=crlf
// chezmoi:template:left-delimiter=//{{
//{{- $currentConfig := .chezmoi.stdin | fromJson -}}
//{{- $modifiedConfig := .chezmoi.stdin | fromJson -}}

//{{- $_ := set $modifiedConfig "use_external_7zip" true -}}

//{{- if deepEqual $currentConfig $modifiedConfig -}}
//{{-   .chezmoi.stdin }}
//{{- else -}}
//{{-   $modifiedConfig | toPrettyJson }}
//{{- end -}}

In your case, you can replace use_external_7zip with aria2-enabled. You may get a diff after this, but you shouldn't get any more after that.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@nagromc
Comment options

@bradenhilton
Comment options

@twpayne
Comment options

@nagromc
Comment options

Answer selected by nagromc
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants