/
docs.gen.go
3677 lines (3675 loc) · 172 KB
/
docs.gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by github.com/twpayne/chezmoi/internal/cmd/generate-assets. DO NOT EDIT.
// +build !noembeddocs
package cmd
func init() {
assets["docs/CHANGES.md"] = []byte("" +
"# chezmoi Changes\n" +
"\n" +
"<!--- toc --->\n" +
"* [Upcoming](#upcoming)\n" +
" * [Default diff format changing from `chezmoi` to `git`.](#default-diff-format-changing-from-chezmoi-to-git)\n" +
" * [`gpgRecipient` config variable changing to `gpg.recipient`](#gpgrecipient-config-variable-changing-to-gpgrecipient)\n" +
"\n" +
"## Upcoming\n" +
"\n" +
"### Default diff format changing from `chezmoi` to `git`.\n" +
"\n" +
"Currently chezmoi outputs diffs in its own format, containing a mix of unified\n" +
"diffs and shell commands. This will be replaced with a [git format\n" +
"diff](https://git-scm.com/docs/diff-format) in version 2.0.0.\n" +
"\n" +
"### `gpgRecipient` config variable changing to `gpg.recipient`\n" +
"\n" +
"The `gpgRecipient` config variable is changing to `gpg.recipient`. To update,\n" +
"change your config from:\n" +
"\n" +
" gpgRecipient = \"...\"\n" +
"\n" +
"to:\n" +
"\n" +
" [gpg]\n" +
" recipient = \"...\"\n" +
"\n" +
"Support for the `gpgRecipient` config variable will be removed in version 2.0.0.\n" +
"\n")
assets["docs/CONTRIBUTING.md"] = []byte("" +
"# chezmoi Contributing Guide\n" +
"\n" +
"<!--- toc --->\n" +
"* [Getting started](#getting-started)\n" +
"* [Developing locally](#developing-locally)\n" +
"* [Generated code](#generated-code)\n" +
"* [Contributing changes](#contributing-changes)\n" +
"* [Managing releases](#managing-releases)\n" +
"* [Packaging](#packaging)\n" +
"* [Updating the website](#updating-the-website)\n" +
"\n" +
"## Getting started\n" +
"\n" +
"chezmoi is written in [Go](https://golang.org) and development happens on\n" +
"[GitHub](https://github.com). The rest of this document assumes that you've\n" +
"checked out chezmoi locally.\n" +
"\n" +
"## Developing locally\n" +
"\n" +
"chezmoi requires Go 1.14 or later and Go modules enabled. Enable Go modules by\n" +
"setting the environment variable `GO111MODULE=on`.\n" +
"\n" +
"chezmoi is a standard Go project, using standard Go tooling, with a few extra\n" +
"tools. Ensure that these extra tools are installed with:\n" +
"\n" +
" make ensure-tools\n" +
"\n" +
"Build chezmoi:\n" +
"\n" +
" go build .\n" +
"\n" +
"Run all tests:\n" +
"\n" +
" go test ./...\n" +
"\n" +
"Run chezmoi:\n" +
"\n" +
" go run .\n" +
"\n" +
"## Generated code\n" +
"\n" +
"chezmoi generates help text, shell completions, embedded files, and the website\n" +
"from a single source of truth. You must run\n" +
"\n" +
" go generate\n" +
"\n" +
"if you change includes any of the following:\n" +
"\n" +
"* Modify any documentation in the `docs/` directory.\n" +
"* Modify any files in the `assets/templates/` directory.\n" +
"* Add or modify a command.\n" +
"* Add or modify a command's flags.\n" +
"\n" +
"chezmoi's continuous integration verifies that all generated files are up to\n" +
"date. Changes to generated files should be included in the commit that modifies\n" +
"the source of truth.\n" +
"\n" +
"## Contributing changes\n" +
"\n" +
"Bug reports, bug fixes, and documentation improvements are always welcome.\n" +
"Please [open an issue](https://github.com/twpayne/chezmoi/issues/new/choose) or\n" +
"[create a pull\n" +
"request](https://help.github.com/en/articles/creating-a-pull-request) with your\n" +
"report, fix, or improvement.\n" +
"\n" +
"If you want to make a more significant change, please first [open an\n" +
"issue](https://github.com/twpayne/chezmoi/issues/new/choose) to discuss the\n" +
"change that you want to make. Dave Cheney gives a [good\n" +
"rationale](https://dave.cheney.net/2019/02/18/talk-then-code) as to why this is\n" +
"important.\n" +
"\n" +
"All changes are made via pull requests. In your pull request, please make sure\n" +
"that:\n" +
"\n" +
"* All existing tests pass.\n" +
"\n" +
"* There are appropriate additional tests that demonstrate that your PR works as\n" +
" intended.\n" +
"\n" +
"* The documentation is updated, if necessary. For new features you should add an\n" +
" entry in `docs/HOWTO.md` and a complete description in `docs/REFERENCE.md`.\n" +
"\n" +
"* All generated files are up to date. You can ensure this by running `go\n" +
" generate` and including any modified files in your commit.\n" +
"\n" +
"* The code is correctly formatted, according to\n" +
" [`gofumports`](https://mvdan.cc/gofumpt/gofumports). You can ensure this by\n" +
" running `make format`.\n" +
"\n" +
"* The code passes [`golangci-lint`](https://github.com/golangci/golangci-lint).\n" +
" You can ensure this by running `make lint`.\n" +
"\n" +
"* The commit messages match chezmoi's convention, specifically that they begin\n" +
" with a capitalized verb in the imperative and give a short description of what\n" +
" the commit does. Detailed information or justification can be optionally\n" +
" included in the body of the commit message.\n" +
"\n" +
"* Commits are logically separate, with no merge or \"fixup\" commits.\n" +
"\n" +
"* The branch applies cleanly to `master`.\n" +
"\n" +
"## Managing releases\n" +
"\n" +
"Releases are managed with [`goreleaser`](https://goreleaser.com/).\n" +
"\n" +
"To build a test release, without publishing, (Linux only) run:\n" +
"\n" +
" make test-release\n" +
"\n" +
"Publish a new release by creating and pushing a tag, e.g.:\n" +
"\n" +
" git tag v1.2.3\n" +
" git push --tags\n" +
"\n" +
"This triggers a [GitHub Action](https://github.com/twpayne/chezmoi/actions) that\n" +
"builds and publishes archives, packages, and snaps, and creates a new [GitHub\n" +
"Release](https://github.com/twpayne/chezmoi/releases).\n" +
"\n" +
"Publishing [Snaps](https://snapcraft.io/) requires a `SNAPCRAFT_LOGIN`\n" +
"[repository\n" +
"secret](https://github.com/twpayne/chezmoi/settings/secrets/actions). Snapcraft\n" +
"logins periodically expire. Create a new snapcraft login by running:\n" +
"\n" +
" snapcraft export-login --snaps=chezmoi --channels=stable --acls=package_upload -\n" +
"\n" +
"[brew](https://brew.sh/) formula must be updated manually with the command:\n" +
"\n" +
" brew bump-formula-pr --tag=v1.2.3 chezmoi\n" +
"\n" +
"## Packaging\n" +
"\n" +
"If you're packaging chezmoi for an operating system or distribution:\n" +
"\n" +
"* chezmoi has no build or install dependencies other than the standard Go\n" +
" toolchain.\n" +
"\n" +
"* Please set the version number, git commit, and build time in the binary. This\n" +
" greatly assists debugging when end users report problems or ask for help. You\n" +
" can do this by passing the following flags to the Go linker:\n" +
"\n" +
" ```\n" +
" -X main.version=$VERSION\n" +
" -X main.commit=$COMMIT\n" +
" -X main.date=$DATE\n" +
" -X main.builtBy=$BUILT_BY\n" +
" ```\n" +
"\n" +
" `$VERSION` should be the chezmoi version, e.g. `1.7.3`. Any `v` prefix is\n" +
" optional and will be stripped, so you can pass the git tag in directly.\n" +
"\n" +
" `$COMMIT` should be the full git commit hash at which chezmoi is built, e.g.\n" +
" `4d678ce6850c9d81c7ab2fe0d8f20c1547688b91`.\n" +
"\n" +
" `$DATE` should be the date of the build in RFC3339 format, e.g.\n" +
" `2019-11-23T18:29:25Z`.\n" +
"\n" +
" `$BUILT_BY` should be a string indicating what mechanism was used to build the\n" +
" binary, e.g. `goreleaser`.\n" +
"\n" +
"* Please enable cgo, if possible. chezmoi can be built and run without cgo, but\n" +
" the `.chezmoi.username` and `.chezmoi.group` template variables may not be set\n" +
" correctly on some systems.\n" +
"\n" +
"* chezmoi includes a `docs` command which prints its documentation. By default,\n" +
" the docs are embedded in the binary. You can disable this behavior, and have\n" +
" chezmoi read its docs from the filesystem by building with the `noembeddocs`\n" +
" build tag and setting the directory where chezmoi can find them with the `-X\n" +
" github.com/twpayne/chezmoi/cmd.DocDir=$DOCDIR` linker flag. For example:\n" +
"\n" +
" ```\n" +
" go build -tags noembeddocs -ldflags \"-X github.com/twpayne/chezmoi/cmd.DocsDir=/usr/share/doc/chezmoi\" .\n" +
" ```\n" +
"\n" +
" To remove the `docs` command completely, use the `nodocs` build tag.\n" +
"\n" +
"* chezmoi includes an `upgrade` command which attempts to self-upgrade. You can\n" +
" remove this command completely by building chezmoi with the `noupgrade` build\n" +
" tag.\n" +
"\n" +
"* chezmoi includes shell completions in the `completions` directory. Please\n" +
" include these in the package and install them in the shell-appropriate\n" +
" directory, if possible.\n" +
"\n" +
"* If the instructions for installing chezmoi in chezmoi's [install\n" +
" guide](https://github.com/twpayne/chezmoi/blob/master/docs/INSTALL.md) are\n" +
" absent or incorrect, please open an issue or submit a PR to correct them.\n" +
"\n" +
"## Updating the website\n" +
"\n" +
"[The website](https://chezmoi.io) is generated with [Hugo](https://gohugo.io/)\n" +
"and served with [GitHub pages](https://pages.github.com/) from the [`gh-pages`\n" +
"branch](https://github.com/twpayne/chezmoi/tree/gh-pages) to GitHub.\n" +
"\n" +
"Before building the website, you must download the [Hugo Book\n" +
"Theme](https://github.com/alex-shpak/hugo-book) by running:\n" +
"\n" +
" git submodule update --init\n" +
"\n" +
"Test the website locally by running:\n" +
"\n" +
" ( cd chezmoi.io && hugo serve )\n" +
"\n" +
"and visit http://localhost:1313/.\n" +
"\n" +
"To build the website in a temporary directory, run:\n" +
"\n" +
" ( cd chezmoi.io && make )\n" +
"\n" +
"From here you can run\n" +
"\n" +
" git show\n" +
"\n" +
"to show changes and\n" +
"\n" +
" git push\n" +
"\n" +
"to push them. You can only push changes if you have write permissions to the\n" +
"chezmoi GitHub repo.\n" +
"\n")
assets["docs/FAQ.md"] = []byte("" +
"# chezmoi Frequently Asked Questions\n" +
"\n" +
"<!--- toc --->\n" +
"* [How can I quickly check for problems with chezmoi on my machine?](#how-can-i-quickly-check-for-problems-with-chezmoi-on-my-machine)\n" +
"* [What are the consequences of \"bare\" modifications to the target files? If my `.zshrc` is managed by chezmoi and I edit `~/.zshrc` without using `chezmoi edit`, what happens?](#what-are-the-consequences-of-bare-modifications-to-the-target-files-if-my-zshrc-is-managed-by-chezmoi-and-i-edit-zshrc-without-using-chezmoi-edit-what-happens)\n" +
"* [How can I tell what dotfiles in my home directory aren't managed by chezmoi? Is there an easy way to have chezmoi manage a subset of them?](#how-can-i-tell-what-dotfiles-in-my-home-directory-arent-managed-by-chezmoi-is-there-an-easy-way-to-have-chezmoi-manage-a-subset-of-them)\n" +
"* [How can I tell what dotfiles in my home directory are currently managed by chezmoi?](#how-can-i-tell-what-dotfiles-in-my-home-directory-are-currently-managed-by-chezmoi)\n" +
"* [If there's a mechanism in place for the above, is there also a way to tell chezmoi to ignore specific files or groups of files (e.g. by directory name or by glob)?](#if-theres-a-mechanism-in-place-for-the-above-is-there-also-a-way-to-tell-chezmoi-to-ignore-specific-files-or-groups-of-files-eg-by-directory-name-or-by-glob)\n" +
"* [If the target already exists, but is \"behind\" the source, can chezmoi be configured to preserve the target version before replacing it with one derived from the source?](#if-the-target-already-exists-but-is-behind-the-source-can-chezmoi-be-configured-to-preserve-the-target-version-before-replacing-it-with-one-derived-from-the-source)\n" +
"* [Once I've made a change to the source directory, how do I commit it?](#once-ive-made-a-change-to-the-source-directory-how-do-i-commit-it)\n" +
"* [How do I only run a script when a file has changed?](#how-do-i-only-run-a-script-when-a-file-has-changed)\n" +
"* [I've made changes to both the destination state and the source state that I want to keep. How can I keep them both?](#ive-made-changes-to-both-the-destination-state-and-the-source-state-that-i-want-to-keep-how-can-i-keep-them-both)\n" +
"* [Why does chezmoi convert all my template variables to lowercase?](#why-does-chezmoi-convert-all-my-template-variables-to-lowercase)\n" +
"* [chezmoi makes `~/.ssh/config` group writeable. How do I stop this?](#chezmoi-makes-sshconfig-group-writeable-how-do-i-stop-this)\n" +
"* [Why doesn't chezmoi use symlinks like GNU Stow?](#why-doesnt-chezmoi-use-symlinks-like-gnu-stow)\n" +
"* [Do I have to use `chezmoi edit` to edit my dotfiles?](#do-i-have-to-use-chezmoi-edit-to-edit-my-dotfiles)\n" +
"* [Can I change how chezmoi's source state is represented on disk?](#can-i-change-how-chezmois-source-state-is-represented-on-disk)\n" +
"* [gpg encryption fails. What could be wrong?](#gpg-encryption-fails-what-could-be-wrong)\n" +
"* [chezmoi reports \"user: lookup userid NNNNN: input/output error\"](#chezmoi-reports-user-lookup-userid-nnnnn-inputoutput-error)\n" +
"* [I'm getting errors trying to build chezmoi from source](#im-getting-errors-trying-to-build-chezmoi-from-source)\n" +
"* [What inspired chezmoi?](#what-inspired-chezmoi)\n" +
"* [Why not use Ansible/Chef/Puppet/Salt, or similar to manage my dotfiles instead?](#why-not-use-ansiblechefpuppetsalt-or-similar-to-manage-my-dotfiles-instead)\n" +
"* [Can I use chezmoi to manage files outside my home directory?](#can-i-use-chezmoi-to-manage-files-outside-my-home-directory)\n" +
"* [Where does the name \"chezmoi\" come from?](#where-does-the-name-chezmoi-come-from)\n" +
"* [What other questions have been asked about chezmoi?](#what-other-questions-have-been-asked-about-chezmoi)\n" +
"* [Where do I ask a question that isn't answered here?](#where-do-i-ask-a-question-that-isnt-answered-here)\n" +
"* [I like chezmoi. How do I say thanks?](#i-like-chezmoi-how-do-i-say-thanks)\n" +
"\n" +
"## How can I quickly check for problems with chezmoi on my machine?\n" +
"\n" +
"Run:\n" +
"\n" +
" chezmoi doctor\n" +
"\n" +
"Anything `ok` is fine, anything `warning` is only a problem if you want to use\n" +
"the related feature, and anything `error` indicates a definite problem.\n" +
"\n" +
"## What are the consequences of \"bare\" modifications to the target files? If my `.zshrc` is managed by chezmoi and I edit `~/.zshrc` without using `chezmoi edit`, what happens?\n" +
"\n" +
"chezmoi will overwrite the file the next time you run `chezmoi apply`. Until you\n" +
"run `chezmoi apply` your modified `~/.zshrc` will remain in place.\n" +
"\n" +
"## How can I tell what dotfiles in my home directory aren't managed by chezmoi? Is there an easy way to have chezmoi manage a subset of them?\n" +
"\n" +
"`chezmoi unmanaged` will list everything not managed by chezmoi. You can add\n" +
"entire directories with `chezmoi add -r`.\n" +
"\n" +
"## How can I tell what dotfiles in my home directory are currently managed by chezmoi?\n" +
"\n" +
"`chezmoi managed` will list everything managed by chezmoi.\n" +
"\n" +
"## If there's a mechanism in place for the above, is there also a way to tell chezmoi to ignore specific files or groups of files (e.g. by directory name or by glob)?\n" +
"\n" +
"By default, chezmoi ignores everything that you haven't explicitly `chezmoi\n" +
"add`'ed. If you have files in your source directory that you don't want added to\n" +
"your destination directory when you run `chezmoi apply` add their names to a\n" +
"file called `.chezmoiignore` in the source state.\n" +
"\n" +
"Patterns are supported, and you can change what's ignored from machine to\n" +
"machine. The full usage and syntax is described in the [reference\n" +
"manual](https://github.com/twpayne/chezmoi/blob/master/docs/REFERENCE.md#chezmoiignore).\n" +
"\n" +
"## If the target already exists, but is \"behind\" the source, can chezmoi be configured to preserve the target version before replacing it with one derived from the source?\n" +
"\n" +
"Yes. Run `chezmoi add` will update the source state with the target. To see\n" +
"diffs of what would change, without actually changing anything, use `chezmoi\n" +
"diff`.\n" +
"\n" +
"## Once I've made a change to the source directory, how do I commit it?\n" +
"\n" +
"You have several options:\n" +
"\n" +
"* `chezmoi cd` opens a shell in the source directory, where you can run your\n" +
" usual version control commands, like `git add` and `git commit`.\n" +
"* `chezmoi git` and `chezmoi hg` run `git` and `hg` respectively in the source\n" +
" directory and pass extra arguments to the command. If you're passing any\n" +
" flags, you'll need to use `--` to prevent chezmoi from consuming them, for\n" +
" example `chezmoi git -- commit -m \"Update dotfiles\"`.\n" +
"* `chezmoi source` runs your configured version control system in your source\n" +
" directory. It works in the same way as the `chezmoi git` and `chezmoi hg`\n" +
" commands, but uses `sourceVCS.command`.\n" +
"\n" +
"## How do I only run a script when a file has changed?\n" +
"\n" +
"A common example of this is that you're using [Homebrew](https://brew.sh/) and\n" +
"have `.Brewfile` listing all the packages that you want installed and only want\n" +
"to run `brew bundle --global` when the contents of `.Brewfile` have changed.\n" +
"\n" +
"chezmoi has two types of scripts: scripts that run every time, and scripts that\n" +
"only run when their contents change. chezmoi does not have a mechanism to run a\n" +
"script when an arbitrary file has changed, but there are some ways to achieve\n" +
"the desired behavior:\n" +
"\n" +
"1. Have the script create `.Brewfile` instead of chezmoi, e.g. in your\n" +
" `run_once_install-packages`:\n" +
"\n" +
" ```sh\n" +
" #!/bin/sh\n" +
"\n" +
" cat > $HOME/.Brewfile <<EOF\n" +
" brew \"imagemagick\"\n" +
" brew \"openssl\"\n" +
" EOF\n" +
"\n" +
" brew bundle --global\n" +
" ```\n" +
"\n" +
"2. Don't use `.Brewfile`, and instead install the packages explicitly in\n" +
" `run_once_install-packages`:\n" +
"\n" +
" ```sh\n" +
" #!/bin/sh\n" +
"\n" +
" brew install imagemagick || true\n" +
" brew install openssl || true\n" +
" ```\n" +
"\n" +
" The `|| true` is necessary because `brew install` exits with failure if the\n" +
" package is already installed.\n" +
"\n" +
"3. Use a script that runs every time (not just once) and rely on `brew bundle\n" +
" --global` being idempotent.\n" +
"\n" +
"4. Use a script that runs every time, records a checksum of `.Brewfile` in\n" +
" another file, and only runs `brew bundle --global` if the checksum has\n" +
" changed, and updates the recorded checksum after.\n" +
"\n" +
"## I've made changes to both the destination state and the source state that I want to keep. How can I keep them both?\n" +
"\n" +
"`chezmoi merge` will open a merge tool to resolve differences between the source\n" +
"state, target state, and destination state. Copy the changes you want to keep in\n" +
"to the source state.\n" +
"\n" +
"## Why does chezmoi convert all my template variables to lowercase?\n" +
"\n" +
"This is due to a feature in\n" +
"[`github.com/spf13/viper`](https://github.com/spf13/viper), the library that\n" +
"chezmoi uses to read its configuration file. For more information see [this\n" +
"GitHub issue](https://github.com/twpayne/chezmoi/issues/463).\n" +
"\n" +
"## chezmoi makes `~/.ssh/config` group writeable. How do I stop this?\n" +
"\n" +
"By default, chezmoi uses your system's umask when creating files. On most\n" +
"systems the default umask is `022` but some systems use `002`, which means\n" +
"that files and directories are group writeable by default.\n" +
"\n" +
"You can override this for chezmoi by setting the `umask` configuration variable\n" +
"in your configuration file, for example:\n" +
"\n" +
" umask = 0o022\n" +
"\n" +
"Note that this will apply to all files and directories that chezmoi manages and\n" +
"will ensure that none of them are group writeable. It is not currently possible\n" +
"to control group write permissions for individual files or directories. Please\n" +
"[open an issue on\n" +
"GitHub](https://github.com/twpayne/chezmoi/issues/new?assignees=&labels=enhancement&template=02_feature_request.md&title=)\n" +
"if you need this.\n" +
"\n" +
"## Why doesn't chezmoi use symlinks like GNU Stow?\n" +
"\n" +
"Symlinks are first class citizens in chezmoi: chezmoi supports creating them,\n" +
"updating them, removing them, and even more advanced features not found\n" +
"elsewhere like having the same symlink point to different targets on different\n" +
"machines by using templates.\n" +
"\n" +
"With chezmoi, you only use symlinks where you really need a symlink, in contrast\n" +
"to some other dotfile managers (e.g. GNU Stow) which require the use of symlinks\n" +
"as a layer of indirection between a dotfile's location (which can be anywhere in\n" +
"your home directory) and a dotfile's content (which needs to be in a centralized\n" +
"directory that you manage with version control). chezmoi solves this problem in\n" +
"a different way.\n" +
"\n" +
"Instead of using a symlink to redirect from the dotfile's location to the\n" +
"centralized directory, chezmoi generates the dotfile in its final location from\n" +
"the contents of the centralized directory. Not only is no symlink is needed,\n" +
"this has the advantages that chezmoi is better able to cope with differences\n" +
"from machine to machine (as a dotfile's contents can be unique to that machine)\n" +
"and the dotfiles that chezmoi creates are just regular files. There's nothing\n" +
"special about dotfiles managed by chezmoi, whereas dotfiles managed with GNU\n" +
"Stow are special because they're actually symlinks to somewhere else.\n" +
"\n" +
"The only advantage to using GNU Stow-style symlinks is that changes that you\n" +
"make to the dotfile's contents in the centralized directory are immediately\n" +
"visible, whereas chezmoi currently requires you to run `chezmoi apply` or\n" +
"`chezmoi edit --apply`. chezmoi will likely get an alternative solution to this\n" +
"too, see [#752](https://github.com/twpayne/chezmoi/issues/752).\n" +
"\n" +
"You can configure chezmoi to work like GNU Stow and have it create a set of\n" +
"symlinks back to a central directory, but this currently requires a bit of\n" +
"manual work (as described in\n" +
"[#167](https://github.com/twpayne/chezmoi/issues/167)). chezmoi might get some\n" +
"automation to help (see [#886](https://github.com/twpayne/chezmoi/issues/886)\n" +
"for example) but it does need some convincing use cases that demonstrate that a\n" +
"symlink from a dotfile's location to its contents in a central directory is\n" +
"better than just having the correct dotfile contents.\n" +
"\n" +
"## Do I have to use `chezmoi edit` to edit my dotfiles?\n" +
"\n" +
"No. `chezmoi edit` is a convenience command that has a couple of useful\n" +
"features, but you don't have to use it. You can also run `chezmoi cd` and then\n" +
"just edit the files in the source state directly. After saving an edited file\n" +
"you can run `chezmoi diff` to check what effect the changes would have, and run\n" +
"`chezmoi apply` if you're happy with them.\n" +
"\n" +
"`chezmoi edit` provides the following useful features:\n" +
"* It opens the correct file in the source state for you, so you don't have to\n" +
" know anything about source state attributes.\n" +
"* If the dotfille is encrypted in the source state, then `chezmoi edit` will\n" +
" decrypt it to a private directory, open that file in your `$EDITOR`, and then\n" +
" re-encrypt the file when you quit your editor. That makes encryption more\n" +
" transparent to the user. With the `--diff` and `--apply` options you can see what\n" +
" would change and apply those changes without having to run `chezmoi diff` or\n" +
" `chezmoi apply`. Note also that the arguments to `chezmoi edit` are the files in\n" +
" their target location.\n" +
"\n" +
"## Can I change how chezmoi's source state is represented on disk?\n" +
"\n" +
"There are a number of criticisms of how chezmoi's source state is represented on\n" +
"disk:\n" +
"\n" +
"1. The source file naming system cannot handle all possible filenames.\n" +
"2. Not all possible file permissions can be represented.\n" +
"3. The long source file names are verbose.\n" +
"4. Everything is in a single directory, which can end up containing many entries.\n" +
"\n" +
"chezmoi's source state representation is a deliberate, practical compromise.\n" +
"\n" +
"Certain target filenames, for example `~/dot_example`, are incompatible with\n" +
"chezmoi's\n" +
"[attributes](https://github.com/twpayne/chezmoi/blob/master/docs/REFERENCE.md#source-state-attributes)\n" +
"used in the source state. In practice, dotfile filenames are unlikely to\n" +
"conflict with chezmoi's attributes. If this does cause a genuine problem for\n" +
"you, please [open an issue on\n" +
"GitHub](https://github.com/twpayne/chezmoi/issues/new/choose).\n" +
"\n" +
"The `dot_` attribute makes it transparent which dotfiles are managed by chezmoi\n" +
"and which files are ignored by chezmoi. chezmoi ignores all files and\n" +
"directories that start with `.` so no special whitelists are needed for version\n" +
"control systems and their control files (e.g. `.git` and `.gitignore`).\n" +
"\n" +
"chezmoi needs per-file metadata to know how to interpret the source file's\n" +
"contents, for example to know when the source file is a template or if the\n" +
"file's contents are encrypted. By storing this metadata in the filename, the\n" +
"metadata is unambiguously associated with a single file and adding, updating, or\n" +
"removing a single file touches only a single file in the source state. Changes\n" +
"to the metadata (e.g. `chezmoi chattr +template *target*`) are simple file\n" +
"renames and isolated to the affected file.\n" +
"\n" +
"If chezmoi were to, say, use a common configuration file listing which files\n" +
"were templates and/or encrypted, then changes to any file would require updates\n" +
"to the common configuration file. Automating updates to configuration files\n" +
"requires a round trip (read config file, update config, write config) and it is\n" +
"not always possible preserve comments and formatting.\n" +
"\n" +
"chezmoi's attributes of `executable_` and `private_` only allow a the file\n" +
"permissions `0o644`, `0o755`, `0o600`, and `0o700` to be represented.\n" +
"Directories can only have permissions `0o755` or `0o700`. In practice, these\n" +
"cover all permissions typically used for dotfiles. If this does cause a genuine\n" +
"problem for you, please [open an issue on\n" +
"GitHub](https://github.com/twpayne/chezmoi/issues/new/choose).\n" +
"\n" +
"File permissions and modes like `executable_`, `private_`, and `symlink_` could\n" +
"also be stored in the filesystem, rather than in the filename. However, this\n" +
"requires the permissions to be preserved and handled by the underlying version\n" +
"control system and filesystem. chezmoi provides first-class support for Windows,\n" +
"where the `executable_` and `private_` attributes have no direct equivalents and\n" +
"symbolic links are not always permitted. Some version control systems do not\n" +
"preserve file permissions or handle symbolic links. By using regular files and\n" +
"directories, chezmoi avoids variations in the operating system, version control\n" +
"system, and filesystem making it both more robust and more portable.\n" +
"\n" +
"chezmoi uses a 1:1 mapping between entries in the source state and entries in\n" +
"the target state. This mapping is bi-directional and unambiguous.\n" +
"\n" +
"However, this also means that dotfiles that in the same directory in the target\n" +
"state must be in the same directory in the source state. In particular, every\n" +
"entry managed by chezmoi in the root of your home directory has a corresponding\n" +
"entry in the root of your source directory, which can mean that you end up with\n" +
"a lot of entries in the root of your source directory.\n" +
"\n" +
"If chezmoi were to permit, say, multiple separate source directories (so you\n" +
"could, say, put `dot_bashrc` in a `bash/` subdirectory, and `dot_vimrc` in a\n" +
"`vim/` subdirectory, but have `chezmoi apply` map these to `~/.bashrc` and\n" +
"`~/.vimrc` in the root of your home directory) then the mapping between source\n" +
"and target states is no longer bidirectional nor unambiguous, which\n" +
"significantly increases complexity and requires more user interaction. For\n" +
"example, if both `bash/dot_bashrc` and `vim/dot_bashrc` exist, what should be\n" +
"the contents of `~/.bashrc`? If you run `chezmoi add ~/.zshrc`, should\n" +
"`dot_zshrc` be stored in the source `bash/` directory, the source `vim/`\n" +
"directory, or somewhere else? How does the user communicate their preferences?\n" +
"\n" +
"chezmoi has many users and any changes to the source state representation must\n" +
"be backwards-compatible.\n" +
"\n" +
"In summary, chezmoi's source state representation is a compromise with both\n" +
"advantages and disadvantages. Changes to the representation will be considered,\n" +
"but must meet the following criteria, in order of importance:\n" +
"\n" +
"1. Be fully backwards-compatible for existing users.\n" +
"2. Fix a genuine problem encountered in practice.\n" +
"3. Be independent of the underlying operating system, version control system, and\n" +
" filesystem.\n" +
"4. Not add significant extra complexity to the user interface or underlying\n" +
" implementation.\n" +
"\n" +
"## gpg encryption fails. What could be wrong?\n" +
"\n" +
"The `gpg.recipient` key should be ultimately trusted, otherwise encryption will\n" +
"fail because gpg will prompt for input, which chezmoi does not handle. You can\n" +
"check the trust level by running:\n" +
"\n" +
" gpg --export-ownertrust\n" +
"\n" +
"The trust level for the recipient's key should be `6`. If it is not, you can\n" +
"change the trust level by running:\n" +
"\n" +
" gpg --edit-key $recipient\n" +
"\n" +
"Enter `trust` at the prompt and chose `5 = I trust ultimately`.\n" +
"\n" +
"## chezmoi reports \"user: lookup userid NNNNN: input/output error\"\n" +
"\n" +
"This is likely because the chezmoi binary you are using was statically compiled\n" +
"with [musl](https://musl.libc.org/) and the machine you are running on uses\n" +
"LDAP or NIS.\n" +
"\n" +
"The immediate fix is to use a package built for your distriubtion (e.g a `.deb`\n" +
"or `.rpm`) which is linked against glibc and includes LDAP/NIS support instead\n" +
"of the statically-compiled binary.\n" +
"\n" +
"If the problem still persists, then please [open an issue on\n" +
"GitHub](https://github.com/twpayne/chezmoi/issues/new/choose).\n" +
"\n" +
"## I'm getting errors trying to build chezmoi from source\n" +
"\n" +
"chezmoi requires Go version 1.14 or later and Go modules enabled. You can check\n" +
"the version of Go with:\n" +
"\n" +
" go version\n" +
"\n" +
"Enable Go modules by setting `GO111MODULE=on` when running `go get`:\n" +
"\n" +
" GO111MODULE=on go get -u github.com/twpayne/chezmoi\n" +
"\n" +
"For more details on building chezmoi, see the [Contributing\n" +
"Guide](CONTRIBUTING.md).\n" +
"\n" +
"## What inspired chezmoi?\n" +
"\n" +
"chezmoi was inspired by [Puppet](https://puppet.com/), but created because\n" +
"Puppet is a slow overkill for managing your personal configuration files. The\n" +
"focus of chezmoi will always be personal home directory management. If your\n" +
"needs grow beyond that, switch to a whole system configuration management tool.\n" +
"\n" +
"## Why not use Ansible/Chef/Puppet/Salt, or similar to manage my dotfiles instead?\n" +
"\n" +
"Whole system management tools are more than capable of managing your dotfiles,\n" +
"but are large systems that entail several disadvantages. Compared to whole\n" +
"system management tools, chezmoi offers:\n" +
"\n" +
"* Small, focused feature set designed for dotfiles. There's simply less to learn\n" +
" with chezmoi compared to whole system management tools.\n" +
"* Easy installation and execution on every platform, without root access.\n" +
" Installing chezmoi requires only copying a single binary file with no external\n" +
" dependencies. Executing chezmoi just involves running the binary. In contrast,\n" +
" installing and running a whole system management tools typically requires\n" +
" installing a scripting language runtime, several packages, and running a\n" +
" system service, all typically requiring root access.\n" +
"\n" +
"chezmoi's focus and simple installation means that it runs almost everywhere:\n" +
"from tiny ARM-based Linux systems to Windows desktops, from inside lightweight\n" +
"containers to FreeBSD-based virtual machines in the cloud.\n" +
"\n" +
"## Can I use chezmoi to manage files outside my home directory?\n" +
"\n" +
"In practice, yes, you can, but this is strongly discouraged beyond using your\n" +
"system's package manager to install the packages you need.\n" +
"\n" +
"chezmoi is designed to operate on your home directory, and is explicitly not a\n" +
"full system configuration management tool. That said, there are some ways to\n" +
"have chezmoi manage a few files outside your home directory.\n" +
"\n" +
"chezmoi's scripts can execute arbitrary commands, so you can use a `run_` script\n" +
"that is run every time you run `chezmoi apply`, to, for example:\n" +
"\n" +
"* Make the target file outside your home directory a symlink to a file managed\n" +
" by chezmoi in your home directory.\n" +
"* Copy a file managed by chezmoi inside your home directory to the target file.\n" +
"* Execute a template with `chezmoi execute-template --output=filename template`\n" +
" where `filename` is outside the target directory.\n" +
"\n" +
"chezmoi executes all scripts as the user executing chezmoi, so you may need to\n" +
"add extra privilege elevation commands like `sudo` or `PowerShell start -verb\n" +
"runas -wait` to your script.\n" +
"\n" +
"chezmoi, by default, operates on your home directory but this can be overridden\n" +
"with the `--destination` command line flag or by specifying `destDir` in your\n" +
"config file, and could even be the root directory (`/` or `C:\\`). This allows\n" +
"you, in theory, to use chezmoi to manage any file in your filesystem, but this\n" +
"usage is extremely strongly discouraged.\n" +
"\n" +
"If your needs extend beyond modifying a handful of files outside your target\n" +
"system, then existing configuration management tools like\n" +
"[Puppet](https://puppet.com/), [Chef](https://chef.io/),\n" +
"[Ansible](https://www.ansible.com/), and [Salt](https://www.saltstack.com/) are\n" +
"much better suited - and of course can be called from a chezmoi `run_` script.\n" +
"Put your Puppet Manifests, Chef Recipes, Ansible Modules, and Salt Modules in a\n" +
"directory ignored by `.chezmoiignore` so they do not pollute your home\n" +
"directory.\n" +
"\n" +
"## Where does the name \"chezmoi\" come from?\n" +
"\n" +
"\"chezmoi\" splits to \"chez moi\" and pronounced /ʃeɪ mwa/ (shay-moi) meaning \"at\n" +
"my house\" in French. It's seven letters long, which is an appropriate length for\n" +
"a command that is only run occasionally.\n" +
"\n" +
"## What other questions have been asked about chezmoi?\n" +
"\n" +
"See the [issues on\n" +
"GitHub](https://github.com/twpayne/chezmoi/issues?utf8=%E2%9C%93&q=is%3Aissue+sort%3Aupdated-desc+label%3Asupport).\n" +
"\n" +
"## Where do I ask a question that isn't answered here?\n" +
"\n" +
"Please [open an issue on GitHub](https://github.com/twpayne/chezmoi/issues/new/choose).\n" +
"\n" +
"## I like chezmoi. How do I say thanks?\n" +
"\n" +
"Thank you! chezmoi was written to scratch a personal itch, and I'm very happy\n" +
"that it's useful to you. Please give [chezmoi a star on\n" +
"GitHub](https://github.com/twpayne/chezmoi/stargazers), and if you're happy to\n" +
"share your public dotfile repo then [tag it with\n" +
"`chezmoi`](https://github.com/topics/chezmoi?o=desc&s=updated). [Contributions\n" +
"are very\n" +
"welcome](https://github.com/twpayne/chezmoi/blob/master/docs/CONTRIBUTING.md)\n" +
"and every [bug report, support request, and feature\n" +
"request](https://github.com/twpayne/chezmoi/issues/new/choose) helps make\n" +
"chezmoi better. Thank you :)\n" +
"\n")
assets["docs/HOWTO.md"] = []byte("" +
"# chezmoi How-To Guide\n" +
"\n" +
"<!--- toc --->\n" +
"* [Use a hosted repo to manage your dotfiles across multiple machines](#use-a-hosted-repo-to-manage-your-dotfiles-across-multiple-machines)\n" +
"* [Pull the latest changes from your repo and apply them](#pull-the-latest-changes-from-your-repo-and-apply-them)\n" +
"* [Pull the latest changes from your repo and see what would change, without actually applying the changes](#pull-the-latest-changes-from-your-repo-and-see-what-would-change-without-actually-applying-the-changes)\n" +
"* [Automatically commit and push changes to your repo](#automatically-commit-and-push-changes-to-your-repo)\n" +
"* [Use templates to manage files that vary from machine to machine](#use-templates-to-manage-files-that-vary-from-machine-to-machine)\n" +
"* [Use completely separate config files on different machines](#use-completely-separate-config-files-on-different-machines)\n" +
" * [Without using symlinks](#without-using-symlinks)\n" +
"* [Create a config file on a new machine automatically](#create-a-config-file-on-a-new-machine-automatically)\n" +
"* [Have chezmoi create a directory, but ignore its contents](#have-chezmoi-create-a-directory-but-ignore-its-contents)\n" +
"* [Ensure that a target is removed](#ensure-that-a-target-is-removed)\n" +
"* [Include a subdirectory from another repository, like Oh My Zsh](#include-a-subdirectory-from-another-repository-like-oh-my-zsh)\n" +
"* [Handle configuration files which are externally modified](#handle-configuration-files-which-are-externally-modified)\n" +
"* [Handle different file locations on different systems with the same contents](#handle-different-file-locations-on-different-systems-with-the-same-contents)\n" +
"* [Keep data private](#keep-data-private)\n" +
" * [Use Bitwarden to keep your secrets](#use-bitwarden-to-keep-your-secrets)\n" +
" * [Use gopass to keep your secrets](#use-gopass-to-keep-your-secrets)\n" +
" * [Use gpg to keep your secrets](#use-gpg-to-keep-your-secrets)\n" +
" * [Use KeePassXC to keep your secrets](#use-keepassxc-to-keep-your-secrets)\n" +
" * [Use a keyring to keep your secrets](#use-a-keyring-to-keep-your-secrets)\n" +
" * [Use LastPass to keep your secrets](#use-lastpass-to-keep-your-secrets)\n" +
" * [Use 1Password to keep your secrets](#use-1password-to-keep-your-secrets)\n" +
" * [Use pass to keep your secrets](#use-pass-to-keep-your-secrets)\n" +
" * [Use Vault to keep your secrets](#use-vault-to-keep-your-secrets)\n" +
" * [Use a generic tool to keep your secrets](#use-a-generic-tool-to-keep-your-secrets)\n" +
" * [Use templates variables to keep your secrets](#use-templates-variables-to-keep-your-secrets)\n" +
"* [Use scripts to perform actions](#use-scripts-to-perform-actions)\n" +
" * [Understand how scripts work](#understand-how-scripts-work)\n" +
" * [Install packages with scripts](#install-packages-with-scripts)\n" +
"* [Use chezmoi with GitHub Codespaces, Visual Studio Codespaces, Visual Studio Code Remote - Containers](#use-chezmoi-with-github-codespaces-visual-studio-codespaces-visual-studio-code-remote---containers)\n" +
"* [Detect Windows Subsystem for Linux (WSL)](#detect-windows-subsystem-for-linux-wsl)\n" +
"* [Run a PowerShell script as admin on Windows](#run-a-powershell-script-as-admin-on-windows)\n" +
"* [Import archives](#import-archives)\n" +
"* [Export archives](#export-archives)\n" +
"* [Use a non-git version control system](#use-a-non-git-version-control-system)\n" +
"* [Customize the `diff` command](#customize-the-diff-command)\n" +
"* [Use a merge tool other than vimdiff](#use-a-merge-tool-other-than-vimdiff)\n" +
"* [Migrate from a dotfile manager that uses symlinks](#migrate-from-a-dotfile-manager-that-uses-symlinks)\n" +
"\n" +
"## Use a hosted repo to manage your dotfiles across multiple machines\n" +
"\n" +
"chezmoi relies on your version control system and hosted repo to share changes\n" +
"across multiple machines. You should create a repo on the source code repository\n" +
"of your choice (e.g. [Bitbucket](https://bitbucket.org),\n" +
"[GitHub](https://github.com/), or [GitLab](https://gitlab.com), many people call\n" +
"their repo `dotfiles`) and push the repo in the source directory here. For\n" +
"example:\n" +
"\n" +
" chezmoi cd\n" +
" git remote add origin https://github.com/username/dotfiles.git\n" +
" git push -u origin master\n" +
" exit\n" +
"\n" +
"On another machine you can checkout this repo:\n" +
"\n" +
" chezmoi init https://github.com/username/dotfiles.git\n" +
"\n" +
"You can then see what would be changed:\n" +
"\n" +
" chezmoi diff\n" +
"\n" +
"If you're happy with the changes then apply them:\n" +
"\n" +
" chezmoi apply\n" +
"\n" +
"The above commands can be combined into a single init, checkout, and apply:\n" +
"\n" +
" chezmoi init --apply --verbose https://github.com/username/dotfiles.git\n" +
"\n" +
"## Pull the latest changes from your repo and apply them\n" +
"\n" +
"You can pull the changes from your repo and apply them in a single command:\n" +
"\n" +
" chezmoi update\n" +
"\n" +
"This runs `git pull --rebase` in your source directory and then `chezmoi apply`.\n" +
"\n" +
"## Pull the latest changes from your repo and see what would change, without actually applying the changes\n" +
"\n" +
"Run:\n" +
"\n" +
" chezmoi source pull -- --rebase && chezmoi diff\n" +
"\n" +
"This runs `git pull --rebase` in your source directory and `chezmoi\n" +
"diff` then shows the difference between the target state computed from your\n" +
"source directory and the actual state.\n" +
"\n" +
"If you're happy with the changes, then you can run\n" +
"\n" +
" chezmoi apply\n" +
"\n" +
"to apply them.\n" +
"\n" +
"## Automatically commit and push changes to your repo\n" +
"\n" +
"chezmoi can automatically commit and push changes to your source directory to\n" +
"your repo. This feature is disabled by default. To enable it, add the following\n" +
"to your config file:\n" +
"\n" +
" [sourceVCS]\n" +
" autoCommit = true\n" +
" autoPush = true\n" +
"\n" +
"Whenever a change is made to your source directory, chezmoi will commit the\n" +
"changes with an automatically-generated commit message (if `autoCommit` is true)\n" +
"and push them to your repo (if `autoPush` is true). `autoPush` implies\n" +
"`autoCommit`, i.e. if `autoPush` is true then chezmoi will auto-commit your\n" +
"changes. If you only set `autoCommit` to true then changes will be committed but\n" +
"not pushed.\n" +
"\n" +
"Be careful when using `autoPush`. If your dotfiles repo is public and you\n" +
"accidentally add a secret in plain text, that secret will be pushed to your\n" +
"public repo.\n" +
"\n" +
"## Use templates to manage files that vary from machine to machine\n" +
"\n" +
"The primary goal of chezmoi is to manage configuration files across multiple\n" +
"machines, for example your personal macOS laptop, your work Ubuntu desktop, and\n" +
"your work Linux laptop. You will want to keep much configuration the same across\n" +
"these, but also need machine-specific configurations for email addresses,\n" +
"credentials, etc. chezmoi achieves this functionality by using\n" +
"[`text/template`](https://pkg.go.dev/text/template) for the source state where\n" +
"needed.\n" +
"\n" +
"For example, your home `~/.gitconfig` on your personal machine might look like:\n" +
"\n" +
" [user]\n" +
" email = \"john@home.org\"\n" +
"\n" +
"Whereas at work it might be:\n" +
"\n" +
" [user]\n" +
" email = \"john.smith@company.com\"\n" +
"\n" +
"To handle this, on each machine create a configuration file called\n" +
"`~/.config/chezmoi/chezmoi.toml` defining variables that might vary from machine\n" +
"to machine. For example, for your home machine:\n" +
"\n" +
" [data]\n" +
" email = \"john@home.org\"\n" +
"\n" +
"Note that all variable names will be converted to lowercase. This is due to a\n" +
"feature of a library used by chezmoi.\n" +
"\n" +
"If you intend to store private data (e.g. access tokens) in\n" +
"`~/.config/chezmoi/chezmoi.toml`, make sure it has permissions `0600`.\n" +
"\n" +
"If you prefer, you can use any format supported by\n" +
"[Viper](https://github.com/spf13/viper) for your configuration file. This\n" +
"includes JSON, YAML, and TOML. Variable names must start with a letter and be\n" +
"followed by zero or more letters or digits.\n" +
"\n" +
"Then, add `~/.gitconfig` to chezmoi using the `--autotemplate` flag to turn it\n" +
"into a template and automatically detect variables from the `data` section\n" +
"of your `~/.config/chezmoi/chezmoi.toml` file:\n" +
"\n" +
" chezmoi add --autotemplate ~/.gitconfig\n" +
"\n" +
"You can then open the template (which will be saved in the file\n" +
"`~/.local/share/chezmoi/dot_gitconfig.tmpl`):\n" +
"\n" +
" chezmoi edit ~/.gitconfig\n" +
"\n" +
"The file should look something like:\n" +
"\n" +
" [user]\n" +
" email = \"{{ .email }}\"\n" +
"\n" +
"To disable automatic variable detection, use the `--template` or `-T` option to\n" +
"`chezmoi add` instead of `--autotemplate`.\n" +
"\n" +
"Templates are often used to capture machine-specific differences. For example,\n" +
"in your `~/.local/share/chezmoi/dot_bashrc.tmpl` you might have:\n" +
"\n" +
" # common config\n" +
" export EDITOR=vi\n" +
"\n" +
" # machine-specific configuration\n" +
" {{- if eq .chezmoi.hostname \"work-laptop\" }}\n" +
" # this will only be included in ~/.bashrc on work-laptop\n" +
" {{- end }}\n" +
"\n" +
"For a full list of variables, run:\n" +
"\n" +
" chezmoi data\n" +
"\n" +
"For more advanced usage, you can use the full power of the\n" +
"[`text/template`](https://pkg.go.dev/text/template) language. chezmoi includes\n" +
"all of the text functions from [sprig](http://masterminds.github.io/sprig/) and\n" +
"its own [functions for interacting with password\n" +
"managers](https://github.com/twpayne/chezmoi/blob/master/docs/REFERENCE.md#template-functions).\n" +
"\n" +
"Templates can be executed directly from the command line, without the need to\n" +
"create a file on disk, with the `execute-template` command, for example:\n" +
"\n" +
" chezmoi execute-template '{{ .chezmoi.os }}/{{ .chezmoi.arch }}'\n" +
"\n" +
"This is useful when developing or debugging templates.\n" +
"\n" +
"Some password managers allow you to store complete files. The files can be\n" +
"retrieved with chezmoi's template functions. For example, if you have a file\n" +
"stored in 1Password with the UUID `uuid` then you can retrieve it with the\n" +
"template:\n" +
"\n" +
" {{- onepasswordDocument \"uuid\" -}}\n" +
"\n" +
"The `-`s inside the brackets remove any whitespace before or after the template\n" +
"expression, which is useful if your editor has added any newlines.\n" +
"\n" +
"If, after executing the template, the file contents are empty, the target file\n" +
"will be removed. This can be used to ensure that files are only present on\n" +
"certain machines. If you want an empty file to be created anyway, you will need\n" +
"to give it an `empty_` prefix.\n" +
"\n" +
"For coarser-grained control of files and entire directories managed on different\n" +
"machines, or to exclude certain files completely, you can create\n" +
"`.chezmoiignore` files in the source directory. These specify a list of patterns\n" +
"that chezmoi should ignore, and are interpreted as templates. An example\n" +
"`.chezmoiignore` file might look like:\n" +
"\n" +
" README.md\n" +
" {{- if ne .chezmoi.hostname \"work-laptop\" }}\n" +
" .work # only manage .work on work-laptop\n" +
" {{- end }}\n" +
"\n" +
"The use of `ne` (not equal) is deliberate. What we want to achieve is \"only\n" +
"install `.work` if hostname is `work-laptop`\" but chezmoi installs everything by\n" +
"default, so we have to turn the logic around and instead write \"ignore `.work`\n" +
"unless the hostname is `work-laptop`\".\n" +
"\n" +
"Patterns can be excluded by prefixing them with a `!`, for example:\n" +
"\n" +
" f*\n" +
" !foo\n" +
"\n" +
"will ignore all files beginning with an `f` except `foo`.\n" +
"\n" +
"## Use completely separate config files on different machines\n" +
"\n" +
"chezmoi's template functionality allows you to change a file's contents based on\n" +
"any variable. For example, if you want `~/.bashrc` to be different on Linux and\n" +
"macOS you would create a file in the source state called `dot_bashrc.tmpl`\n" +
"containing:\n" +
"\n" +
"```\n" +
"{{ if eq .chezmoi.os \"darwin\" -}}\n" +
"# macOS .bashrc contents\n" +
"{{ else if eq .chezmoi.os \"linux\" -}}\n" +
"# Linux .bashrc contents\n" +
"{{ end -}}\n" +
"```\n" +
"\n" +
"However, if the differences between the two versions are so large that you'd\n" +
"prefer to use completely separate files in the source state, you can achieve\n" +
"this using a symbolic link template. Create the following files:\n" +
"\n" +
"`symlink_dot_bashrc.tmpl`:\n" +
"\n" +
"```\n" +
".bashrc_{{ .chezmoi.os }}\n" +
"```\n" +
"\n" +
"`dot_bashrc_darwin`:\n" +
"\n" +
"```\n" +
"# macOS .bashrc contents\n" +
"```\n" +
"\n" +
"`dot_bashrc_linux`:\n" +
"\n" +
"```\n" +
"# Linux .bashrc contents\n" +
"```\n" +
"\n" +
"`.chezmoiignore`\n" +
"\n" +
"```\n" +
"{{ if ne .chezmoi.os \"darwin\" }}\n" +
".bashrc_darwin\n" +
"{{ end }}\n" +
"{{ if ne .chezmoi.os \"linux\" }}\n" +
".bashrc_linux\n" +
"{{ end }}\n" +
"```\n" +
"\n" +
"This will make `~/.bashrc` a symlink to `.bashrc_darwin` on `darwin` and to\n" +
"`.bashrc_linux` on `linux`. The `.chezmoiignore` configuration ensures that only\n" +
"the OS-specific `.bashrc_os` file will be installed on each OS.\n" +
"\n" +
"### Without using symlinks\n" +
"\n" +
"The same thing can be achieved using the include function.\n" +
"\n" +
"`dot_bashrc.tmpl`\n" +
"\n" +
"\t{{ if eq .chezmoi.os \"darwin\" }}\n" +
"\t{{ include \".bashrc_darwin\" }}\n" +
"\t{{ end }}\n" +
"\t{{ if eq .chezmoi.os \"linux\" }}\n" +
"\t{{ include \".bashrc_linux\" }}\n" +
"\t{{ end }}\n" +
"\n" +