Comments (2)
Drive-by notes for later:
For testing the 2nd and 3rd commands, I used the following testscript change:
diff --git a/internal/cmd/testdata/scripts/editconfigtemplate.txtar b/internal/cmd/testdata/scripts/editconfigtemplate.txtar
index 7c705ae3a..c791315c2 100644
--- a/internal/cmd/testdata/scripts/editconfigtemplate.txtar
+++ b/internal/cmd/testdata/scripts/editconfigtemplate.txtar
@@ -22,6 +22,18 @@ chhome home4/user
exec chezmoi edit-config-template
cmp $CHEZMOISOURCEDIR/home/.chezmoi.yaml.tmpl golden/edited-chezmoi.yaml
+chhome home5/user
+
+# test chezmoi edit-config-template --config with a non-existent config file
+exec chezmoi --config=config.yaml --config-format=yaml edit-config-template
+cmp $CHEZMOISOURCEDIR/.config.yaml.tmpl golden/edited
+
+chhome home6/user
+
+# test chezmoi edit-config-template --config-format with a non-existent config file
+exec chezmoi --config-format=yaml edit-config-template
+cmp $CHEZMOISOURCEDIR/.config.yaml.tmpl golden/edited
+
-- golden/edited --
# edited
-- golden/edited-chezmoi.yaml --
Re
The 4th command should edit the file .chezmoi.json.tmpl
where the 4th command is:
% HOME=/tmp/chezmoi EDITOR=echo chezmoi --config config.yaml --config-format json edit-config-template
/tmp/chezmoi/.local/share/chezmoi/.config.yaml.tmpl
chezmoi: warning: /bin/echo /tmp/chezmoi/.local/share/chezmoi/.config.yaml.tmpl: returned in less than 1s
There's a direct conflict here between --config
and --config-format
. In this case, I would suggest the rule that --config-format
is only used when creating a new config file, i.e. that --config-file
is ignored in this case (possibly with a warning) and this 4th command should edit .chezmoi.yaml.tmpl
.
from chezmoi.
Your first test should not include --config-format=yaml
, (only --config=config.yaml).
I agree that for the 4th command the --config
option should be ignored, i.e., the --config-format
option supersedes whatever format might be implied by the --config
option. However, this implies that the edited file should be .chezmoi.json.tmpl
(json, not yaml).
You should add a 3rd new test:
exec chezmoi --config=config.toml --config-format=yaml edit-config-template
cmp $CHEZMOISOURCEDIR/.config.yaml.tmpl golden/edited
from chezmoi.
Related Issues (20)
- chezmoi hangs if keepassxc exits with errors in open mode HOT 3
- Minor Inconsistency in Documentation: age configuration variables HOT 1
- feat: `re-add <dir>` descends into directories
- `.chezmoi.destDir` empty on Windows HOT 3
- Improve support for 1Password service accounts HOT 11
- Support arbitrary encryption/decryption tools HOT 11
- chezmoi can not be started on termux HOT 3
- Chezmoi Fails to Detect Git HOT 6
- Chezmoi wants to overwrite .config symlink HOT 6
- Chezmoi diff is different from chezmoi apply diff HOT 3
- Chezmoi "add" adds/deletes subdirectories corresponding to submodules HOT 2
- Allow .tmpl suffix for chezmoidata HOT 7
- chezmoi add: errors when directory referenced in .chezmoiexternal HOT 2
- Allow to use the built-in encryption method as a secret store HOT 3
- Different dotfiles on different machines, updated on the target side HOT 5
- Add a config option to make --apply=false the default for `chezmoi update` HOT 2
- Unable to fetch multiple external sources into same directory. HOT 3
- Chezmoi diff sets .Target wrong if the target dir does not exist HOT 2
- Prevent chezmoi external deleting something. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chezmoi.