Skip to content

Ignoring scripts with .chezmoiignore #2510

Answered by twpayne
canac asked this question in Q&A
Discussion options

You must be logged in to vote

Yes. Note that you have to include .chezmoiscripts/ and remove any attributes from the source path as .chezmoiignore works with target paths.

For example, if you have a script in a file called .chezmoiscripts/run_once_configure-linux.sh that you don't want to run on non-Linux machines you would put this in your .chezmoiignore file:

{{ if ne .chezmoi.os "linux" }}
.chezmoiscripts/configure-linux.sh
{{ end }}

#2515 adds a test that demonstrates this.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@canac
Comment options

Answer selected by canac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants