-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only create templates with chezmoi add --autotemplate if a replacemen…
…t occurred
- Loading branch information
Showing
4 changed files
with
52 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
# test adding a file with --autotemplate | ||
# test that chezmoi add --autotemplate on a file with a replacement creates a template in the source directory | ||
chezmoi add --autotemplate $HOME${/}.template | ||
cmp $CHEZMOISOURCEDIR/dot_template.tmpl golden/dot_template.tmpl | ||
|
||
# test adding a symlink with --autotemplate | ||
# test that chezmoi add --autotemplate on a symlink with a replacement creates a template in the source directory | ||
symlink $HOME/.symlink -> .target-value | ||
chezmoi add --autotemplate $HOME${/}.symlink | ||
cmp $CHEZMOISOURCEDIR/symlink_dot_symlink.tmpl golden/symlink_dot_symlink.tmpl | ||
|
||
# test that chezmoi add --autotemplate does not create a template if no replacements occurred | ||
chezmoi add --autotemplate $HOME${/}.file | ||
cmp $CHEZMOISOURCEDIR/dot_file golden/dot_file | ||
|
||
-- golden/dot_file -- | ||
# contents of .file | ||
-- golden/dot_template.tmpl -- | ||
key = {{ .variable }} | ||
-- golden/symlink_dot_symlink.tmpl -- | ||
.target-{{ .variable }} | ||
-- home/user/.config/chezmoi/chezmoi.toml -- | ||
[data] | ||
variable = "value" | ||
-- home/user/.file -- | ||
# contents of .file | ||
-- home/user/.template -- | ||
key = value |