hash
stringlengths 40
40
| date
stringdate 2019-01-29 11:49:07
2025-03-22 03:23:55
| author
stringclasses 79
values | commit_message
stringlengths 14
85
| is_merge
bool 1
class | git_diff
stringlengths 210
1.63M
| type
stringclasses 8
values | masked_commit_message
stringlengths 8
79
|
|---|---|---|---|---|---|---|---|
98b6a393ef9a2f95aceec1161eb2ad26236fbdae
|
2021-11-28 16:23:22
|
Tom Payne
|
feat: Apply diff.exclude to all diffs
| false
|
diff --git a/docs/REFERENCE.md b/docs/REFERENCE.md
index e646934b741..6a2ee862627 100644
--- a/docs/REFERENCE.md
+++ b/docs/REFERENCE.md
@@ -375,7 +375,7 @@ The following configuration variables are available:
| | `command` | string | *none* | Shell to run in `cd` command |
| `diff` | `args` | []string | *see `diff` below* | Extra args to external diff command |
| | `command` | string | *none* | External diff command |
-| | `exclude` | []string | *none* | Entry types to exclude from diff |
+| | `exclude` | []string | *none* | Entry types to exclude from diffs |
| | `pager` | string | *none* | Diff-specific pager |
| `docs` | `maxWidth` | int | 80 | Maximum width of output |
| | `pager` | string | *none* | Docs-specific pager |
diff --git a/internal/chezmoi/entrytypeset.go b/internal/chezmoi/entrytypeset.go
index 4156cbe59b7..b25679fe3b0 100644
--- a/internal/chezmoi/entrytypeset.go
+++ b/internal/chezmoi/entrytypeset.go
@@ -58,6 +58,11 @@ func NewEntryTypeSet(bits EntryTypeBits) *EntryTypeSet {
}
}
+// Include returns if s includes b.
+func (s *EntryTypeSet) Include(b EntryTypeBits) bool {
+ return s.bits&b != 0
+}
+
// IncludeEncrypted returns true if s includes encrypted files.
func (s *EntryTypeSet) IncludeEncrypted() bool {
return s.bits&EntryTypeEncrypted != 0
diff --git a/internal/chezmoi/gitdiffsystem.go b/internal/chezmoi/gitdiffsystem.go
index 3940b3c45db..e12207af4e3 100644
--- a/internal/chezmoi/gitdiffsystem.go
+++ b/internal/chezmoi/gitdiffsystem.go
@@ -18,6 +18,7 @@ import (
type GitDiffSystem struct {
system System
dirAbsPath AbsPath
+ include *EntryTypeSet
reverse bool
unifiedEncoder *diff.UnifiedEncoder
}
@@ -25,6 +26,7 @@ type GitDiffSystem struct {
// GetDiffSystemOptions are options for NewGitDiffSystem.
type GitDiffSystemOptions struct {
Color bool
+ Include *EntryTypeSet
Reverse bool
}
@@ -39,6 +41,7 @@ func NewGitDiffSystem(system System, w io.Writer, dirAbsPath AbsPath, options *G
return &GitDiffSystem{
system: system,
dirAbsPath: dirAbsPath,
+ include: options.Include,
reverse: options.Reverse,
unifiedEncoder: unifiedEncoder,
}
@@ -50,17 +53,19 @@ func (s *GitDiffSystem) Chmod(name AbsPath, mode fs.FileMode) error {
if err != nil {
return err
}
- toMode := fromInfo.Mode().Type() | mode
- var toData []byte
- if fromInfo.Mode().IsRegular() {
- toData, err = s.ReadFile(name)
- if err != nil {
+ if s.include.IncludeFileInfo(fromInfo) {
+ toMode := fromInfo.Mode().Type() | mode
+ var toData []byte
+ if fromInfo.Mode().IsRegular() {
+ toData, err = s.ReadFile(name)
+ if err != nil {
+ return err
+ }
+ }
+ if err := s.encodeDiff(name, toData, toMode); err != nil {
return err
}
}
- if err := s.encodeDiff(name, toData, toMode); err != nil {
- return err
- }
return s.system.Chmod(name, mode)
}
@@ -92,8 +97,10 @@ func (s *GitDiffSystem) Lstat(name AbsPath) (fs.FileInfo, error) {
// Mkdir implements System.Mkdir.
func (s *GitDiffSystem) Mkdir(name AbsPath, perm fs.FileMode) error {
- if err := s.encodeDiff(name, nil, fs.ModeDir|perm); err != nil {
- return err
+ if s.include.Include(EntryTypeDirs) {
+ if err := s.encodeDiff(name, nil, fs.ModeDir|perm); err != nil {
+ return err
+ }
}
return s.system.Mkdir(name, perm)
}
@@ -120,51 +127,57 @@ func (s *GitDiffSystem) Readlink(name AbsPath) (string, error) {
// RemoveAll implements System.RemoveAll.
func (s *GitDiffSystem) RemoveAll(name AbsPath) error {
- if err := s.encodeDiff(name, nil, 0); err != nil {
- return err
+ if s.include.Include(EntryTypeRemove) {
+ if err := s.encodeDiff(name, nil, 0); err != nil {
+ return err
+ }
}
return s.system.RemoveAll(name)
}
// Rename implements System.Rename.
func (s *GitDiffSystem) Rename(oldpath, newpath AbsPath) error {
- var fileMode filemode.FileMode
- var hash plumbing.Hash
- switch fromFileInfo, err := s.Stat(oldpath); {
- case err != nil:
+ fromFileInfo, err := s.Stat(oldpath)
+ if err != nil {
return err
- case fromFileInfo.Mode().IsDir():
- hash = plumbing.ZeroHash // LATER be more intelligent here
- case fromFileInfo.Mode().IsRegular():
- data, err := s.system.ReadFile(oldpath)
- if err != nil {
- return err
- }
- hash = plumbing.ComputeHash(plumbing.BlobObject, data)
- default:
- fileMode = filemode.FileMode(fromFileInfo.Mode())
- }
- fromPath, toPath := s.trimPrefix(oldpath), s.trimPrefix(newpath)
- if s.reverse {
- fromPath, toPath = toPath, fromPath
}
- if err := s.unifiedEncoder.Encode(&gitDiffPatch{
- filePatches: []diff.FilePatch{
- &gitDiffFilePatch{
- from: &gitDiffFile{
- fileMode: fileMode,
- relPath: fromPath,
- hash: hash,
- },
- to: &gitDiffFile{
- fileMode: fileMode,
- relPath: toPath,
- hash: hash,
+ if s.include.IncludeFileInfo(fromFileInfo) {
+ var fileMode filemode.FileMode
+ var hash plumbing.Hash
+ switch {
+ case fromFileInfo.Mode().IsDir():
+ hash = plumbing.ZeroHash // LATER be more intelligent here
+ case fromFileInfo.Mode().IsRegular():
+ data, err := s.system.ReadFile(oldpath)
+ if err != nil {
+ return err
+ }
+ hash = plumbing.ComputeHash(plumbing.BlobObject, data)
+ default:
+ fileMode = filemode.FileMode(fromFileInfo.Mode())
+ }
+ fromPath, toPath := s.trimPrefix(oldpath), s.trimPrefix(newpath)
+ if s.reverse {
+ fromPath, toPath = toPath, fromPath
+ }
+ if err := s.unifiedEncoder.Encode(&gitDiffPatch{
+ filePatches: []diff.FilePatch{
+ &gitDiffFilePatch{
+ from: &gitDiffFile{
+ fileMode: fileMode,
+ relPath: fromPath,
+ hash: hash,
+ },
+ to: &gitDiffFile{
+ fileMode: fileMode,
+ relPath: toPath,
+ hash: hash,
+ },
},
},
- },
- }); err != nil {
- return err
+ }); err != nil {
+ return err
+ }
}
return s.system.Rename(oldpath, newpath)
}
@@ -181,17 +194,19 @@ func (s *GitDiffSystem) RunIdempotentCmd(cmd *exec.Cmd) error {
// RunScript implements System.RunScript.
func (s *GitDiffSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error {
- mode := fs.FileMode(filemode.Executable)
- fromData, toData := []byte(nil), data
- if s.reverse {
- fromData, toData = toData, fromData
- }
- diffPatch, err := DiffPatch(scriptname, fromData, mode, toData, mode)
- if err != nil {
- return err
- }
- if err := s.unifiedEncoder.Encode(diffPatch); err != nil {
- return err
+ if s.include.Include(EntryTypeScripts) {
+ mode := fs.FileMode(filemode.Executable)
+ fromData, toData := []byte(nil), data
+ if s.reverse {
+ fromData, toData = toData, fromData
+ }
+ diffPatch, err := DiffPatch(scriptname, fromData, mode, toData, mode)
+ if err != nil {
+ return err
+ }
+ if err := s.unifiedEncoder.Encode(diffPatch); err != nil {
+ return err
+ }
}
return s.system.RunScript(scriptname, dir, data, interpreter)
}
@@ -208,21 +223,25 @@ func (s *GitDiffSystem) UnderlyingFS() vfs.FS {
// WriteFile implements System.WriteFile.
func (s *GitDiffSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error {
- if err := s.encodeDiff(filename, data, perm); err != nil {
- return err
+ if s.include.Include(EntryTypeFiles) {
+ if err := s.encodeDiff(filename, data, perm); err != nil {
+ return err
+ }
}
return s.system.WriteFile(filename, data, perm)
}
// WriteSymlink implements System.WriteSymlink.
func (s *GitDiffSystem) WriteSymlink(oldname string, newname AbsPath) error {
- toData := append([]byte(normalizeLinkname(oldname)), '\n')
- toMode := fs.ModeSymlink
- if runtime.GOOS == "windows" {
- toMode |= 0o666
- }
- if err := s.encodeDiff(newname, toData, toMode); err != nil {
- return err
+ if s.include.Include(EntryTypeSymlinks) {
+ toData := append([]byte(normalizeLinkname(oldname)), '\n')
+ toMode := fs.ModeSymlink
+ if runtime.GOOS == "windows" {
+ toMode |= 0o666
+ }
+ if err := s.encodeDiff(newname, toData, toMode); err != nil {
+ return err
+ }
}
return s.system.WriteSymlink(oldname, newname)
}
diff --git a/internal/cmd/config.go b/internal/cmd/config.go
index a2d1d194d92..0b39bc57f40 100644
--- a/internal/cmd/config.go
+++ b/internal/cmd/config.go
@@ -1593,10 +1593,12 @@ func (c *Config) persistentPreRunRootE(cmd *cobra.Command, args []string) error
}
if c.Verbose {
c.sourceSystem = chezmoi.NewGitDiffSystem(c.sourceSystem, c.stdout, c.SourceDirAbsPath, &chezmoi.GitDiffSystemOptions{
- Color: color,
+ Color: color,
+ Include: c.Diff.include.Sub(c.Diff.Exclude),
})
c.destSystem = chezmoi.NewGitDiffSystem(c.destSystem, c.stdout, c.DestDirAbsPath, &chezmoi.GitDiffSystemOptions{
- Color: color,
+ Color: color,
+ Include: c.Diff.include.Sub(c.Diff.Exclude),
})
}
diff --git a/internal/cmd/diffcmd.go b/internal/cmd/diffcmd.go
index d9f3e86d095..2595cd7acae 100644
--- a/internal/cmd/diffcmd.go
+++ b/internal/cmd/diffcmd.go
@@ -52,6 +52,7 @@ func (c *Config) runDiffCmd(cmd *cobra.Command, args []string) (err error) {
color := c.Color.Value(c.colorAutoFunc)
gitDiffSystem := chezmoi.NewGitDiffSystem(dryRunSystem, &builder, c.DestDirAbsPath, &chezmoi.GitDiffSystemOptions{
Color: color,
+ Include: c.Diff.include.Sub(c.Diff.Exclude),
Reverse: c.Diff.reverse,
})
if err = c.applyArgs(cmd.Context(), gitDiffSystem, c.DestDirAbsPath, args, applyArgsOptions{
diff --git a/internal/cmd/testdata/scripts/applyverbose.txt b/internal/cmd/testdata/scripts/applyverbose.txt
new file mode 100644
index 00000000000..641af28b331
--- /dev/null
+++ b/internal/cmd/testdata/scripts/applyverbose.txt
@@ -0,0 +1,42 @@
+# test that chezmoi apply --dry-run --verbose does not show scripts when scripts are excluded from diffs
+chezmoi apply --dry-run --verbose
+[!windows] cmp stdout golden/apply
+[windows] cmp stdout golden/apply-windows
+
+chhome home2/user
+
+# test that chezmoi apply --dry-run --force --verbose does not show removes when removes are excluded from diffs
+chezmoi apply --dry-run --force --verbose
+! stdout .
+
+-- golden/apply --
+diff --git a/.file b/.file
+new file mode 100644
+index 0000000000000000000000000000000000000000..8a52cb9ce9551221716a53786ad74104c5902362
+--- /dev/null
++++ b/.file
+@@ -0,0 +1 @@
++# contents of .file
+-- golden/apply-windows --
+diff --git a/.file b/.file
+new file mode 100666
+index 0000000000000000000000000000000000000000..8a52cb9ce9551221716a53786ad74104c5902362
+--- /dev/null
++++ b/.file
+@@ -0,0 +1 @@
++# contents of .file
+-- home/user/.config/chezmoi/chezmoi.toml --
+[diff]
+ exclude = ["scripts"]
+-- home/user/.local/share/chezmoi/dot_file --
+# contents of .file
+-- home/user/.local/share/chezmoi/run_script --
+# contents of script
+-- home2/user/.config/chezmoi/chezmoi.yaml --
+diff:
+ exclude:
+ - remove
+-- home2/user/.file --
+# contents of .file
+-- home2/user/.local/share/chezmoi/.chezmoiremove --
+.file
|
feat
|
Apply diff.exclude to all diffs
|
d205ec416e38be63f5876293573afaa8d3f3e6c2
|
2022-05-30 13:36:04
|
Tom Payne
|
chore: Remove traces of TOML as an output format
| false
|
diff --git a/pkg/chezmoi/dumpsystem.go b/pkg/chezmoi/dumpsystem.go
index dc4beac46cf..9e999795e1e 100644
--- a/pkg/chezmoi/dumpsystem.go
+++ b/pkg/chezmoi/dumpsystem.go
@@ -28,39 +28,39 @@ type DumpSystem struct {
// A commandData contains data about a command.
type commandData struct {
- Type dataType `json:"type" toml:"type" yaml:"type"`
- Path string `json:"path" toml:"path" yaml:"path"`
- Args []string `json:"args" toml:"args" yaml:"args"`
+ Type dataType `json:"type" yaml:"type"`
+ Path string `json:"path" yaml:"path"`
+ Args []string `json:"args" yaml:"args"`
}
// A dirData contains data about a directory.
type dirData struct {
- Type dataType `json:"type" toml:"type" yaml:"type"`
- Name AbsPath `json:"name" toml:"name" yaml:"name"`
- Perm fs.FileMode `json:"perm" toml:"perm" yaml:"perm"`
+ Type dataType `json:"type" yaml:"type"`
+ Name AbsPath `json:"name" yaml:"name"`
+ Perm fs.FileMode `json:"perm" yaml:"perm"`
}
// A fileData contains data about a file.
type fileData struct {
- Type dataType `json:"type" toml:"type" yaml:"type"`
- Name AbsPath `json:"name" toml:"name" yaml:"name"`
- Contents string `json:"contents" toml:"contents" yaml:"contents"`
- Perm fs.FileMode `json:"perm" toml:"perm" yaml:"perm"`
+ Type dataType `json:"type" yaml:"type"`
+ Name AbsPath `json:"name" yaml:"name"`
+ Contents string `json:"contents" yaml:"contents"`
+ Perm fs.FileMode `json:"perm" yaml:"perm"`
}
// A scriptData contains data about a script.
type scriptData struct {
- Type dataType `json:"type" toml:"type" yaml:"type"`
- Name AbsPath `json:"name" toml:"name" yaml:"name"`
- Contents string `json:"contents" toml:"contents" yaml:"contents"`
- Interpreter *Interpreter `json:"interpreter,omitempty" toml:"interpreter,omitempty" yaml:"interpreter,omitempty"`
+ Type dataType `json:"type" yaml:"type"`
+ Name AbsPath `json:"name" yaml:"name"`
+ Contents string `json:"contents" yaml:"contents"`
+ Interpreter *Interpreter `json:"interpreter,omitempty" yaml:"interpreter,omitempty"`
}
// A symlinkData contains data about a symlink.
type symlinkData struct {
- Type dataType `json:"type" toml:"type" yaml:"type"`
- Name AbsPath `json:"name" toml:"name" yaml:"name"`
- Linkname string `json:"linkname" toml:"linkname" yaml:"linkname"`
+ Type dataType `json:"type" yaml:"type"`
+ Name AbsPath `json:"name" yaml:"name"`
+ Linkname string `json:"linkname" yaml:"linkname"`
}
// NewDumpSystem returns a new DumpSystem that accumulates data.
diff --git a/pkg/chezmoi/entrystate.go b/pkg/chezmoi/entrystate.go
index c326a88088a..49c46c2e430 100644
--- a/pkg/chezmoi/entrystate.go
+++ b/pkg/chezmoi/entrystate.go
@@ -25,9 +25,9 @@ const (
// An EntryState represents the state of an entry. A nil EntryState is
// equivalent to EntryStateTypeAbsent.
type EntryState struct {
- Type EntryStateType `json:"type" toml:"type" yaml:"type"`
- Mode fs.FileMode `json:"mode,omitempty" toml:"mode,omitempty" yaml:"mode,omitempty"`
- ContentsSHA256 HexBytes `json:"contentsSHA256,omitempty" toml:"contentsSHA256,omitempty" yaml:"contentsSHA256,omitempty"` //nolint:lll,tagliatelle
+ Type EntryStateType `json:"type" yaml:"type"`
+ Mode fs.FileMode `json:"mode,omitempty" yaml:"mode,omitempty"`
+ ContentsSHA256 HexBytes `json:"contentsSHA256,omitempty" yaml:"contentsSHA256,omitempty"` //nolint:tagliatelle
contents []byte
overwrite bool
}
diff --git a/pkg/chezmoi/persistentstate.go b/pkg/chezmoi/persistentstate.go
index af109c92e78..e2b1cda735e 100644
--- a/pkg/chezmoi/persistentstate.go
+++ b/pkg/chezmoi/persistentstate.go
@@ -61,9 +61,9 @@ func PersistentStateData(s PersistentState) (interface{}, error) {
return nil, err
}
return struct {
- ConfigState interface{} `json:"configState" toml:"configState" yaml:"configState"`
- EntryState interface{} `json:"entryState" toml:"entryState" yaml:"entryState"`
- ScriptState interface{} `json:"scriptState" toml:"scriptState" yaml:"scriptState"`
+ ConfigState interface{} `json:"configState" yaml:"configState"`
+ EntryState interface{} `json:"entryState" yaml:"entryState"`
+ ScriptState interface{} `json:"scriptState" yaml:"scriptState"`
}{
ConfigState: configStateData,
EntryState: entryStateData,
diff --git a/pkg/chezmoi/sourcestate.go b/pkg/chezmoi/sourcestate.go
index fb92b7f8d88..a857d1c96e8 100644
--- a/pkg/chezmoi/sourcestate.go
+++ b/pkg/chezmoi/sourcestate.go
@@ -70,9 +70,9 @@ type External struct {
// A externalCacheEntry is an external cache entry.
type externalCacheEntry struct {
- URL string `json:"url" toml:"url" time:"url"`
- Time time.Time `json:"time" toml:"time" yaml:"time"`
- Data []byte `json:"data" toml:"data" yaml:"data"`
+ URL string `json:"url" time:"url"`
+ Time time.Time `json:"time" yaml:"time"`
+ Data []byte `json:"data" yaml:"data"`
}
var externalCacheFormat = formatGzippedJSON{}
diff --git a/pkg/chezmoi/targetstateentry.go b/pkg/chezmoi/targetstateentry.go
index 2cd74d9cf2a..bcf38500e01 100644
--- a/pkg/chezmoi/targetstateentry.go
+++ b/pkg/chezmoi/targetstateentry.go
@@ -57,14 +57,14 @@ type TargetStateSymlink struct {
// A modifyDirWithCmdState records the state of a directory modified by a
// command.
type modifyDirWithCmdState struct {
- Name AbsPath `json:"name" toml:"name" yaml:"name"`
- RunAt time.Time `json:"runAt" toml:"runAt" yaml:"runAt"`
+ Name AbsPath `json:"name" yaml:"name"`
+ RunAt time.Time `json:"runAt" yaml:"runAt"`
}
// A scriptState records the state of a script that has been run.
type scriptState struct {
- Name RelPath `json:"name" toml:"name" yaml:"name"`
- RunAt time.Time `json:"runAt" toml:"runAt" yaml:"runAt"`
+ Name RelPath `json:"name" yaml:"name"`
+ RunAt time.Time `json:"runAt" yaml:"runAt"`
}
// Apply updates actualStateEntry to match t.
|
chore
|
Remove traces of TOML as an output format
|
e7e6932f344624e01c4ccf642f8871e818129de2
|
2021-11-27 01:22:57
|
Tom Payne
|
fix: Respect .chezmoiroot when generating config file
| false
|
diff --git a/internal/cmd/config.go b/internal/cmd/config.go
index 20800969bb1..a2d1d194d92 100644
--- a/internal/cmd/config.go
+++ b/internal/cmd/config.go
@@ -1117,9 +1117,14 @@ func (c *Config) filterInput(args []string, f func([]byte) ([]byte, error)) erro
// findFirstConfigTemplate searches for a config template, returning the path,
// format, and contents of the first one that it finds.
func (c *Config) findFirstConfigTemplate() (chezmoi.RelPath, string, []byte, error) {
+ sourceDirAbsPath, err := c.sourceDirAbsPath()
+ if err != nil {
+ return chezmoi.EmptyRelPath, "", nil, err
+ }
+
for _, ext := range viper.SupportedExts {
filename := chezmoi.NewRelPath(chezmoi.Prefix + "." + ext + chezmoi.TemplateSuffix)
- contents, err := c.baseSystem.ReadFile(c.SourceDirAbsPath.Join(filename))
+ contents, err := c.baseSystem.ReadFile(sourceDirAbsPath.Join(filename))
switch {
case errors.Is(err, fs.ErrNotExist):
continue
@@ -1350,13 +1355,9 @@ func (c *Config) newSourceState(
sourceStateLogger := c.logger.With().Str(logComponentKey, logComponentValueSourceState).Logger()
- sourceDirAbsPath := c.SourceDirAbsPath
- switch data, err := c.sourceSystem.ReadFile(c.SourceDirAbsPath.JoinString(chezmoi.RootName)); {
- case errors.Is(err, fs.ErrNotExist):
- case err != nil:
+ sourceDirAbsPath, err := c.sourceDirAbsPath()
+ if err != nil {
return nil, err
- default:
- sourceDirAbsPath = c.SourceDirAbsPath.JoinString(string(bytes.TrimSpace(data)))
}
s := chezmoi.NewSourceState(append([]chezmoi.SourceStateOption{
@@ -1814,6 +1815,19 @@ func (c *Config) sourceAbsPaths(sourceState *chezmoi.SourceState, args []string)
return sourceAbsPaths, nil
}
+// sourceDirAbsPath returns the source directory, using .chezmoiroot if it
+// exists.
+func (c *Config) sourceDirAbsPath() (chezmoi.AbsPath, error) {
+ switch data, err := c.sourceSystem.ReadFile(c.SourceDirAbsPath.JoinString(chezmoi.RootName)); {
+ case errors.Is(err, fs.ErrNotExist):
+ return c.SourceDirAbsPath, nil
+ case err != nil:
+ return chezmoi.EmptyAbsPath, err
+ default:
+ return c.SourceDirAbsPath.JoinString(string(bytes.TrimSpace(data))), nil
+ }
+}
+
type targetRelPathsOptions struct {
mustBeInSourceState bool
recursive bool
diff --git a/internal/cmd/testdata/scripts/root.txt b/internal/cmd/testdata/scripts/root.txt
index 0d19968de5e..47ace950cf4 100644
--- a/internal/cmd/testdata/scripts/root.txt
+++ b/internal/cmd/testdata/scripts/root.txt
@@ -20,6 +20,7 @@ exec git -C $HOME/repo commit -m 'Initial commit'
# test that chezmoi init uses .chezmoiroot
chezmoi init --apply file://$HOME/repo
+exists $CHEZMOICONFIGDIR/chezmoi.toml
cmp $HOME/.file golden/.file
-- golden/.file --
@@ -32,5 +33,6 @@ home
# contents of .file
-- home2/user/repo/.chezmoiroot --
home
+-- home2/user/repo/home/.chezmoi.toml.tmpl --
-- home2/user/repo/home/dot_file --
# contents of .file
|
fix
|
Respect .chezmoiroot when generating config file
|
71fb7bfb6e43667f6b615a0e6512866bee6bc606
|
2024-09-13 04:24:38
|
Tom Payne
|
chore: Update dependencies
| false
|
diff --git a/go.mod b/go.mod
index ca9e6f70bcb..a87c674bdc3 100644
--- a/go.mod
+++ b/go.mod
@@ -17,7 +17,7 @@ require (
github.com/bmatcuk/doublestar/v4 v4.6.1
github.com/bradenhilton/mozillainstallhash v1.0.1
github.com/charmbracelet/bubbles v0.20.0
- github.com/charmbracelet/bubbletea v1.1.0
+ github.com/charmbracelet/bubbletea v1.1.1
github.com/charmbracelet/glamour v0.8.0
github.com/coreos/go-semver v0.3.1
github.com/fsnotify/fsnotify v1.7.0
@@ -47,7 +47,7 @@ require (
go.etcd.io/bbolt v1.3.11
go.uber.org/automaxprocs v1.5.3
golang.org/x/crypto v0.27.0
- golang.org/x/crypto/x509roots/fallback v0.0.0-20240904212608-c9da6b9a4008
+ golang.org/x/crypto/x509roots/fallback v0.0.0-20240910204333-9e92970a1eb4
golang.org/x/oauth2 v0.23.0
golang.org/x/sync v0.8.0
golang.org/x/sys v0.25.0
@@ -89,7 +89,7 @@ require (
github.com/bradenhilton/cityhash v1.0.0 // indirect
github.com/charmbracelet/harmonica v0.2.0 // indirect
github.com/charmbracelet/lipgloss v0.13.0 // indirect
- github.com/charmbracelet/x/ansi v0.2.3 // indirect
+ github.com/charmbracelet/x/ansi v0.3.0 // indirect
github.com/charmbracelet/x/term v0.2.0 // indirect
github.com/cloudflare/circl v1.4.0 // indirect
github.com/creack/pty/v2 v2.0.0-20231209135443-03db72c7b76c // indirect
diff --git a/go.sum b/go.sum
index 7cf1856570b..56b1ca2eda1 100644
--- a/go.sum
+++ b/go.sum
@@ -111,16 +111,16 @@ github.com/bwesterb/go-ristretto v1.2.3 h1:1w53tCkGhCQ5djbat3+MH0BAQ5Kfgbt56UZQ/
github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
github.com/charmbracelet/bubbles v0.20.0 h1:jSZu6qD8cRQ6k9OMfR1WlM+ruM8fkPWkHvQWD9LIutE=
github.com/charmbracelet/bubbles v0.20.0/go.mod h1:39slydyswPy+uVOHZ5x/GjwVAFkCsV8IIVy+4MhzwwU=
-github.com/charmbracelet/bubbletea v1.1.0 h1:FjAl9eAL3HBCHenhz/ZPjkKdScmaS5SK69JAK2YJK9c=
-github.com/charmbracelet/bubbletea v1.1.0/go.mod h1:9Ogk0HrdbHolIKHdjfFpyXJmiCzGwy+FesYkZr7hYU4=
+github.com/charmbracelet/bubbletea v1.1.1 h1:KJ2/DnmpfqFtDNVTvYZ6zpPFL9iRCRr0qqKOCvppbPY=
+github.com/charmbracelet/bubbletea v1.1.1/go.mod h1:9Ogk0HrdbHolIKHdjfFpyXJmiCzGwy+FesYkZr7hYU4=
github.com/charmbracelet/glamour v0.8.0 h1:tPrjL3aRcQbn++7t18wOpgLyl8wrOHUEDS7IZ68QtZs=
github.com/charmbracelet/glamour v0.8.0/go.mod h1:ViRgmKkf3u5S7uakt2czJ272WSg2ZenlYEZXT2x7Bjw=
github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ=
github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=
github.com/charmbracelet/lipgloss v0.13.0 h1:4X3PPeoWEDCMvzDvGmTajSyYPcZM4+y8sCA/SsA3cjw=
github.com/charmbracelet/lipgloss v0.13.0/go.mod h1:nw4zy0SBX/F/eAO1cWdcvy6qnkDUxr8Lw7dvFrAIbbY=
-github.com/charmbracelet/x/ansi v0.2.3 h1:VfFN0NUpcjBRd4DnKfRaIRo53KRgey/nhOoEqosGDEY=
-github.com/charmbracelet/x/ansi v0.2.3/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
+github.com/charmbracelet/x/ansi v0.3.0 h1:CCsscv7vKC/DNYUYFQNNIOWzrpTUbLXL3d4fdFIQ0WE=
+github.com/charmbracelet/x/ansi v0.3.0/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
github.com/charmbracelet/x/exp/golden v0.0.0-20240815200342-61de596daa2b h1:MnAMdlwSltxJyULnrYbkZpp4k58Co7Tah3ciKhSNo0Q=
github.com/charmbracelet/x/exp/golden v0.0.0-20240815200342-61de596daa2b/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U=
github.com/charmbracelet/x/term v0.2.0 h1:cNB9Ot9q8I711MyZ7myUR5HFWL/lc3OpU8jZ4hwm0x0=
@@ -488,8 +488,8 @@ golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2Uz
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
-golang.org/x/crypto/x509roots/fallback v0.0.0-20240904212608-c9da6b9a4008 h1:vKHSxFhPLnBEYu9R8DcQ4gXq9EqU0VVhC9pq9wmtYsg=
-golang.org/x/crypto/x509roots/fallback v0.0.0-20240904212608-c9da6b9a4008/go.mod h1:kNa9WdvYnzFwC79zRpLRMJbdEFlhyM5RPFBBZp/wWH8=
+golang.org/x/crypto/x509roots/fallback v0.0.0-20240910204333-9e92970a1eb4 h1:2ET4PwUR2nlFyH11/NrFz+OHyYCrnI1Gz5diQ3ZRi8A=
+golang.org/x/crypto/x509roots/fallback v0.0.0-20240910204333-9e92970a1eb4/go.mod h1:kNa9WdvYnzFwC79zRpLRMJbdEFlhyM5RPFBBZp/wWH8=
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk=
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
chore
|
Update dependencies
|
ba186488bd165990033945357ab9589ba52dd35e
|
2023-08-22 00:25:18
|
Tom Payne
|
chore: Bump golangci-lint to version 1.54.2
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 0908268ae38..8d5e15abdc6 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -13,7 +13,7 @@ env:
AGE_VERSION: 1.1.1
GO_VERSION: 1.21.0
GOFUMPT_VERSION: 0.4.0
- GOLANGCI_LINT_VERSION: 1.54.0
+ GOLANGCI_LINT_VERSION: 1.54.2
GOLINES_VERSION: 0.11.0
GOVERSIONINFO_VERSION: 1.4.0
FINDTYPOS_VERSION: 0.0.1
|
chore
|
Bump golangci-lint to version 1.54.2
|
d6da479e158236e14c584f5a0e915c70bf3c8370
|
2022-10-18 02:21:07
|
dependabot[bot]
|
chore(deps): bump cpina/github-action-push-to-another-repository
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index ae4f42f2fb5..ccabcc0163a 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -437,7 +437,7 @@ jobs:
cp assets/scripts/install.ps1 assets/get.chezmoi.io/ps1
cp LICENSE assets/get.chezmoi.io/LICENSE
- name: push-get.chezmoi.io
- uses: cpina/github-action-push-to-another-repository@9e487f29582587eeb4837c0552c886bb0644b6b9
+ uses: cpina/github-action-push-to-another-repository@940a2857e598a6392bd336330b07416c1ae8ea1f
env:
SSH_DEPLOY_KEY: ${{ secrets.GET_CHEZMOI_IO_SSH_DEPLOY_KEY }}
with:
|
chore
|
bump cpina/github-action-push-to-another-repository
|
53bb61524468afe3262d6d8089fdc6912dbccb34
|
2021-11-07 22:34:07
|
Tom Payne
|
chore: Update dependencies
| false
|
diff --git a/go.mod b/go.mod
index c8fd791f6e4..0b0ba33f28a 100644
--- a/go.mod
+++ b/go.mod
@@ -41,9 +41,9 @@ require (
go.etcd.io/bbolt v1.3.6
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0
- golang.org/x/net v0.0.0-20211029224645-99673261e6eb // indirect
- golang.org/x/oauth2 v0.0.0-20211028175245-ba495a64dcb5
- golang.org/x/sys v0.0.0-20211031064116-611d5d643895
+ golang.org/x/net v0.0.0-20211105192438-b53810dc28af // indirect
+ golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
+ golang.org/x/sys v0.0.0-20211107104306-e0b2ad06fe42
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
diff --git a/go.sum b/go.sum
index 61e4730bc23..0896c31d82e 100644
--- a/go.sum
+++ b/go.sum
@@ -708,6 +708,8 @@ golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211029224645-99673261e6eb h1:pirldcYWx7rx7kE5r+9WsOXPXK0+WH5+uZ7uPmJ44uM=
golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20211105192438-b53810dc28af h1:SMeNJG/vclJ5wyBBd4xupMsSJIHTd1coW9g7q6KOjmY=
+golang.org/x/net v0.0.0-20211105192438-b53810dc28af/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -728,6 +730,8 @@ golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 h1:B333XXssMuKQeBwiNODx4T
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20211028175245-ba495a64dcb5 h1:v79phzBz03tsVCUTbvTBmmC3CUXF5mKYt7DA4ZVldpM=
golang.org/x/oauth2 v0.0.0-20211028175245-ba495a64dcb5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg=
+golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -815,6 +819,8 @@ golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 h1:2B5p2L5IfGiD7+b9BOoRMC6Dg
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211031064116-611d5d643895 h1:iaNpwpnrgL5jzWS0vCNnfa8HqzxveCFpFx3uC/X4Tps=
golang.org/x/sys v0.0.0-20211031064116-611d5d643895/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211107104306-e0b2ad06fe42 h1:G2DDmludOQZoWbpCr7OKDxnl478ZBGMcOhrv+ooX/Q4=
+golang.org/x/sys v0.0.0-20211107104306-e0b2ad06fe42/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
|
chore
|
Update dependencies
|
4b39f377ef7965f6126bed74f34aab1f07d7d73e
|
2022-05-23 02:59:49
|
Tom Payne
|
chore: Fix grammar typo
| false
|
diff --git a/assets/chezmoi.io/docs/reference/target-types.md b/assets/chezmoi.io/docs/reference/target-types.md
index d476c5a3d90..cb36200d247 100644
--- a/assets/chezmoi.io/docs/reference/target-types.md
+++ b/assets/chezmoi.io/docs/reference/target-types.md
@@ -32,7 +32,7 @@ unchanged.
Files with the `modify_` prefix are treated as scripts that modify an existing
file. The contents of the existing file (which maybe empty if the existing file
does not exist or is empty) are passed to the script's standard input, and the
-new contents are read from the scripts standard output.
+new contents are read from the script's standard output.
### Remove entry
|
chore
|
Fix grammar typo
|
10f1c1a0e8c97b3bd36180beec6827a4e92db369
|
2021-11-02 03:40:47
|
Tom Payne
|
chore: Don't apply exact attribute to external's parent dirs
| false
|
diff --git a/internal/chezmoi/sourcestate.go b/internal/chezmoi/sourcestate.go
index 9e4728d68a2..5717d631fe9 100644
--- a/internal/chezmoi/sourcestate.go
+++ b/internal/chezmoi/sourcestate.go
@@ -806,10 +806,7 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
external := s.externals[externalRelPath]
parentRelPath, _ := externalRelPath.Split()
var parentSourceRelPath SourceRelPath
- dirAttr := DirAttr{
- Exact: external.Exact,
- }
- switch parentSourceStateEntry, err := s.root.MkdirAll(parentRelPath, dirAttr, external.URL, s.umask); {
+ switch parentSourceStateEntry, err := s.root.MkdirAll(parentRelPath, external.URL, s.umask); {
case err != nil:
return err
case parentSourceStateEntry != nil:
diff --git a/internal/chezmoi/sourcestatetreenode.go b/internal/chezmoi/sourcestatetreenode.go
index 62d09f64d91..a38444c9cce 100644
--- a/internal/chezmoi/sourcestatetreenode.go
+++ b/internal/chezmoi/sourcestatetreenode.go
@@ -87,7 +87,7 @@ func (n *sourceStateEntryTreeNode) Map() map[RelPath]SourceStateEntry {
// MkdirAll creates SourceStateDirs for all components of targetRelPath if they
// do not already exist and returns the SourceStateDir of relPath.
-func (n *sourceStateEntryTreeNode) MkdirAll(targetRelPath RelPath, dirAttr DirAttr, origin string, umask fs.FileMode) (*SourceStateDir, error) {
+func (n *sourceStateEntryTreeNode) MkdirAll(targetRelPath RelPath, origin string, umask fs.FileMode) (*SourceStateDir, error) {
if targetRelPath == EmptyRelPath {
return nil, nil
}
@@ -110,14 +110,15 @@ func (n *sourceStateEntryTreeNode) MkdirAll(targetRelPath RelPath, dirAttr DirAt
switch {
case node.sourceStateEntry == nil:
- attr := dirAttr
- attr.TargetName = componentRelPath.String()
+ dirAttr := DirAttr{
+ TargetName: componentRelPath.String(),
+ }
targetStateDir := &TargetStateDir{
- perm: attr.perm() &^ umask,
+ perm: dirAttr.perm() &^ umask,
}
- sourceRelPath = sourceRelPath.Join(NewSourceRelPath(attr.SourceName()))
+ sourceRelPath = sourceRelPath.Join(NewSourceRelPath(dirAttr.SourceName()))
sourceStateDir = &SourceStateDir{
- Attr: attr,
+ Attr: dirAttr,
origin: origin,
sourceRelPath: sourceRelPath,
targetStateEntry: targetStateDir,
|
chore
|
Don't apply exact attribute to external's parent dirs
|
1ce6b2eeb0caf75bd91883e5a968e713a26e7be2
|
2024-03-03 06:17:52
|
Tom Payne
|
chore: Update GitHub Actions
| false
|
diff --git a/.github/workflows/govulncheck.yml b/.github/workflows/govulncheck.yml
index 3e4dfa9dfe2..f2b3aa78727 100644
--- a/.github/workflows/govulncheck.yml
+++ b/.github/workflows/govulncheck.yml
@@ -21,6 +21,6 @@ jobs:
id: go-version
run: |
echo go-version="$(awk '/GO_VERSION:/ { print $2 }' .github/workflows/main.yml | tr -d \')" >> "${GITHUB_OUTPUT}"
- - uses: golang/govulncheck-action@3a32958c2706f7048305d5a2e53633d7e37e97d0
+ - uses: golang/govulncheck-action@7da72f730e37eeaad891fcff0a532d27ed737cd4
with:
go-version-input: ${{ steps.go-version.outputs.go-version }}
diff --git a/.github/workflows/installer.yml b/.github/workflows/installer.yml
index 436cd3265a8..c71766991aa 100644
--- a/.github/workflows/installer.yml
+++ b/.github/workflows/installer.yml
@@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- id: filter
- uses: dorny/paths-filter@ebc4d7e9ebcb0b1eb21480bb8f43113e996ac77a
+ uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
with:
filters: |
shared: &shared
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 04870c32af9..6c7c318f726 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -32,7 +32,7 @@ jobs:
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- id: filter
- uses: dorny/paths-filter@ebc4d7e9ebcb0b1eb21480bb8f43113e996ac77a
+ uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
with:
filters: |
code:
|
chore
|
Update GitHub Actions
|
492e102f767199de065684d4a9ef6604dab3e11f
|
2023-01-24 19:25:56
|
Paul Panin
|
docs: Hint for work with GitHub private repos
| false
|
diff --git a/assets/chezmoi.io/docs/install.md.tmpl b/assets/chezmoi.io/docs/install.md.tmpl
index 0ba3a43a8ea..4a81de5b945 100644
--- a/assets/chezmoi.io/docs/install.md.tmpl
+++ b/assets/chezmoi.io/docs/install.md.tmpl
@@ -155,6 +155,13 @@ with a single command:
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply $GITHUB_USERNAME
```
+ Private GitHub repos requires other
+ [authentication methods](https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls):
+
+ ```sh
+ sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply [email protected]:$GITHUB_USERNAME/dotfiles.git
+ ```
+
!!! hint
To install the chezmoi binary in a different directory, use the `-b` option,
diff --git a/assets/chezmoi.io/docs/quick-start.md b/assets/chezmoi.io/docs/quick-start.md
index 840ae1db719..bd30a6fde55 100644
--- a/assets/chezmoi.io/docs/quick-start.md
+++ b/assets/chezmoi.io/docs/quick-start.md
@@ -122,6 +122,15 @@ On a second machine, initialize chezmoi with your dotfiles repo:
$ chezmoi init https://github.com/$GITHUB_USERNAME/dotfiles.git
```
+!!! hint
+
+ Private GitHub repos requires other
+ [authentication methods](https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls):
+
+ ```console
+ $ chezmoi init [email protected]:$GITHUB_USERNAME/dotfiles.git
+ ```
+
This will check out the repo and any submodules and optionally create a chezmoi
config file for you.
@@ -188,6 +197,15 @@ shortened to:
$ chezmoi init --apply $GITHUB_USERNAME
```
+!!! hint
+
+ Private GitHub repos requires other
+ [authentication methods](https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls):
+
+ ```console
+ chezmoi init --apply [email protected]:$GITHUB_USERNAME/dotfiles.git
+ ```
+
This command is summarized in this sequence diagram:
```mermaid
|
docs
|
Hint for work with GitHub private repos
|
47609a3d74b7db45db10805b2e43fa4b86737de3
|
2023-11-22 22:17:26
|
Austin Ziegler
|
docs: Add admonitions linking remove and forget
| false
|
diff --git a/assets/chezmoi.io/docs/reference/commands/forget.md b/assets/chezmoi.io/docs/reference/commands/forget.md
index 64cbdf1ecff..86c804e2fa0 100644
--- a/assets/chezmoi.io/docs/reference/commands/forget.md
+++ b/assets/chezmoi.io/docs/reference/commands/forget.md
@@ -8,3 +8,8 @@ have entries in the source state. They cannot be externals.
```console
$ chezmoi forget ~/.bashrc
```
+
+!!! info
+
+ To remove targets from both the source state and destination directory, use
+ [`remove`](/reference/commands/remov).
diff --git a/assets/chezmoi.io/docs/reference/commands/remove.md b/assets/chezmoi.io/docs/reference/commands/remove.md
index ee832f43fef..76c91fd1571 100644
--- a/assets/chezmoi.io/docs/reference/commands/remove.md
+++ b/assets/chezmoi.io/docs/reference/commands/remove.md
@@ -5,3 +5,8 @@ Remove *target*s from both the source state and the destination directory.
## `-f`, `--force`
Remove without prompting.
+
+!!! info
+
+ To remove targets only from the source state, use
+ [`forget`](/reference/commands/forget).
diff --git a/assets/chezmoi.io/docs/reference/commands/rm.md b/assets/chezmoi.io/docs/reference/commands/rm.md
index 76f3f87b23b..d6ae7e0c506 100644
--- a/assets/chezmoi.io/docs/reference/commands/rm.md
+++ b/assets/chezmoi.io/docs/reference/commands/rm.md
@@ -1,3 +1,3 @@
# `rm` *target*...
-`rm` is an alias for `remove`.
+`rm` is an alias for [`remove`](/reference/commands/remove).
|
docs
|
Add admonitions linking remove and forget
|
e268a97033a4045717804cc89c12e074384970ed
|
2021-10-25 03:45:30
|
Tom Payne
|
docs: Update quick start guide to include check before writing dotfiles
| false
|
diff --git a/docs/QUICKSTART.md b/docs/QUICKSTART.md
index a7c9ba4cd15..6a1113f2350 100644
--- a/docs/QUICKSTART.md
+++ b/docs/QUICKSTART.md
@@ -104,24 +104,24 @@ $ chezmoi init https://github.com/username/dotfiles.git
```
This will check out the repo and any submodules and optionally create a chezmoi
-config file for you. It won't make any changes to your home directory until you
-run:
+config file for you.
+
+Check what changes that chezmoi will make to your home directory by running:
```console
-$ chezmoi apply
+$ chezmoi diff
```
-If your dotfiles repo is `https://github.com/username/dotfiles.git` then the
-above two commands can be combined into just:
+If you are happy with the changes that chezmoi will make then run:
```console
-$ chezmoi init --apply username
+$ chezmoi apply -v
```
On any machine, you can pull and apply the latest changes from your repo with:
```console
-$ chezmoi update
+$ chezmoi update -v
```
---
|
docs
|
Update quick start guide to include check before writing dotfiles
|
d3dd05f21dafc714d4b590787289523b53f9fc02
|
2023-07-18 22:05:57
|
Tom Payne
|
feat: Allow executable bits to be overridden in archive-file externals
| false
|
diff --git a/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiexternal-format.md b/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiexternal-format.md
index b68c05c95cf..941a7099c24 100644
--- a/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiexternal-format.md
+++ b/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiexternal-format.md
@@ -89,7 +89,8 @@ If `type` is `archive-file` then the target is a file or symlink with the
contents of the entry `path` in the archive at `url`. The optional integer field
`stripComponents` will remove leading path components from the members of the
archive before comparing them with `path`. The behavior of `format` is the same
-as for `archive`.
+as for `archive`. If `executable` is `true` then chezmoi will set the executable
+bits on the target file, even if they are not set in the archive.
If `type` is `git-repo` then chezmoi will run `git clone $URL $TARGET_NAME`
with the optional `clone.args` if the target does not exist. If the target
diff --git a/pkg/chezmoi/sourcestate.go b/pkg/chezmoi/sourcestate.go
index 9ed395c8cb5..f2b7b4c48d4 100644
--- a/pkg/chezmoi/sourcestate.go
+++ b/pkg/chezmoi/sourcestate.go
@@ -2410,7 +2410,7 @@ func (s *SourceState) readExternalArchiveFile(
TargetName: fileInfo.Name(),
Type: SourceFileTypeFile,
Empty: fileInfo.Size() == 0,
- Executable: isExecutable(fileInfo),
+ Executable: isExecutable(fileInfo) || external.Executable,
Private: isPrivate(fileInfo),
ReadOnly: isReadOnly(fileInfo),
}
diff --git a/pkg/cmd/testdata/scripts/external.txtar b/pkg/cmd/testdata/scripts/external.txtar
index 083f58b8091..8b1360c34a3 100644
--- a/pkg/cmd/testdata/scripts/external.txtar
+++ b/pkg/cmd/testdata/scripts/external.txtar
@@ -103,6 +103,13 @@ chhome home12/user
exec chezmoi apply
cmp $HOME/.file golden/dir/file
+chhome home13/user
+
+# test that chezmoi can set executable bits on archive-file externals
+exec chezmoi apply
+[umask:002] cmpmod 775 $HOME/.file
+[umask:022] cmpmod 755 $HOME/.file
+
-- archive/dir/file --
# contents of dir/file
-- golden/.file --
@@ -142,6 +149,13 @@ cmp $HOME/.file golden/dir/file
url = "{{ env "HTTPD_URL" }}/archive.tar.gz"
path = "dir/file"
stripComponents = 1
+-- home13/user/.local/share/chezmoi/.chezmoiexternal.toml --
+[".file"]
+ type = "archive-file"
+ url = "{{ env "HTTPD_URL" }}/archive.tar.gz"
+ path = "dir/file"
+ executable = true
+ stripComponents = 1
-- home2/user/.local/share/chezmoi/.chezmoiexternal.toml --
[".file"]
type = "file"
|
feat
|
Allow executable bits to be overridden in archive-file externals
|
efc7fe975e2202f7d76da4db8bb84c1824f4a416
|
2025-01-01 23:03:00
|
Tom Payne
|
chore: Update golangci-lint
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 4710469eca3..37009b80b8a 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -21,7 +21,7 @@ env:
FIND_TYPOS_VERSION: 0.0.3 # https://github.com/twpayne/find-typos/tags
GO_VERSION: 1.23.4 # https://go.dev/doc/devel/release
GOFUMPT_VERSION: 0.7.0 # https://github.com/mvdan/gofumpt/releases
- GOLANGCI_LINT_VERSION: 1.62.2 # https://github.com/golangci/golangci-lint/releases
+ GOLANGCI_LINT_VERSION: 1.63.0 # https://github.com/golangci/golangci-lint/releases
GOLINES_VERSION: 0.12.2 # https://github.com/segmentio/golines/releases
GORELEASER_VERSION: 2.5.0 # https://github.com/goreleaser/goreleaser/releases
GOVERSIONINFO_VERSION: 1.4.1 # https://github.com/josephspurrier/goversioninfo/releases
diff --git a/.golangci.yml b/.golangci.yml
index 0ecc3cca490..ab0145fa87c 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -18,6 +18,7 @@ linters:
- errchkjson
- errname
- errorlint
+ - exptostd
- fatcontext
- forbidigo
- forcetypeassert
@@ -46,6 +47,7 @@ linters:
- mirror
- misspell
- nilerr
+ - nilnesserr
- noctx
- nolintlint
- nosprintfhostport
@@ -73,6 +75,7 @@ linters:
- unparam
- unused
- usestdlibvars
+ - usetesting
- wastedassign
- whitespace
- zerologlint
diff --git a/internal/chezmoi/boltpersistentstate_test.go b/internal/chezmoi/boltpersistentstate_test.go
index 04c4fa7b3f8..85467c1ec43 100644
--- a/internal/chezmoi/boltpersistentstate_test.go
+++ b/internal/chezmoi/boltpersistentstate_test.go
@@ -138,8 +138,7 @@ func TestBoltPersistentStateGeneric(t *testing.T) {
}
}()
testPersistentState(t, func() PersistentState {
- tempDir, err := os.MkdirTemp("", "chezmoi-test")
- assert.NoError(t, err)
+ tempDir := t.TempDir()
absPath := NewAbsPath(tempDir).JoinString("chezmoistate.boltdb")
b, err := NewBoltPersistentState(system, absPath, BoltPersistentStateReadWrite)
assert.NoError(t, err)
|
chore
|
Update golangci-lint
|
e39a123898377dfc3f73a7906cdfccb556127e66
|
2021-11-26 11:41:18
|
Tom Payne
|
docs: Add link to blog post
| false
|
diff --git a/docs/MEDIA.md b/docs/MEDIA.md
index 62286728c92..0a86cfb0581 100644
--- a/docs/MEDIA.md
+++ b/docs/MEDIA.md
@@ -12,6 +12,7 @@ Recommended podcast: [Managing Dot Files and an Introduction to Chezmoi](https:/
| Date | Version | Format | Link |
| ---------- | ------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| 2021-11-23 | 2.8.0 | Text | [chezmoi dotfile management](https://www.jacobbolda.com/chezmoi-dotfile-management) |
| 2021-10-26 | 2.7.3 | Text (RU) | [Синхронизация системных настроек](https://habr.com/en/post/585578/) |
| 2021-09-18 | 2.1.2 | Audio/text | [PBS 125 of X — Chezmoi on Multiple Computers](https://pbs.bartificer.net/pbs125) |
| 2021-09-14 | 2.2.0 | Text | [Managing preference plists under Chezmoi](https://zacwe.st/2021/09/14/managing-preference-plists-under-chezmoi/) |
|
docs
|
Add link to blog post
|
e2e199bd48b9abb89e9a38fb2a5e42970e9267c4
|
2022-03-03 06:06:40
|
Tom Payne
|
fix: Fix confusing error message when using builtin git to init over SSH
| false
|
diff --git a/assets/chezmoi.io/docs/reference/command-line-flags/global.md b/assets/chezmoi.io/docs/reference/command-line-flags/global.md
index 1ed70eecfdc..0a1e2db1b35 100644
--- a/assets/chezmoi.io/docs/reference/command-line-flags/global.md
+++ b/assets/chezmoi.io/docs/reference/command-line-flags/global.md
@@ -86,6 +86,11 @@ commands. *value* can be `on`, `off`, `auto`, or any boolean-like value
recognized by `parseBool`. The default is `auto` which will only use the
builtin git if `git.command` cannot be found in `$PATH`.
+!!! info
+
+ chezmoi's builtin git has only supports the HTTP and HTTPS transports and
+ does not support `git-repo` externals.
+
## `-v`, `--verbose`
Set verbose mode. In verbose mode, chezmoi prints the changes that it is making
diff --git a/pkg/cmd/initcmd.go b/pkg/cmd/initcmd.go
index 6e92e6524a2..a02eb9a2857 100644
--- a/pkg/cmd/initcmd.go
+++ b/pkg/cmd/initcmd.go
@@ -218,6 +218,10 @@ func (c *Config) runInitCmd(cmd *cobra.Command, args []string) error {
// builtinGitClone clones a repo using the builtin git command.
func (c *Config) builtinGitClone(username, url string, workingTreeRawPath chezmoi.AbsPath) error {
+ if c.init.ssh {
+ return errors.New("builtin git does not support cloning repos over ssh, please install git")
+ }
+
isBare := false
var referenceName plumbing.ReferenceName
if c.init.branch != "" {
|
fix
|
Fix confusing error message when using builtin git to init over SSH
|
504ca18402aae57ef8528f12419b36a582ebe3ab
|
2022-10-15 19:50:19
|
Tom Payne
|
chore: Tidy up entry type set logic
| false
|
diff --git a/assets/chezmoi.io/docs/reference/command-line-flags/common.md b/assets/chezmoi.io/docs/reference/command-line-flags/common.md
index a4bf77d3a52..29eba7df190 100644
--- a/assets/chezmoi.io/docs/reference/command-line-flags/common.md
+++ b/assets/chezmoi.io/docs/reference/command-line-flags/common.md
@@ -10,8 +10,8 @@ Set the output format.
Only operate on target state entries of type *types*. *types* is a
comma-separated list of target states (`all`, `dirs`, `files`, `remove`,
-`scripts`, `symlinks`, and `encrypted`) and can be excluded by preceding them
-with a `no`.
+`scripts`, `symlinks`) and/or source attributes (`encrypted`, `externals`) and
+can be excluded by preceding them with a `no`.
!!! example
diff --git a/pkg/chezmoi/entrytypeset.go b/pkg/chezmoi/entrytypeset.go
index 734bed2fdb2..8b1bfdb668e 100644
--- a/pkg/chezmoi/entrytypeset.go
+++ b/pkg/chezmoi/entrytypeset.go
@@ -114,11 +114,10 @@ func (s *EntryTypeSet) IncludeFileInfo(fileInfo fs.FileInfo) bool {
// IncludeTargetStateEntry returns true if type of targetStateEntry is a member.
func (s *EntryTypeSet) IncludeTargetStateEntry(targetStateEntry TargetStateEntry) bool {
- if s.IncludeEncrypted() && targetStateEntry.SourceAttr().Encrypted {
+ switch sourceAttr := targetStateEntry.SourceAttr(); {
+ case s.IncludeEncrypted() && sourceAttr.Encrypted:
return true
- }
-
- if s.IncludeExternals() && targetStateEntry.SourceAttr().External {
+ case s.IncludeExternals() && sourceAttr.External:
return true
}
diff --git a/pkg/cmd/config.go b/pkg/cmd/config.go
index 4c0128699b3..9491a1a8bc2 100644
--- a/pkg/cmd/config.go
+++ b/pkg/cmd/config.go
@@ -311,9 +311,7 @@ func newConfig(options ...configOption) (*Config, error) {
},
managed: managedCmdConfig{
exclude: chezmoi.NewEntryTypeSet(chezmoi.EntryTypesNone),
- include: chezmoi.NewEntryTypeSet(
- chezmoi.EntryTypeDirs | chezmoi.EntryTypeFiles | chezmoi.EntryTypeSymlinks | chezmoi.EntryTypeEncrypted,
- ),
+ include: chezmoi.NewEntryTypeSet(chezmoi.EntryTypesAll &^ (chezmoi.EntryTypeRemove | chezmoi.EntryTypeScripts)),
},
mergeAll: mergeAllCmdConfig{
recursive: true,
|
chore
|
Tidy up entry type set logic
|
f0ec8493fbe55430741c23284a078cb728c38f9f
|
2023-10-01 21:59:18
|
dependabot[bot]
|
chore(deps): bump actions/checkout from 3.6.0 to 4.1.0
| false
|
diff --git a/.github/workflows/govulncheck.yml b/.github/workflows/govulncheck.yml
index 17bda595a86..c7a55ce4555 100644
--- a/.github/workflows/govulncheck.yml
+++ b/.github/workflows/govulncheck.yml
@@ -14,7 +14,7 @@ jobs:
govulncheck:
runs-on: ubuntu-22.04
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- name: go-version
id: go-version
run: |
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index e68f7240c5c..1abd489f3aa 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -25,7 +25,7 @@ jobs:
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- id: filter
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50
with:
@@ -49,7 +49,7 @@ jobs:
permissions:
security-events: write
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
fetch-depth: 1
- uses: github/codeql-action/init@ddccb873888234080b77e9bc2d4764d5ccaaccf9
@@ -59,7 +59,7 @@ jobs:
misspell:
runs-on: ubuntu-22.04
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- uses: reviewdog/action-misspell@cc799b020b057600b66eedf2b6e97ca26137de21
with:
locale: US
@@ -68,7 +68,7 @@ jobs:
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
runs-on: ubuntu-20.04
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- name: test
env:
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
@@ -79,7 +79,7 @@ jobs:
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
runs-on: ubuntu-20.04
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- name: test
env:
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
@@ -90,7 +90,7 @@ jobs:
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
runs-on: macos-12
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
with:
path: ~/.vagrant.d
@@ -105,7 +105,7 @@ jobs:
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
runs-on: ubuntu-20.04
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- name: test
env:
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
@@ -116,7 +116,7 @@ jobs:
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
runs-on: macos-11
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: ${{ env.GO_VERSION }}
@@ -146,7 +146,7 @@ jobs:
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
runs-on: ubuntu-20.04
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: oldstable
@@ -171,7 +171,7 @@ jobs:
needs: changes
runs-on: ubuntu-20.04
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
fetch-depth: 0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
@@ -234,7 +234,7 @@ jobs:
needs: changes
runs-on: ubuntu-20.04
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
fetch-depth: 0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
@@ -274,7 +274,7 @@ jobs:
test-website:
runs-on: ubuntu-20.04
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: ${{ env.GO_VERSION }}
@@ -291,7 +291,7 @@ jobs:
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
runs-on: windows-2022
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: ${{ env.GO_VERSION }}
@@ -330,7 +330,7 @@ jobs:
check:
runs-on: ubuntu-20.04
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: ${{ env.GO_VERSION }}
@@ -360,7 +360,7 @@ jobs:
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
runs-on: ubuntu-20.04
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: ${{ env.GO_VERSION }}
@@ -402,7 +402,7 @@ jobs:
run: snapcraft whoami
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
fetch-depth: 0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
@@ -427,7 +427,7 @@ jobs:
- release
runs-on: ubuntu-20.04
steps:
- - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
+ - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
fetch-depth: 0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
|
chore
|
bump actions/checkout from 3.6.0 to 4.1.0
|
c3648dca7217e1974ac2e2b21efb8229d76cbbd3
|
2022-09-07 00:31:57
|
Tom Payne
|
chore: Build with Go 1.19.1
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index fa1b2641f59..97ed5f98849 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -10,7 +10,7 @@ on:
- v*
env:
AGE_VERSION: 1.0.0
- GO_VERSION: 1.19
+ GO_VERSION: 1.19.1
GOFUMPT_VERSION: 0.3.1
GOLANGCI_LINT_VERSION: 1.49.0
TPARSE_VERSION: 0.11.1
|
chore
|
Build with Go 1.19.1
|
fe2dba7aee848dcd10a28482c6c2166a6a3d9641
|
2024-10-21 12:57:27
|
Tom Payne
|
feat: Extend quote and quoteList template funcs to handle more types
| false
|
diff --git a/internal/cmd/config.go b/internal/cmd/config.go
index 4fa06557927..42ff3552029 100644
--- a/internal/cmd/config.go
+++ b/internal/cmd/config.go
@@ -404,6 +404,7 @@ func newConfig(options ...configOption) (*Config, error) {
// Override sprig template functions. Delete them from the template function
// map first to avoid a duplicate function panic.
delete(c.templateFuncs, "fromJson")
+ delete(c.templateFuncs, "quote")
delete(c.templateFuncs, "splitList")
delete(c.templateFuncs, "toPrettyJson")
@@ -482,6 +483,7 @@ func newConfig(options ...configOption) (*Config, error) {
"passRaw": c.passRawTemplateFunc,
"passhole": c.passholeTemplateFunc,
"pruneEmptyDicts": c.pruneEmptyDictsTemplateFunc,
+ "quote": c.quoteTemplateFunc,
"quoteList": c.quoteListTemplateFunc,
"rbw": c.rbwTemplateFunc,
"rbwFields": c.rbwFieldsTemplateFunc,
diff --git a/internal/cmd/interactivetemplatefuncs.go b/internal/cmd/interactivetemplatefuncs.go
index cc6365a2153..f8bd00bd388 100644
--- a/internal/cmd/interactivetemplatefuncs.go
+++ b/internal/cmd/interactivetemplatefuncs.go
@@ -227,33 +227,3 @@ func (c *Config) promptStringOnceInteractiveTemplateFunc(m map[string]any, path
return c.promptStringInteractiveTemplateFunc(prompt, args...)
}
-
-func anyToString(v any) (string, error) {
- switch v := v.(type) {
- case []byte:
- return string(v), nil
- case string:
- return v, nil
- default:
- return "", fmt.Errorf("%v: not a string", v)
- }
-}
-
-func anyToStringSlice(slice any) ([]string, error) {
- switch slice := slice.(type) {
- case []any:
- result := make([]string, 0, len(slice))
- for _, elem := range slice {
- elemStr, err := anyToString(elem)
- if err != nil {
- return nil, err
- }
- result = append(result, elemStr)
- }
- return result, nil
- case []string:
- return slice, nil
- default:
- return nil, fmt.Errorf("%v: not a slice", slice)
- }
-}
diff --git a/internal/cmd/templatefuncs.go b/internal/cmd/templatefuncs.go
index 998cbf0d40b..877d4dc0f68 100644
--- a/internal/cmd/templatefuncs.go
+++ b/internal/cmd/templatefuncs.go
@@ -403,23 +403,20 @@ func (c *Config) pruneEmptyDictsTemplateFunc(dict map[string]any) map[string]any
return dict
}
+func (c *Config) quoteTemplateFunc(list ...any) string {
+ ss := make([]string, 0, len(list))
+ for _, elem := range list {
+ if elem != nil {
+ ss = append(ss, strconv.Quote(anyToString(elem)))
+ }
+ }
+ return strings.Join(ss, " ")
+}
+
func (c *Config) quoteListTemplateFunc(list []any) []string {
result := make([]string, len(list))
for i, elem := range list {
- var elemStr string
- switch elem := elem.(type) {
- case []byte:
- elemStr = string(elem)
- case string:
- elemStr = elem
- case error:
- elemStr = elem.Error()
- case fmt.Stringer:
- elemStr = elem.String()
- default:
- elemStr = fmt.Sprintf("%v", elem)
- }
- result[i] = strconv.Quote(elemStr)
+ result[i] = strconv.Quote(anyToString(elem))
}
return result
}
@@ -553,6 +550,50 @@ func (c *Config) toYamlTemplateFunc(data any) string {
return string(yaml)
}
+func anyToString(value any) string {
+ switch value := value.(type) {
+ case bool:
+ return strconv.FormatBool(value)
+ case *bool:
+ return strconv.FormatBool(*value)
+ case []byte:
+ return string(value)
+ case float64:
+ return strconv.FormatFloat(value, 'f', -1, 64)
+ case *float64:
+ return strconv.FormatFloat(*value, 'f', -1, 64)
+ case int:
+ return strconv.Itoa(value)
+ case *int:
+ return strconv.Itoa(*value)
+ case string:
+ return value
+ case *string:
+ return *value
+ case error:
+ return value.Error()
+ case fmt.Stringer:
+ return value.String()
+ default:
+ return fmt.Sprintf("%v", value)
+ }
+}
+
+func anyToStringSlice(slice any) ([]string, error) {
+ switch slice := slice.(type) {
+ case []any:
+ result := make([]string, len(slice))
+ for i, elem := range slice {
+ result[i] = anyToString(elem)
+ }
+ return result, nil
+ case []string:
+ return slice, nil
+ default:
+ return nil, fmt.Errorf("%v: not a slice", slice)
+ }
+}
+
func fileInfoToMap(fileInfo fs.FileInfo) map[string]any {
return map[string]any{
"name": fileInfo.Name(),
diff --git a/internal/cmd/templatefuncs_test.go b/internal/cmd/templatefuncs_test.go
index b48b00acd52..ae70c1e0279 100644
--- a/internal/cmd/templatefuncs_test.go
+++ b/internal/cmd/templatefuncs_test.go
@@ -230,6 +230,54 @@ func TestPruneEmptyDicts(t *testing.T) {
}
}
+func TestQuoteTemplateFunc(t *testing.T) {
+ a := "a"
+ for _, tc := range []struct {
+ name string
+ values []any
+ expected string
+ }{
+ {
+ name: "empty",
+ },
+ {
+ name: "single",
+ values: []any{"a"},
+ expected: `"a"`,
+ },
+ {
+ name: "multiple",
+ values: []any{"a", "b", "c"},
+ expected: `"a" "b" "c"`,
+ },
+ {
+ name: "quotes",
+ values: []any{`"a"`, "b", "c"},
+ expected: `"\"a\"" "b" "c"`,
+ },
+ {
+ name: "ints",
+ values: []any{1, 2, 3},
+ expected: `"1" "2" "3"`,
+ },
+ {
+ name: "string_pointer",
+ values: []any{&a},
+ expected: `"a"`,
+ },
+ {
+ name: "byte_slice",
+ values: []any{[]byte{'a'}},
+ expected: `"a"`,
+ },
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ var c Config
+ assert.Equal(t, tc.expected, c.quoteTemplateFunc(tc.values...))
+ })
+ }
+}
+
func TestSetValueAtPathTemplateFunc(t *testing.T) {
for _, tc := range []struct {
name string
|
feat
|
Extend quote and quoteList template funcs to handle more types
|
f0de321615fc72902fa5bbd3b531c3c311a84b18
|
2022-01-27 01:48:02
|
Tom Payne
|
docs: Add doc on building on top of chezmoi
| false
|
diff --git a/assets/chezmoi.io/docs/developer/building-on-top-of-chezmoi.md b/assets/chezmoi.io/docs/developer/building-on-top-of-chezmoi.md
new file mode 100644
index 00000000000..4de32ac3ecd
--- /dev/null
+++ b/assets/chezmoi.io/docs/developer/building-on-top-of-chezmoi.md
@@ -0,0 +1,12 @@
+# Building on top of chezmoi
+
+chezmoi is designed with UNIX-style composibility in mind, and the command line
+tool is semantically versioned. Building on top of chezmoi should primarily be
+done by executing the binary with arguments and the standard input and output
+configured appropriately. The `chezmoi dump` and `chezmoi state` commands
+allows the inspection of chezmoi's internal state.
+
+chezmoi's internal functionality is available as the Go module
+`github.com/twpayne/chezmoi/v2`, however there are no guarantees whatsoever
+about the API stability of this module. The semantic version applies to the
+command line tool, and not to any Go APIs at any level.
diff --git a/assets/chezmoi.io/mkdocs.yml b/assets/chezmoi.io/mkdocs.yml
index 43925abbdbc..3ec12c03da5 100644
--- a/assets/chezmoi.io/mkdocs.yml
+++ b/assets/chezmoi.io/mkdocs.yml
@@ -192,6 +192,7 @@ nav:
- Packaging: developer/packaging.md
- Security: developer/security.md
- Architecture: developer/architecture.md
+ - Building on top of chezmoi: developer/building-on-top-of-chezmoi.md
- Links:
- Articles, podcasts, and videos: links/articles-podcasts-and-videos.md
- Dotfile repos using chezmoi: links/dotfile-repos-using-chezmoi.md
|
docs
|
Add doc on building on top of chezmoi
|
c1dd1c5763e4601216c911445a7c6123bbbd4397
|
2022-09-29 00:40:14
|
sm1999
|
chore: Fix typo in entrytypeset.go
| false
|
diff --git a/pkg/chezmoi/entrytypeset.go b/pkg/chezmoi/entrytypeset.go
index 2bb19a87175..1a40efb900f 100644
--- a/pkg/chezmoi/entrytypeset.go
+++ b/pkg/chezmoi/entrytypeset.go
@@ -71,7 +71,7 @@ func (s *EntryTypeSet) IncludeEncrypted() bool {
return s.bits&EntryTypeEncrypted != 0
}
-// IncludeExternals returns true if s includes encrypted files.
+// IncludeExternals returns true if s includes externals files.
func (s *EntryTypeSet) IncludeExternals() bool {
return s.bits&EntryTypeExternals != 0
}
|
chore
|
Fix typo in entrytypeset.go
|
d039739d8cc5b91b6137012829ac601063cd3bdf
|
2022-09-17 00:14:59
|
Tom Payne
|
chore: Move uniqueAbbreviations function to package
| false
|
diff --git a/pkg/chezmoi/chezmoi.go b/pkg/chezmoi/chezmoi.go
index 5a34466a373..83a463841f9 100644
--- a/pkg/chezmoi/chezmoi.go
+++ b/pkg/chezmoi/chezmoi.go
@@ -194,6 +194,28 @@ func SuspiciousSourceDirEntry(base string, fileInfo fs.FileInfo, encryptedSuffix
}
}
+// UniqueAbbreviations returns a map of unique abbreviations of values to
+// values. Values always map to themselves.
+func UniqueAbbreviations(values []string) map[string]string {
+ abbreviations := make(map[string][]string)
+ for _, value := range values {
+ for i := 1; i <= len(value); i++ {
+ abbreviation := value[:i]
+ abbreviations[abbreviation] = append(abbreviations[abbreviation], value)
+ }
+ }
+ uniqueAbbreviations := make(map[string]string)
+ for abbreviation, values := range abbreviations {
+ if len(values) == 1 {
+ uniqueAbbreviations[abbreviation] = values[0]
+ }
+ }
+ for _, value := range values {
+ uniqueAbbreviations[value] = value
+ }
+ return uniqueAbbreviations
+}
+
// etcHostnameFQDNHostname returns the FQDN hostname from parsing /etc/hostname.
func etcHostnameFQDNHostname(fileSystem vfs.FS) (string, error) {
contents, err := fileSystem.ReadFile("/etc/hostname")
diff --git a/pkg/chezmoi/chezmoi_test.go b/pkg/chezmoi/chezmoi_test.go
index 6241ad42f0e..763a0cf3999 100644
--- a/pkg/chezmoi/chezmoi_test.go
+++ b/pkg/chezmoi/chezmoi_test.go
@@ -2,6 +2,7 @@ package chezmoi
import (
"os"
+ "strings"
"testing"
"github.com/rs/zerolog"
@@ -109,6 +110,73 @@ func TestEtcHostsFQDNHostname(t *testing.T) {
}
}
+func TestUniqueAbbreviations(t *testing.T) {
+ for _, tc := range []struct {
+ values []string
+ expected map[string]string
+ }{
+ {
+ values: nil,
+ expected: map[string]string{},
+ },
+ {
+ values: []string{
+ "yes",
+ "no",
+ "all",
+ "quit",
+ },
+ expected: map[string]string{
+ "y": "yes",
+ "ye": "yes",
+ "yes": "yes",
+ "n": "no",
+ "no": "no",
+ "a": "all",
+ "al": "all",
+ "all": "all",
+ "q": "quit",
+ "qu": "quit",
+ "qui": "quit",
+ "quit": "quit",
+ },
+ },
+ {
+ values: []string{
+ "ale",
+ "all",
+ "abort",
+ },
+ expected: map[string]string{
+ "ale": "ale",
+ "all": "all",
+ "ab": "abort",
+ "abo": "abort",
+ "abor": "abort",
+ "abort": "abort",
+ },
+ },
+ {
+ values: []string{
+ "no",
+ "now",
+ "nope",
+ },
+ expected: map[string]string{
+ "no": "no",
+ "now": "now",
+ "nop": "nope",
+ "nope": "nope",
+ },
+ },
+ } {
+ t.Run(strings.Join(tc.values, "_"), func(t *testing.T) {
+ actual := UniqueAbbreviations(tc.values)
+ assert.Equal(t, tc.expected, actual)
+ })
+ }
+}
+
func sortedKeys[K constraints.Ordered, V any](m map[K]V) []K {
keys := maps.Keys(m)
slices.Sort(keys)
diff --git a/pkg/cmd/config.go b/pkg/cmd/config.go
index 51960077139..5c9d57e12cf 100644
--- a/pkg/cmd/config.go
+++ b/pkg/cmd/config.go
@@ -1855,7 +1855,7 @@ func (c *Config) persistentStateFile() (chezmoi.AbsPath, error) {
// promptChoice prompts the user for one of choices until a valid choice is made.
func (c *Config) promptChoice(prompt string, choices []string) (string, error) {
promptWithChoices := fmt.Sprintf("%s [%s]? ", prompt, strings.Join(choices, ","))
- abbreviations := uniqueAbbreviations(choices)
+ abbreviations := chezmoi.UniqueAbbreviations(choices)
for {
line, err := c.readLine(promptWithChoices)
if err != nil {
diff --git a/pkg/cmd/util.go b/pkg/cmd/util.go
index e2865c56edb..80b8ac6209a 100644
--- a/pkg/cmd/util.go
+++ b/pkg/cmd/util.go
@@ -119,28 +119,6 @@ func upperSnakeCaseToCamelCase(s string) string {
return strings.Join(words, "")
}
-// uniqueAbbreviations returns a map of unique abbreviations of values to
-// values. Values always map to themselves.
-func uniqueAbbreviations(values []string) map[string]string {
- abbreviations := make(map[string][]string)
- for _, value := range values {
- for i := 1; i <= len(value); i++ {
- abbreviation := value[:i]
- abbreviations[abbreviation] = append(abbreviations[abbreviation], value)
- }
- }
- uniqueAbbreviations := make(map[string]string)
- for abbreviation, values := range abbreviations {
- if len(values) == 1 {
- uniqueAbbreviations[abbreviation] = values[0]
- }
- }
- for _, value := range values {
- uniqueAbbreviations[value] = value
- }
- return uniqueAbbreviations
-}
-
// upperSnakeCaseToCamelCaseKeys returns m with all keys converted from
// UPPER_SNAKE_CASE to camelCase.
func upperSnakeCaseToCamelCaseMap(m map[string]any) map[string]any {
diff --git a/pkg/cmd/util_test.go b/pkg/cmd/util_test.go
index cdb9da59b4f..cd7d4f68a67 100644
--- a/pkg/cmd/util_test.go
+++ b/pkg/cmd/util_test.go
@@ -1,7 +1,6 @@
package cmd
import (
- "strings"
"testing"
"github.com/stretchr/testify/assert"
@@ -110,73 +109,6 @@ func TestEnglishListWithNoun(t *testing.T) {
}
}
-func TestUniqueAbbreviations(t *testing.T) {
- for _, tc := range []struct {
- values []string
- expected map[string]string
- }{
- {
- values: nil,
- expected: map[string]string{},
- },
- {
- values: []string{
- "yes",
- "no",
- "all",
- "quit",
- },
- expected: map[string]string{
- "y": "yes",
- "ye": "yes",
- "yes": "yes",
- "n": "no",
- "no": "no",
- "a": "all",
- "al": "all",
- "all": "all",
- "q": "quit",
- "qu": "quit",
- "qui": "quit",
- "quit": "quit",
- },
- },
- {
- values: []string{
- "ale",
- "all",
- "abort",
- },
- expected: map[string]string{
- "ale": "ale",
- "all": "all",
- "ab": "abort",
- "abo": "abort",
- "abor": "abort",
- "abort": "abort",
- },
- },
- {
- values: []string{
- "no",
- "now",
- "nope",
- },
- expected: map[string]string{
- "no": "no",
- "now": "now",
- "nop": "nope",
- "nope": "nope",
- },
- },
- } {
- t.Run(strings.Join(tc.values, "_"), func(t *testing.T) {
- actual := uniqueAbbreviations(tc.values)
- assert.Equal(t, tc.expected, actual)
- })
- }
-}
-
func TestUpperSnakeCaseToCamelCaseMap(t *testing.T) {
actual := upperSnakeCaseToCamelCaseMap(map[string]any{
"BUG_REPORT_URL": "",
|
chore
|
Move uniqueAbbreviations function to package
|
61fad45307892ba17ccdc0baa2e50267cf28784f
|
2021-10-07 23:50:44
|
Tom Payne
|
chore: Remove dependency on age for builtin age tests
| false
|
diff --git a/internal/chezmoi/ageencryption_test.go b/internal/chezmoi/ageencryption_test.go
index c441abb6025..458533d89ec 100644
--- a/internal/chezmoi/ageencryption_test.go
+++ b/internal/chezmoi/ageencryption_test.go
@@ -2,11 +2,13 @@ package chezmoi
import (
"errors"
+ "fmt"
"os"
"os/exec"
"path/filepath"
"testing"
+ "filippo.io/age"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/twpayne/go-vfs/v4"
@@ -39,26 +41,24 @@ func TestAgeEncryption(t *testing.T) {
}
func TestBuiltinAgeEncryption(t *testing.T) {
- _, err := exec.LookPath("age")
- if errors.Is(err, exec.ErrNotFound) {
- t.Skip("age not found in $PATH")
- }
- require.NoError(t, err)
-
- publicKey, privateKeyFile, err := chezmoitest.AgeGenerateKey("")
- require.NoError(t, err)
- defer func() {
- assert.NoError(t, os.RemoveAll(filepath.Dir(privateKeyFile)))
- }()
+ recipientStringer, identityAbsPath := builtinAgeGenerateKey(t)
ageEncryption := &AgeEncryption{
UseBuiltin: true,
BaseSystem: NewRealSystem(vfs.OSFS),
- Identity: NewAbsPath(privateKeyFile),
- Recipient: publicKey,
+ Identity: identityAbsPath,
+ Recipient: recipientStringer.String(),
}
testEncryptionDecryptToFile(t, ageEncryption)
testEncryptionEncryptDecrypt(t, ageEncryption)
testEncryptionEncryptFile(t, ageEncryption)
}
+
+func builtinAgeGenerateKey(t *testing.T) (fmt.Stringer, AbsPath) {
+ identity, err := age.GenerateX25519Identity()
+ require.NoError(t, err)
+ privateKeyFile := filepath.Join(t.TempDir(), "chezmoi-builtin-age-key.txt")
+ require.NoError(t, os.WriteFile(privateKeyFile, []byte(identity.String()), 0o600))
+ return identity.Recipient(), NewAbsPath(privateKeyFile)
+}
|
chore
|
Remove dependency on age for builtin age tests
|
03a91ca08ab3d6c73e125fd8ed1b71b695d041a2
|
2022-09-01 02:10:00
|
Tom Payne
|
fix: Only use quotes if necessary in toIni template function
| false
|
diff --git a/pkg/cmd/templatefuncs.go b/pkg/cmd/templatefuncs.go
index ccb772a1084..bfd1f879bab 100644
--- a/pkg/cmd/templatefuncs.go
+++ b/pkg/cmd/templatefuncs.go
@@ -30,7 +30,12 @@ type ioregData struct {
value map[string]any
}
-var startOfLineRx = regexp.MustCompile(`(?m)^`)
+var (
+ // needsQuoteRx matches any string that contains non-printable characters,
+ // double quotes, or a backslash.
+ needsQuoteRx = regexp.MustCompile(`[^\x21\x23-\x5b\x5d-\x7e]`)
+ startOfLineRx = regexp.MustCompile(`(?m)^`)
+)
func (c *Config) commentTemplateFunc(prefix, s string) string {
return startOfLineRx.ReplaceAllString(s, prefix)
@@ -308,7 +313,11 @@ func writeIniMap(w io.Writer, data map[string]any, sectionPrefix string) error {
}
subsections = append(subsections, subsection)
case string:
- fmt.Fprintf(w, "%s = %q\n", key, value)
+ if needsQuote(value) {
+ fmt.Fprintf(w, "%s = %q\n", key, value)
+ } else {
+ fmt.Fprintf(w, "%s = %s\n", key, value)
+ }
default:
return fmt.Errorf("%s%s: %T: unsupported type", sectionPrefix, key, value)
}
@@ -327,6 +336,22 @@ func writeIniMap(w io.Writer, data map[string]any, sectionPrefix string) error {
return nil
}
+func needsQuote(s string) bool {
+ if s == "" {
+ return true
+ }
+ if needsQuoteRx.MatchString(s) {
+ return true
+ }
+ if _, err := strconv.ParseBool(s); err == nil {
+ return true
+ }
+ if _, err := strconv.ParseFloat(s, 64); err == nil {
+ return true
+ }
+ return false
+}
+
func sortedKeys[K constraints.Ordered, V any](m map[K]V) []K {
keys := maps.Keys(m)
slices.Sort(keys)
diff --git a/pkg/cmd/templatefuncs_test.go b/pkg/cmd/templatefuncs_test.go
index cd9bf756e8b..40854fa74ba 100644
--- a/pkg/cmd/templatefuncs_test.go
+++ b/pkg/cmd/templatefuncs_test.go
@@ -63,7 +63,21 @@ func TestToIniTemplateFunc(t *testing.T) {
`bool = true`,
`float = 1.000000`,
`int = 1`,
- `string = "string"`,
+ `string = string`,
+ ),
+ },
+ {
+ data: map[string]any{
+ "bool": "true",
+ "float": "1.0",
+ "int": "1",
+ "string": "string string",
+ },
+ expected: chezmoitest.JoinLines(
+ `bool = "true"`,
+ `float = "1.0"`,
+ `int = "1"`,
+ `string = "string string"`,
),
},
{
@@ -74,10 +88,10 @@ func TestToIniTemplateFunc(t *testing.T) {
},
},
expected: chezmoitest.JoinLines(
- `key = "value"`,
+ `key = value`,
``,
`[section]`,
- `subKey = "subValue"`,
+ `subKey = subValue`,
),
},
{
@@ -93,7 +107,7 @@ func TestToIniTemplateFunc(t *testing.T) {
`[section]`,
``,
`[section.subsection]`,
- `subSubKey = "subSubValue"`,
+ `subSubKey = subSubValue`,
),
},
{
@@ -107,13 +121,13 @@ func TestToIniTemplateFunc(t *testing.T) {
},
},
expected: chezmoitest.JoinLines(
- `key = "value"`,
+ `key = value`,
``,
`[section]`,
- `subKey = "subValue"`,
+ `subKey = subValue`,
``,
`[section.subsection]`,
- `subSubKey = "subSubValue"`,
+ `subSubKey = subSubValue`,
),
},
{
@@ -140,22 +154,22 @@ func TestToIniTemplateFunc(t *testing.T) {
expected: chezmoitest.JoinLines(
``,
`[section1]`,
- `subKey1 = "subValue1"`,
+ `subKey1 = subValue1`,
``,
`[section1.subsection1a]`,
- `subSubKey1a = "subSubValue1a"`,
+ `subSubKey1a = subSubValue1a`,
``,
`[section1.subsection1b]`,
- `subSubKey1b = "subSubValue1b"`,
+ `subSubKey1b = subSubValue1b`,
``,
`[section2]`,
- `subKey2 = "subValue2"`,
+ `subKey2 = subValue2`,
``,
`[section2.subsection2a]`,
- `subSubKey2a = "subSubValue2a"`,
+ `subSubKey2a = subSubValue2a`,
``,
`[section2.subsection2b]`,
- `subSubKey2b = "subSubValue2b"`,
+ `subSubKey2b = subSubValue2b`,
),
},
} {
@@ -167,6 +181,42 @@ func TestToIniTemplateFunc(t *testing.T) {
}
}
+func TestNeedsQuote(t *testing.T) {
+ for i, tc := range []struct {
+ s string
+ expected bool
+ }{
+ {
+ s: "",
+ expected: true,
+ },
+ {
+ s: "\\",
+ expected: true,
+ },
+ {
+ s: "\a",
+ expected: true,
+ },
+ {
+ s: "abc",
+ expected: false,
+ },
+ {
+ s: "true",
+ expected: true,
+ },
+ {
+ s: "1",
+ expected: true,
+ },
+ } {
+ t.Run(strconv.Itoa(i), func(t *testing.T) {
+ assert.Equal(t, tc.expected, needsQuote(tc.s))
+ })
+ }
+}
+
func TestQuoteListTemplateFunc(t *testing.T) {
c, err := newConfig()
require.NoError(t, err)
diff --git a/pkg/cmd/testdata/scripts/templatefuncs.txtar b/pkg/cmd/testdata/scripts/templatefuncs.txtar
index 6af5ff99619..e84176036bc 100644
--- a/pkg/cmd/testdata/scripts/templatefuncs.txtar
+++ b/pkg/cmd/testdata/scripts/templatefuncs.txtar
@@ -154,10 +154,10 @@ file2.txt
-- golden/include-relpath --
# contents of .local/share/chezmoi/.include
-- golden/toIni --
-key = "value"
+key = value
[section]
-subkey = "subvalue"
+subkey = subvalue
-- home/user/.include --
# contents of .include
-- home/user/.local/share/chezmoi/.include --
|
fix
|
Only use quotes if necessary in toIni template function
|
dbc1b4b7e7b1b005f55674f798cf7c81a20d8fbb
|
2023-08-13 18:52:49
|
Tom Payne
|
chore: Bump golangci-lint to version 1.54.0
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 93982347a28..9f8fc4ec880 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -13,7 +13,7 @@ env:
AGE_VERSION: 1.1.1
GO_VERSION: 1.21.0
GOFUMPT_VERSION: 0.4.0
- GOLANGCI_LINT_VERSION: 1.53.3
+ GOLANGCI_LINT_VERSION: 1.54.0
GOLINES_VERSION: 0.11.0
GOVERSIONINFO_VERSION: 1.4.0
FINDTYPOS_VERSION: 0.0.1
|
chore
|
Bump golangci-lint to version 1.54.0
|
f440988560093e140b47a25071e6c1994a234227
|
2021-11-03 04:40:15
|
Tom Payne
|
docs: Update contributing guide about automated Homebrew PRs
| false
|
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
index 9e0393507f5..29450457933 100644
--- a/docs/CONTRIBUTING.md
+++ b/docs/CONTRIBUTING.md
@@ -154,7 +154,12 @@ logins periodically expire. Create a new snapcraft login by running:
$ snapcraft export-login --snaps=chezmoi --channels=stable,candidate,beta,edge --acls=package_upload -
```
-[brew](https://brew.sh/) formula must be updated manually with the command:
+[brew](https://brew.sh/) automation will automatically detect new releases of
+chezmoi within a few hours and open a pull request in
+[https://github.com/Homebrew/homebrew-core](github.com/Homebrew/homebrew-core)
+to bump the version.
+
+If needed, the pull request can be created with:
```console
$ brew bump-formula-pr --tag=v1.2.3 chezmoi
|
docs
|
Update contributing guide about automated Homebrew PRs
|
843ba3344e97386d5a5367d599e69e6a875553dc
|
2022-02-21 07:39:05
|
Tom Payne
|
docs: Improve scripts user guide
| false
|
diff --git a/assets/chezmoi.io/docs/user-guide/use-scripts-to-perform-actions.md b/assets/chezmoi.io/docs/user-guide/use-scripts-to-perform-actions.md
index 4fa0ab2bd5e..a96ce49552e 100644
--- a/assets/chezmoi.io/docs/user-guide/use-scripts-to-perform-actions.md
+++ b/assets/chezmoi.io/docs/user-guide/use-scripts-to-perform-actions.md
@@ -19,15 +19,35 @@ sparingly. Any script should be idempotent, even `run_once_` and
`run_onchange_` scripts.
Scripts must be created manually in the source directory, typically by running
-`chezmoi cd` and then creating a file with a `run_` prefix. Scripts are
-executed directly using `exec` and must include a shebang line or be executable
-binaries. There is no need to set the executable bit on the script.
+`chezmoi cd` and then creating a file with a `run_` prefix. There is no need to
+set the executable bit on the script, as chezmoi will set the executable bit
+before executing the script.
Scripts with the suffix `.tmpl` are treated as templates, with the usual
template variables available. If, after executing the template, the result is
only whitespace or an empty string, then the script is not executed. This is
useful for disabling scripts.
+When chezmoi executes a script, it first generates the script contents in a
+file in a temporary directory with the executable bit set, and then executes
+the contents with `exec(3)`. Consequently, the script's contents must either
+include a `#!` line or be an executable binary.
+
+!!! note
+
+ By default, `chezmoi diff` will print the contents of scripts that would be
+ run by `chezmoi apply`. To exclude scripts from the output of `chezmoi
+ diff`, set `diff.exclude` in your configuration file, for example:
+
+ ```toml title="~/.config/chezmoi/chezmoi.toml"
+ [diff]
+ exclude = ["scripts"]
+ ```
+
+ Similarly, `chezmoi status` will print the names of the scripts that it
+ will execute with the status `R`. This can similarly disabled by setting
+ `status.exclude` to `["scripts"]` in your configuration file.
+
## Install packages with scripts
Change to the source directory and create a file called
|
docs
|
Improve scripts user guide
|
bc0720fa1c8590cb34d8f0ba8e06b39d23bb4d6a
|
2024-09-30 14:09:47
|
Tom Payne
|
chore: Update tool versions
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index ad211159ff7..2446e938920 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -22,9 +22,9 @@ env:
GOLINES_VERSION: 0.12.2 # https://github.com/segmentio/golines/releases
GORELEASER_VERSION: 2.3.2 # https://github.com/goreleaser/goreleaser/releases
GOVERSIONINFO_VERSION: 1.4.1 # https://github.com/josephspurrier/goversioninfo/releases
- PYTHON_VERSION: '3.10'
+ PYTHON_VERSION: '3.10' # https://www.python.org/downloads/
RAGE_VERSION: 0.10.0 # https://github.com/str4d/rage/releases
- UV_VERSION: 0.4.16 # https://github.com/astral-sh/uv/releases
+ UV_VERSION: 0.4.17 # https://github.com/astral-sh/uv/releases
jobs:
changes:
runs-on: ubuntu-22.04
|
chore
|
Update tool versions
|
beb8f61ac77876e7747a7c1bc90b71fb5a6953e0
|
2023-06-20 04:21:05
|
Tom Payne
|
chore: Add actionlint linter
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 0f30b108960..c524c606d5e 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -9,6 +9,7 @@ on:
tags:
- v*
env:
+ ACTIONLINT_VERSION: 1.6.25
AGE_VERSION: 1.1.1
GO_VERSION: 1.20.5
GOFUMPT_VERSION: 0.4.0
@@ -341,6 +342,10 @@ jobs:
run: |
go generate
git diff --exit-code
+ - name: actionlint
+ run: |
+ go install "github.com/rhysd/actionlint/cmd/actionlint@v${ACTIONLINT_VERSION}"
+ actionlint
- uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38
with:
ignore_paths: completions
diff --git a/.gitignore b/.gitignore
index d18ad32645d..e512fc5ed87 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
/.vagrant
/COMMIT
+/bin/actionlint
/bin/chezmoi
/bin/gofumpt
/bin/golines
diff --git a/Makefile b/Makefile
index 11e475100c2..51b7751b328 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
GO?=go
+ACTIONLINT_VERSION=$(shell awk '/ACTIONLINT_VERSION:/ { print $$2 }' .github/workflows/main.yml)
GOFUMPT_VERSION=$(shell awk '/GOFUMPT_VERSION:/ { print $$2 }' .github/workflows/main.yml)
GOLANGCI_LINT_VERSION=$(shell awk '/GOLANGCI_LINT_VERSION:/ { print $$2 }' .github/workflows/main.yml)
GOVERSIONINFO_VERSION=$(shell awk '/GOVERSIONINFO_VERSION:/ { print $$2 }' .github/workflows/main.yml)
@@ -107,7 +108,8 @@ generate:
${GO} generate
.PHONY: lint
-lint: ensure-golangci-lint
+lint: ensure-actionlint ensure-golangci-lint
+ ./bin/actionlint
./bin/golangci-lint run
${GO} run ./internal/cmds/lint-whitespace
find . -name \*.txtar | xargs ${GO} run ./internal/cmds/lint-txtar
@@ -127,7 +129,14 @@ create-syso: ensure-goversioninfo
./bin/goversioninfo -platform-specific
.PHONY: ensure-tools
-ensure-tools: ensure-gofumpt ensure-golangci-lint ensure-goversioninfo
+ensure-tools: ensure-actionlint ensure-gofumpt ensure-golangci-lint ensure-goversioninfo
+
+.PHONY: ensure-actionlint
+ensure-actionlint:
+ if [ ! -x bin/actionlint ] || ( ./bin/actionlint --version | grep -Fqv "v${ACTIONLINT_VERSION}" ) ; then \
+ mkdir -p bin ; \
+ GOBIN=$(shell pwd)/bin ${GO} install "github.com/rhysd/actionlint/cmd/actionlint@v${ACTIONLINT_VERSION}" ; \
+ fi
.PHONY: ensure-gofumpt
ensure-gofumpt:
|
chore
|
Add actionlint linter
|
13e933861ed5d81771a1aefa9280ecb8e2ad90c0
|
2024-08-22 04:16:11
|
Tom Payne
|
chore: Update golangci-lint
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 77515028995..169e2330427 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -18,7 +18,7 @@ env:
FIND_TYPOS_VERSION: 0.0.3 # https://github.com/twpayne/find-typos/tags
GO_VERSION: 1.23.0 # https://go.dev/doc/devel/release
GOFUMPT_VERSION: 0.6.0 # https://github.com/mvdan/gofumpt/releases
- GOLANGCI_LINT_VERSION: 1.60.1 # https://github.com/golangci/golangci-lint/releases
+ GOLANGCI_LINT_VERSION: 1.60.2 # https://github.com/golangci/golangci-lint/releases
GOLINES_VERSION: 0.12.2 # https://github.com/segmentio/golines/releases
GORELEASER_VERSION: 2.2.0 # https://github.com/goreleaser/goreleaser/releases
GOVERSIONINFO_VERSION: 1.4.0 # https://github.com/josephspurrier/goversioninfo/releases
diff --git a/.golangci.yml b/.golangci.yml
index 620529e0546..057619125fc 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -84,7 +84,6 @@ linters:
- dupl
- exhaustive
- exhaustruct
- - exportloopref
- funlen
- ginkgolinter
- gochecknoglobals
diff --git a/internal/chezmoi/chezmoi.go b/internal/chezmoi/chezmoi.go
index 172f80cee85..ebb5c1045cd 100644
--- a/internal/chezmoi/chezmoi.go
+++ b/internal/chezmoi/chezmoi.go
@@ -19,7 +19,7 @@ import (
"github.com/spf13/cobra"
vfs "github.com/twpayne/go-vfs/v5"
- "golang.org/x/crypto/ripemd160" //nolint:staticcheck
+ "golang.org/x/crypto/ripemd160" //nolint:gosec,staticcheck
"github.com/twpayne/chezmoi/v2/internal/chezmoiset"
)
@@ -347,7 +347,7 @@ func modeTypeName(mode fs.FileMode) string {
// ripemd160Sum returns the RIPEMD-160 sum of data.
func ripemd160Sum(data []byte) []byte {
- return ripemd160.New().Sum(data)
+ return ripemd160.New().Sum(data) //nolint:gosec
}
// sha1Sum returns the SHA1 sum of data.
diff --git a/internal/chezmoi/chezmoi_unix.go b/internal/chezmoi/chezmoi_unix.go
index 18c2e403734..a7427c3c111 100644
--- a/internal/chezmoi/chezmoi_unix.go
+++ b/internal/chezmoi/chezmoi_unix.go
@@ -12,7 +12,7 @@ import (
const nativeLineEnding = "\n"
func init() {
- Umask = fs.FileMode(unix.Umask(0))
+ Umask = fs.FileMode(unix.Umask(0)) //nolint:gosec
unix.Umask(int(Umask))
}
diff --git a/internal/chezmoitest/chezmoitest.go b/internal/chezmoitest/chezmoitest.go
index 1a20fdfb53f..cd4930c0f60 100644
--- a/internal/chezmoitest/chezmoitest.go
+++ b/internal/chezmoitest/chezmoitest.go
@@ -97,9 +97,9 @@ func WithTestFS(t *testing.T, root any, f func(vfs.FS)) {
// mustParseFileMode parses s as a fs.FileMode and panics on any error.
func mustParseFileMode(s string) fs.FileMode {
- i, err := strconv.ParseInt(s, 0, 32)
+ u, err := strconv.ParseUint(s, 0, 32)
if err != nil {
panic(err)
}
- return fs.FileMode(i)
+ return fs.FileMode(uint32(u)) //nolint:gosec
}
diff --git a/internal/cmd/config.go b/internal/cmd/config.go
index 79ca5f9dfe4..3333f426985 100644
--- a/internal/cmd/config.go
+++ b/internal/cmd/config.go
@@ -732,7 +732,7 @@ func (c *Config) colorAutoFunc() bool {
return false
}
if stdout, ok := c.stdout.(*os.File); ok {
- return term.IsTerminal(int(stdout.Fd()))
+ return term.IsTerminal(int(stdout.Fd())) //nolint:gosec
}
return false
}
@@ -2269,7 +2269,7 @@ func (c *Config) persistentStateFile() (chezmoi.AbsPath, error) {
// progressAutoFunc detects whether progress bars should be displayed.
func (c *Config) progressAutoFunc() bool {
if stdout, ok := c.stdout.(*os.File); ok {
- return term.IsTerminal(int(stdout.Fd()))
+ return term.IsTerminal(int(stdout.Fd())) //nolint:gosec
}
return false
}
diff --git a/internal/cmd/initcmd.go b/internal/cmd/initcmd.go
index 7c61b0e9c28..82eb8be2236 100644
--- a/internal/cmd/initcmd.go
+++ b/internal/cmd/initcmd.go
@@ -310,7 +310,7 @@ func (o gitCloneOptionsLogValuer) LogValue() slog.Value {
attrs = append(attrs, slog.Int("Depth", o.Depth))
}
if o.RecurseSubmodules != 0 {
- attrs = append(attrs, slog.Int("RecurseSubmodules", int(o.RecurseSubmodules)))
+ attrs = append(attrs, slog.Uint64("RecurseSubmodules", uint64(o.RecurseSubmodules)))
}
if o.Tags != 0 {
attrs = append(attrs, slog.Int("Tags", int(o.Tags)))
diff --git a/internal/cmd/inittemplatefuncs.go b/internal/cmd/inittemplatefuncs.go
index 89c45d36f92..0b5fefadb07 100644
--- a/internal/cmd/inittemplatefuncs.go
+++ b/internal/cmd/inittemplatefuncs.go
@@ -20,7 +20,7 @@ func (c *Config) stdinIsATTYInitTemplateFunc() bool {
if !ok {
return false
}
- return term.IsTerminal(int(file.Fd()))
+ return term.IsTerminal(int(file.Fd())) //nolint:gosec
}
func (c *Config) writeToStdout(args ...string) string {
|
chore
|
Update golangci-lint
|
4d4b17b55fc85e3563c0629ff6de3a5879873bf1
|
2024-03-03 06:17:52
|
Tom Payne
|
chore: Update dependencies
| false
|
diff --git a/go.mod b/go.mod
index 76730c7d66e..97804884569 100644
--- a/go.mod
+++ b/go.mod
@@ -60,7 +60,7 @@ require (
require (
dario.cat/mergo v1.0.0 // indirect
- github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 // indirect
+ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.10.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
diff --git a/go.sum b/go.sum
index 5ef65103cf9..85a3e6f5bf9 100644
--- a/go.sum
+++ b/go.sum
@@ -18,8 +18,8 @@ filippo.io/age v1.1.1 h1:pIpO7l151hCnQ4BdyBujnGP2YlUo0uj6sAVNHGBvXHg=
filippo.io/age v1.1.1/go.mod h1:l03SrzDUrBkdBx8+IILdnn2KZysqQdbEBUQ4p3sqEQE=
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
-github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ=
-github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM=
+github.com/Azure/azure-sdk-for-go/sdk/azcore v1.10.0 h1:n1DH8TPV4qqPTje2RcUBYwtrTWlabVp4n46+74X2pn4=
+github.com/Azure/azure-sdk-for-go/sdk/azcore v1.10.0/go.mod h1:HDcZnuGbiyppErN6lB+idp4CKhjbc8gwjto6OPpyggM=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 h1:sO0/P7g68FrryJzljemN+6GTssUXdANk6aJ7T1ZxnsQ=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1/go.mod h1:h8hyGFDsU5HMivxiS2iYFZsgDbU9OnnJ163x5UGVKYo=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ=
|
chore
|
Update dependencies
|
ff3deb9007ca4cf25e17b1c8665cb8f72fcaeaf9
|
2024-01-10 00:16:25
|
Tom Payne
|
docs: Add explanation of status characters
| false
|
diff --git a/assets/chezmoi.io/docs/reference/commands/status.md b/assets/chezmoi.io/docs/reference/commands/status.md
index aab10c41b30..c636e559320 100644
--- a/assets/chezmoi.io/docs/reference/commands/status.md
+++ b/assets/chezmoi.io/docs/reference/commands/status.md
@@ -5,7 +5,16 @@ similar to [`git status`](https://git-scm.com/docs/git-status).
The first column of output indicates the difference between the last state
written by chezmoi and the actual state. The second column indicates the
-difference between the actual state and the target state.
+difference between the actual state and the target state, and what effect
+running [`chezmoi apply`](/apply.md) will have.
+
+| Character | Meaning | First column | Second column |
+| --------- | --------- | ------------------ | ---------------------- |
+| Space | No change | No change | No change |
+| `A` | Added | Entry was created | Entry will be created |
+| `D` | Deleted | Entry was deleted | Entry will be deleted |
+| `M` | Modified | Entry was modified | Entry will be modified |
+| `R` | Run | Not applicable | Script will be run |
## `-i`, `--include` *types*
|
docs
|
Add explanation of status characters
|
a30de5979ca249345420cea2b2fb88b907c04f00
|
2022-01-29 23:06:47
|
Tom Payne
|
chore: Tidy up 1Password template functions
| false
|
diff --git a/pkg/cmd/onepasswordtemplatefuncs.go b/pkg/cmd/onepasswordtemplatefuncs.go
index a3753f89366..1720f2312d0 100644
--- a/pkg/cmd/onepasswordtemplatefuncs.go
+++ b/pkg/cmd/onepasswordtemplatefuncs.go
@@ -27,20 +27,40 @@ type onePasswordItem struct {
} `json:"details"`
}
-func (c *Config) onepasswordItem(args ...string) *onePasswordItem {
- sessionToken := c.onepasswordGetOrRefreshSession(args)
- onepasswordArgs := getOnepasswordArgs([]string{"get", "item"}, args)
- output := c.onepasswordOutput(onepasswordArgs, sessionToken)
- var onepasswordItem onePasswordItem
- if err := json.Unmarshal(output, &onepasswordItem); err != nil {
+func (c *Config) onepasswordTemplateFunc(args ...string) map[string]interface{} {
+ sessionToken, err := c.onepasswordGetOrRefreshSessionToken(args)
+ if err != nil {
+ returnTemplateError(err)
+ return nil
+ }
+
+ onepasswordArgs, err := onepasswordArgs([]string{"get", "item"}, args)
+ if err != nil {
+ returnTemplateError(err)
+ return nil
+ }
+
+ output, err := c.onepasswordOutput(onepasswordArgs, sessionToken)
+ if err != nil {
+ returnTemplateError(err)
+ return nil
+ }
+
+ var data map[string]interface{}
+ if err := json.Unmarshal(output, &data); err != nil {
returnTemplateError(fmt.Errorf("%s: %w\n%s", shellQuoteCommand(c.Onepassword.Command, onepasswordArgs), err, output))
return nil
}
- return &onepasswordItem
+ return data
}
func (c *Config) onepasswordDetailsFieldsTemplateFunc(args ...string) map[string]interface{} {
- onepasswordItem := c.onepasswordItem(args...)
+ onepasswordItem, err := c.onepasswordItem(args...)
+ if err != nil {
+ returnTemplateError(err)
+ return nil
+ }
+
result := make(map[string]interface{})
for _, field := range onepasswordItem.Details.Fields {
if designation, ok := field["designation"].(string); ok {
@@ -50,90 +70,51 @@ func (c *Config) onepasswordDetailsFieldsTemplateFunc(args ...string) map[string
return result
}
-func (c *Config) onepasswordItemFieldsTemplateFunc(args ...string) map[string]interface{} {
- onepasswordItem := c.onepasswordItem(args...)
- result := make(map[string]interface{})
- for _, section := range onepasswordItem.Details.Sections {
- for _, field := range section.Fields {
- if t, ok := field["t"].(string); ok {
- result[t] = field
- }
- }
- }
- return result
-}
-
func (c *Config) onepasswordDocumentTemplateFunc(args ...string) string {
- sessionToken := c.onepasswordGetOrRefreshSession(args)
- onepasswordArgs := getOnepasswordArgs([]string{"get", "document"}, args)
- output := c.onepasswordOutput(onepasswordArgs, sessionToken)
- return string(output)
-}
-
-func (c *Config) onepasswordOutput(args []string, sessionToken string) []byte {
- key := strings.Join(args, "\x00")
- if output, ok := c.Onepassword.outputCache[key]; ok {
- return output
- }
-
- var secretArgs []string
- if sessionToken != "" {
- secretArgs = []string{"--session", sessionToken}
+ sessionToken, err := c.onepasswordGetOrRefreshSessionToken(args)
+ if err != nil {
+ returnTemplateError(err)
+ return ""
}
- name := c.Onepassword.Command
- // Append the session token here, so it is not logged by accident.
- cmd := exec.Command(name, append(secretArgs, args...)...)
- cmd.Stdin = c.stdin
- stderr := &bytes.Buffer{}
- cmd.Stderr = stderr
- output, err := c.baseSystem.IdempotentCmdOutput(cmd)
+ onepasswordArgs, err := onepasswordArgs([]string{"get", "document"}, args)
if err != nil {
- returnTemplateError(fmt.Errorf("%s: %w: %s", shellQuoteCommand(name, args), err, bytes.TrimSpace(stderr.Bytes())))
- return nil
+ returnTemplateError(err)
+ return ""
}
- if c.Onepassword.outputCache == nil {
- c.Onepassword.outputCache = make(map[string][]byte)
+ output, err := c.onepasswordOutput(onepasswordArgs, sessionToken)
+ if err != nil {
+ returnTemplateError(err)
+ return ""
}
- c.Onepassword.outputCache[key] = output
- return output
+ return string(output)
}
-func (c *Config) onepasswordTemplateFunc(args ...string) map[string]interface{} {
- sessionToken := c.onepasswordGetOrRefreshSession(args)
- onepasswordArgs := getOnepasswordArgs([]string{"get", "item"}, args)
- output := c.onepasswordOutput(onepasswordArgs, sessionToken)
- var data map[string]interface{}
- if err := json.Unmarshal(output, &data); err != nil {
- returnTemplateError(fmt.Errorf("%s: %w\n%s", shellQuoteCommand(c.Onepassword.Command, onepasswordArgs), err, output))
+func (c *Config) onepasswordItemFieldsTemplateFunc(args ...string) map[string]interface{} {
+ onepasswordItem, err := c.onepasswordItem(args...)
+ if err != nil {
+ returnTemplateError(err)
return nil
}
- return data
-}
-func getOnepasswordArgs(baseArgs, args []string) []string {
- if len(args) < 1 || len(args) > 3 {
- returnTemplateError(fmt.Errorf("expected 1, 2, or 3 arguments, got %d", len(args)))
- return nil
- }
- baseArgs = append(baseArgs, args[0])
- if len(args) > 1 {
- baseArgs = append(baseArgs, "--vault", args[1])
- }
- if len(args) > 2 {
- baseArgs = append(baseArgs, "--account", args[2])
+ result := make(map[string]interface{})
+ for _, section := range onepasswordItem.Details.Sections {
+ for _, field := range section.Fields {
+ if t, ok := field["t"].(string); ok {
+ result[t] = field
+ }
+ }
}
-
- return baseArgs
+ return result
}
-// refreshSession will return the current session token if the token within the
-// environment is still valid. Otherwise it will ask the user to sign in and get
-// the new token. If `sessioncheck` is disabled, it returns an empty string.
-func (c *Config) onepasswordGetOrRefreshSession(callerArgs []string) string {
+// onepasswordGetOrRefreshSessionToken will return the current session token if
+// the token within the environment is still valid. Otherwise it will ask the
+// user to sign in and get the new token.
+func (c *Config) onepasswordGetOrRefreshSessionToken(callerArgs []string) (string, error) {
if !c.Onepassword.Prompt {
- return ""
+ return "", nil
}
var account string
@@ -145,14 +126,14 @@ func (c *Config) onepasswordGetOrRefreshSession(callerArgs []string) string {
// account.
token, ok := c.Onepassword.sessionTokens[account]
if ok {
- return token
+ return token, nil
}
var args []string
if account == "" {
// If no account has been given then look for any session tokens in the
// environment.
- token = onepasswordInferSessionToken()
+ token = onepasswordSessionToken()
args = []string{"signin", "--raw"}
} else {
token = os.Getenv("OP_SESSION_" + account)
@@ -173,9 +154,8 @@ func (c *Config) onepasswordGetOrRefreshSession(callerArgs []string) string {
cmd.Stderr = stderr
output, err := cmd.Output()
if err != nil {
- returnTemplateError(fmt.Errorf("%s: %w: %s",
- shellQuoteCommand(c.Onepassword.Command, args), err, bytes.TrimSpace(stderr.Bytes())))
- return ""
+ commandStr := shellQuoteCommand(c.Onepassword.Command, args)
+ return "", fmt.Errorf("%s: %w: %s", commandStr, err, bytes.TrimSpace(stderr.Bytes()))
}
token = strings.TrimSpace(string(output))
@@ -186,18 +166,84 @@ func (c *Config) onepasswordGetOrRefreshSession(callerArgs []string) string {
}
c.Onepassword.sessionTokens[account] = token
- return token
+ return token, nil
+}
+
+func (c *Config) onepasswordItem(args ...string) (*onePasswordItem, error) {
+ sessionToken, err := c.onepasswordGetOrRefreshSessionToken(args)
+ if err != nil {
+ return nil, err
+ }
+
+ onepasswordArgs, err := onepasswordArgs([]string{"get", "item"}, args)
+ if err != nil {
+ return nil, err
+ }
+
+ output, err := c.onepasswordOutput(onepasswordArgs, sessionToken)
+ if err != nil {
+ return nil, err
+ }
+
+ var onepasswordItem onePasswordItem
+ if err := json.Unmarshal(output, &onepasswordItem); err != nil {
+ return nil, fmt.Errorf("%s: %w\n%s", shellQuoteCommand(c.Onepassword.Command, onepasswordArgs), err, output)
+ }
+ return &onepasswordItem, nil
+}
+
+func (c *Config) onepasswordOutput(args []string, sessionToken string) ([]byte, error) {
+ key := strings.Join(args, "\x00")
+ if output, ok := c.Onepassword.outputCache[key]; ok {
+ return output, nil
+ }
+
+ var secretArgs []string
+ if sessionToken != "" {
+ secretArgs = []string{"--session", sessionToken}
+ }
+
+ name := c.Onepassword.Command
+ // Append the session token here, so it is not logged by accident.
+ cmd := exec.Command(name, append(secretArgs, args...)...)
+ cmd.Stdin = c.stdin
+ stderr := &bytes.Buffer{}
+ cmd.Stderr = stderr
+ output, err := c.baseSystem.IdempotentCmdOutput(cmd)
+ if err != nil {
+ return nil, fmt.Errorf("%s: %w: %s", shellQuoteCommand(name, args), err, bytes.TrimSpace(stderr.Bytes()))
+ }
+
+ if c.Onepassword.outputCache == nil {
+ c.Onepassword.outputCache = make(map[string][]byte)
+ }
+ c.Onepassword.outputCache[key] = output
+
+ return output, nil
+}
+
+func onepasswordArgs(baseArgs, args []string) ([]string, error) {
+ if len(args) < 1 || len(args) > 3 {
+ return nil, fmt.Errorf("expected 1, 2, or 3 arguments, got %d", len(args))
+ }
+ baseArgs = append(baseArgs, args[0])
+ if len(args) > 1 {
+ baseArgs = append(baseArgs, "--vault", args[1])
+ }
+ if len(args) > 2 {
+ baseArgs = append(baseArgs, "--account", args[2])
+ }
+ return baseArgs, nil
}
-// onepasswordInferSessionToken will look for any session tokens in the
-// environment and if it finds exactly one then it will return it.
-func onepasswordInferSessionToken() string {
+// onepasswordSessionToken will look for any session tokens in the environment.
+// If it finds exactly one then it will return it.
+func onepasswordSessionToken() string {
var token string
for _, env := range os.Environ() {
key, value, found := chezmoi.CutString(env, "=")
if found && strings.HasPrefix(key, "OP_SESSION_") {
if token != "" {
- // This is the second session we find. Let's bail.
return ""
}
token = value
|
chore
|
Tidy up 1Password template functions
|
b944a845d02f6677a26fab839ae20f3f8b0d78f1
|
2022-06-22 21:57:46
|
Braden Hilton
|
docs: Add CPU cores/threads template
| false
|
diff --git a/assets/chezmoi.io/docs/user-guide/machines/general.md b/assets/chezmoi.io/docs/user-guide/machines/general.md
index 0340b1de9c8..b15832b3a19 100644
--- a/assets/chezmoi.io/docs/user-guide/machines/general.md
+++ b/assets/chezmoi.io/docs/user-guide/machines/general.md
@@ -19,3 +19,40 @@ The following template sets the `$chassisType` variable to `"desktop"` or
{{- $chassisType = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "if ((Get-CimInstance -Class Win32_Battery | Measure-Object).Count -gt 0) { Write-Output 'laptop' } else { Write-Output 'desktop' }") | trim }}
{{- end }}
```
+
+## Determine how many CPU cores and threads the current machine has
+
+The following template sets the `$cpuCores` and `$cpuThreads` variables to the
+number of CPU cores and threads on the current machine respectively on
+macOS, Linux and Windows.
+
+```
+{{- $cpuCores := 1 }}
+{{- $cpuThreads := 1 }}
+{{- if eq .chezmoi.os "darwin" }}
+{{- $cpuCores = (output "sysctl" "-n" "hw.physicalcpu_max") | trim | atoi }}
+{{- $cpuThreads = (output "sysctl" "-n" "hw.logicalcpu_max") | trim | atoi }}
+{{- else if eq .chezmoi.os "linux" }}
+{{- $cpuCores = (output "sh" "-c" "lscpu --online --parse | grep --invert-match '^#' | sort --field-separator=',' --key='2,4' --unique | wc --lines") | trim | atoi }}
+{{- $cpuThreads = (output "sh" "-c" "lscpu --online --parse | grep --invert-match '^#' | wc --lines") | trim | atoi }}
+{{- else if eq .chezmoi.os "windows" }}
+{{- $cpuCores = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "(Get-CimInstance -ClassName 'Win32_Processor').NumberOfCores") | trim | atoi }}
+{{- $cpuThreads = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "(Get-CimInstance -ClassName 'Win32_Processor').NumberOfLogicalProcessors") | trim | atoi }}
+{{- end }}
+```
+
+!!! example
+
+ ``` title="~/.local/share/chezmoi/.chezmoi.toml.tmpl"
+ [data.cpu]
+ cores = {{ $cpuCores }}
+ threads = {{ $cpuThreads }}
+ ```
+
+ ``` title="~/.local/share/chezmoi/is_hyperthreaded.txt.tmpl"
+ {{- if gt .cpu.threads .cpu.cores -}}
+ Hyperthreaded!
+ {{- else -}}
+ Not hyperthreaded!
+ {{- end -}}
+ ```
|
docs
|
Add CPU cores/threads template
|
2a41aeb8d9d958e34ae5ef41686907492c228af2
|
2024-10-25 15:40:24
|
Ruslan Sayfutdinov
|
docs: Update "how scripts work" section
| false
|
diff --git a/assets/chezmoi.io/docs/user-guide/use-scripts-to-perform-actions.md b/assets/chezmoi.io/docs/user-guide/use-scripts-to-perform-actions.md
index 2977a51e1af..07c78391b71 100644
--- a/assets/chezmoi.io/docs/user-guide/use-scripts-to-perform-actions.md
+++ b/assets/chezmoi.io/docs/user-guide/use-scripts-to-perform-actions.md
@@ -2,40 +2,52 @@
## Understand how scripts work
-chezmoi supports scripts, which are executed when you run `chezmoi apply`. The
-scripts can either run every time you run `chezmoi apply`, only when their
-contents have changed, or only if they have not been run before.
+chezmoi supports scripts that are executed when you run
+[`chezmoi apply`](/reference/commands/apply.md). These scripts can be configured
+to run every time, only when their contents have changed, or only if they
+haven't been run before.
+
+Scripts are any file in the source directory with the prefix `run_`, and
+they are executed in alphabetical order.
+
+- **`run_` scripts**: These scripts are executed every time you run `chezmoi apply`.
+- **`run_onchange_` scripts**: These scripts are only executed if their content
+has changed since the last time they were run.
+- **`run_once_` scripts**: These scripts are executed once for each unique
+version of the content. If the script is a template, the content is hashed after
+template execution. chezmoi tracks the content's SHA256 hash and stores it in
+a database. If the content has been run before (even under a different filename),
+the script will not run again unless the content itself changes.
+
+Scripts break chezmoi's declarative approach and should be used sparingly.
+All scripts should be idempotent, including `run_onchange_` and `run_once_` scripts.
+
+Scripts are normally run while chezmoi updates your dotfiles. For example,
+`run_b.sh` will be run after updating `a.txt` and before updating `c.txt`.
+To run scripts before or after the updates, use the `before_` or `after_`
+attributes, respectively, e.g., `run_once_before_install-password-manager.sh`.
-In verbose mode, the script's contents will be printed before executing it. In
-dry-run mode, the script is not executed.
-
-Scripts are any file in the source directory with the prefix `run_`, and are
-executed in alphabetical order. Scripts that should be run whenever their
-contents change have the `run_onchange_` prefix. Scripts that should only be run
-if they have not been run before have the prefix `run_once_`.
-
-Scripts break chezmoi's declarative approach, and as such should be used
-sparingly. Any script should be idempotent, even `run_onchange_` and `run_once_`
-scripts.
+Scripts must be created manually in the source directory, typically by running
+[`chezmoi cd`](/reference/commands/cd.md) and then creating a file with a `run_`
+prefix. There is no need to set the executable bit on the script.
-Scripts are normally run while chezmoi updates your dotfiles. To configure
-scripts to run before or after your dotfiles are updated use the `before_` and
-`after_` attributes respectively, e.g.
-`run_once_before_install-password-manager.sh`.
+Scripts with the `.tmpl` suffix are treated as templates, with the usual
+template variables available. If the template resolves to only whitespace
+or an empty string, the script will not be executed, which is useful for
+disabling scripts dynamically.
-Scripts must be created manually in the source directory, typically by running
-`chezmoi cd` and then creating a file with a `run_` prefix. There is no need to
-set the executable bit on the script.
+When executing a script, chezmoi generates the script contents in a file in a
+temporary directory with the executable bit set and then executes it using `exec(3)`.
+As a result, the script must either include a `#!` line or be an executable binary.
+Script working directory is set to the first existing parent directory in the
+destination tree.
-Scripts with the suffix `.tmpl` are treated as templates, with the usual
-template variables available. If, after executing the template, the result is
-only whitespace or an empty string, then the script is not executed. This is
-useful for disabling scripts.
+If a `.chezmoiscripts` directory exists at the root of the source directory,
+scripts in this directory are executed as normal scripts, without creating
+a corresponding directory in the target state.
-When chezmoi executes a script, it first generates the script contents in a
-file in a temporary directory with the executable bit set, and then executes
-the contents with `exec(3)`. Consequently, the script's contents must either
-include a `#!` line or be an executable binary.
+In _verbose_ mode, the scripts' contents are printed before execution.
+In _dry-run_ mode, scripts are not executed.
## Set environment variables
@@ -83,7 +95,8 @@ In this file create your package installation script, e.g.
sudo apt install ripgrep
```
-The next time you run `chezmoi apply` or `chezmoi update` this script will be
+The next time you run [`chezmoi apply`](/reference/commands/apply.md) or
+[`chezmoi update`](/reference/commands/update.md) this script will be
run. As it has the `run_onchange_` prefix, it will not be run again unless its
contents change, for example if you add more packages to be installed.
@@ -104,7 +117,8 @@ This will install `ripgrep` on both Debian/Ubuntu Linux systems and macOS.
## Run a script when the contents of another file changes
-chezmoi's `run_` scripts are run every time you run `chezmoi apply`, whereas
+chezmoi's `run_` scripts are run every time you run
+[`chezmoi apply`](/reference/commands/apply.md), whereas
`run_onchange_` scripts are run only when their contents have changed, after
executing them as templates. You can use this to cause a `run_onchange_` script
to run when the contents of another file has changed by including a checksum of
@@ -127,7 +141,8 @@ contents of the script will change whenever the contents of `dconf.ini` are
changed, so chezmoi will re-run the script whenever the contents of `dconf.ini`
change.
-In this example you should also add `dconf.ini` to `.chezmoiignore` so chezmoi
+In this example you should also add `dconf.ini` to
+[`.chezmoiignore`](/reference/special-files/chezmoiignore.md) so chezmoi
does not create `dconf.ini` in your home directory.
## Clear the state of all `run_onchange_` and `run_once_` scripts
|
docs
|
Update "how scripts work" section
|
32e512f1991fae3174b08c844f2bf83e9382f04b
|
2022-06-23 20:23:26
|
Tom Payne
|
chore: Sort variables in table in reference manual
| false
|
diff --git a/assets/chezmoi.io/docs/reference/configuration-file/variables.md b/assets/chezmoi.io/docs/reference/configuration-file/variables.md
index aa8359aa138..36428e7c0db 100644
--- a/assets/chezmoi.io/docs/reference/configuration-file/variables.md
+++ b/assets/chezmoi.io/docs/reference/configuration-file/variables.md
@@ -43,7 +43,6 @@ The following configuration variables are available:
| | `command` | string | `$EDITOR` / `$VISUAL` | Edit command |
| | `hardlink` | bool | `true` | Invoke editor with a hardlink to the source file |
| | `minDuration` | duration | `1s` | Minimum duration for edit command |
-| `secret` | `command` | string | *none* | Generic secret command |
| `git` | `autoAdd ` | bool | `false` | Add changes to the source state after any change |
| | `autoCommit` | bool | `false` | Commit changes to the source state after any change |
| | `autoPush` | bool | `false` | Push changes to the source state after any change |
@@ -72,6 +71,7 @@ The following configuration variables are available:
| `pinentry` | `args` | []string | *none* | Extra args to the pinentry command |
| | `command` | string | *none* | pinentry command |
| | `options` | []string | *see `pinentry` below* | Extra options for pinentry |
+| `secret` | `command` | string | *none* | Generic secret command |
| `status` | `exclude` | []string | *none* | Entry types to exclude from status |
| `template` | `options` | []string | `["missingkey=error"]` | Template options |
| `textconv` | | []object | *none* | See section on "textconv" |
|
chore
|
Sort variables in table in reference manual
|
f72243d5197e49108a81a3da96e16503364a35c5
|
2022-12-23 00:01:03
|
Tom Payne
|
chore: Update dependencies
| false
|
diff --git a/go.mod b/go.mod
index 930b560d765..de709cef078 100644
--- a/go.mod
+++ b/go.mod
@@ -5,9 +5,9 @@ go 1.18
require (
filippo.io/age v1.0.0
github.com/Masterminds/sprig/v3 v3.2.3
- github.com/aws/aws-sdk-go-v2 v1.17.2
- github.com/aws/aws-sdk-go-v2/config v1.18.4
- github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.9
+ github.com/aws/aws-sdk-go-v2 v1.17.3
+ github.com/aws/aws-sdk-go-v2/config v1.18.7
+ github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.10
github.com/bmatcuk/doublestar/v4 v4.4.0
github.com/bradenhilton/mozillainstallhash v1.0.0
github.com/charmbracelet/bubbles v0.14.0
@@ -32,13 +32,13 @@ require (
github.com/twpayne/go-pinentry v0.2.0
github.com/twpayne/go-vfs/v4 v4.1.0
github.com/twpayne/go-xdg/v6 v6.0.0
- github.com/ulikunitz/xz v0.5.10
+ github.com/ulikunitz/xz v0.5.11
github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1
github.com/zalando/go-keyring v0.2.1
go.etcd.io/bbolt v1.3.7-0.20220226045046-fd5535f71f48
- go.uber.org/multierr v1.8.0
+ go.uber.org/multierr v1.9.0
golang.org/x/crypto v0.4.0
- golang.org/x/exp v0.0.0-20221211140036-ad323defaf05
+ golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15
golang.org/x/oauth2 v0.3.0
golang.org/x/sync v0.1.0
golang.org/x/sys v0.3.0
@@ -58,22 +58,22 @@ require (
github.com/alecthomas/chroma v0.10.0 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/atotto/clipboard v0.1.4 // indirect
- github.com/aws/aws-sdk-go-v2/credentials v1.13.4 // indirect
- github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.20 // indirect
- github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.26 // indirect
- github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.20 // indirect
- github.com/aws/aws-sdk-go-v2/internal/ini v1.3.27 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.20 // indirect
- github.com/aws/aws-sdk-go-v2/service/sso v1.11.26 // indirect
- github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.9 // indirect
- github.com/aws/aws-sdk-go-v2/service/sts v1.17.6 // indirect
+ github.com/aws/aws-sdk-go-v2/credentials v1.13.7 // indirect
+ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.21 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.27 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.21 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/ini v1.3.28 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.21 // indirect
+ github.com/aws/aws-sdk-go-v2/service/sso v1.11.28 // indirect
+ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.11 // indirect
+ github.com/aws/aws-sdk-go-v2/service/sts v1.17.7 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/aymanbagabas/go-osc52 v1.2.1 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/bradenhilton/cityhash v1.0.0 // indirect
github.com/charmbracelet/harmonica v0.2.0 // indirect
github.com/charmbracelet/lipgloss v0.6.0 // indirect
- github.com/cloudflare/circl v1.3.0 // indirect
+ github.com/cloudflare/circl v1.3.1 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
diff --git a/go.sum b/go.sum
index 07e868d78b5..643c907020c 100644
--- a/go.sum
+++ b/go.sum
@@ -25,30 +25,30 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
-github.com/aws/aws-sdk-go-v2 v1.17.2 h1:r0yRZInwiPBNpQ4aDy/Ssh3ROWsGtKDwar2JS8Lm+N8=
-github.com/aws/aws-sdk-go-v2 v1.17.2/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
-github.com/aws/aws-sdk-go-v2/config v1.18.4 h1:VZKhr3uAADXHStS/Gf9xSYVmmaluTUfkc0dcbPiDsKE=
-github.com/aws/aws-sdk-go-v2/config v1.18.4/go.mod h1:EZxMPLSdGAZ3eAmkqXfYbRppZJTzFTkv8VyEzJhKko4=
-github.com/aws/aws-sdk-go-v2/credentials v1.13.4 h1:nEbHIyJy7mCvQ/kzGG7VWHSBpRB4H6sJy3bWierWUtg=
-github.com/aws/aws-sdk-go-v2/credentials v1.13.4/go.mod h1:/Cj5w9LRsNTLSwexsohwDME32OzJ6U81Zs33zr2ZWOM=
-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.20 h1:tpNOglTZ8kg9T38NpcGBxudqfUAwUzyUnLQ4XSd0CHE=
-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.20/go.mod h1:d9xFpWd3qYwdIXM0fvu7deD08vvdRXyc/ueV+0SqaWE=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.26 h1:5WU31cY7m0tG+AiaXuXGoMzo2GBQ1IixtWa8Yywsgco=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.26/go.mod h1:2E0LdbJW6lbeU4uxjum99GZzI0ZjDpAb0CoSCM0oeEY=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.20 h1:WW0qSzDWoiWU2FS5DbKpxGilFVlCEJPwx4YtjdfI0Jw=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.20/go.mod h1:/+6lSiby8TBFpTVXZgKiN/rCfkYXEGvhlM4zCgPpt7w=
-github.com/aws/aws-sdk-go-v2/internal/ini v1.3.27 h1:N2eKFw2S+JWRCtTt0IhIX7uoGGQciD4p6ba+SJv4WEU=
-github.com/aws/aws-sdk-go-v2/internal/ini v1.3.27/go.mod h1:RdwFVc7PBYWY33fa2+8T1mSqQ7ZEK4ILpM0wfioDC3w=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.20 h1:jlgyHbkZQAgAc7VIxJDmtouH8eNjOk2REVAQfVhdaiQ=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.20/go.mod h1:Xs52xaLBqDEKRcAfX/hgjmD3YQ7c/W+BEyfamlO/W2E=
-github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.9 h1:ogcakjF/mrZOo9oJVWmRbG838C04oWGXI8T8IY4xcfM=
-github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.9/go.mod h1:S7AsUoaHONHV2iGM5QXQOonnaV05cK9fty2dXRdouws=
-github.com/aws/aws-sdk-go-v2/service/sso v1.11.26 h1:ActQgdTNQej/RuUJjB9uxYVLDOvRGtUreXF8L3c8wyg=
-github.com/aws/aws-sdk-go-v2/service/sso v1.11.26/go.mod h1:uB9tV79ULEZUXc6Ob18A46KSQ0JDlrplPni9XW6Ot60=
-github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.9 h1:wihKuqYUlA2T/Rx+yu2s6NDAns8B9DgnRooB1PVhY+Q=
-github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.9/go.mod h1:2E/3D/mB8/r2J7nK42daoKP/ooCwbf0q1PznNc+DZTU=
-github.com/aws/aws-sdk-go-v2/service/sts v1.17.6 h1:VQFOLQVL3BrKM/NLO/7FiS4vcp5bqK0mGMyk09xLoAY=
-github.com/aws/aws-sdk-go-v2/service/sts v1.17.6/go.mod h1:Az3OXXYGyfNwQNsK/31L4R75qFYnO641RZGAoV3uH1c=
+github.com/aws/aws-sdk-go-v2 v1.17.3 h1:shN7NlnVzvDUgPQ+1rLMSxY8OWRNDRYtiqe0p/PgrhY=
+github.com/aws/aws-sdk-go-v2 v1.17.3/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
+github.com/aws/aws-sdk-go-v2/config v1.18.7 h1:V94lTcix6jouwmAsgQMAEBozVAGJMFhVj+6/++xfe3E=
+github.com/aws/aws-sdk-go-v2/config v1.18.7/go.mod h1:OZYsyHFL5PB9UpyS78NElgKs11qI/B5KJau2XOJDXHA=
+github.com/aws/aws-sdk-go-v2/credentials v1.13.7 h1:qUUcNS5Z1092XBFT66IJM7mYkMwgZ8fcC8YDIbEwXck=
+github.com/aws/aws-sdk-go-v2/credentials v1.13.7/go.mod h1:AdCcbZXHQCjJh6NaH3pFaw8LUeBFn5+88BZGMVGuBT8=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.21 h1:j9wi1kQ8b+e0FBVHxCqCGo4kxDU175hoDHcWAi0sauU=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.21/go.mod h1:ugwW57Z5Z48bpvUyZuaPy4Kv+vEfJWnIrky7RmkBvJg=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.27 h1:I3cakv2Uy1vNmmhRQmFptYDxOvBnwCdNwyw63N0RaRU=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.27/go.mod h1:a1/UpzeyBBerajpnP5nGZa9mGzsBn5cOKxm6NWQsvoI=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.21 h1:5NbbMrIzmUn/TXFqAle6mgrH5m9cOvMLRGL7pnG8tRE=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.21/go.mod h1:+Gxn8jYn5k9ebfHEqlhrMirFjSW0v0C9fI+KN5vk2kE=
+github.com/aws/aws-sdk-go-v2/internal/ini v1.3.28 h1:KeTxcGdNnQudb46oOl4d90f2I33DF/c6q3RnZAmvQdQ=
+github.com/aws/aws-sdk-go-v2/internal/ini v1.3.28/go.mod h1:yRZVr/iT0AqyHeep00SZ4YfBAKojXz08w3XMBscdi0c=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.21 h1:5C6XgTViSb0bunmU57b3CT+MhxULqHH2721FVA+/kDM=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.21/go.mod h1:lRToEJsn+DRA9lW4O9L9+/3hjTkUzlzyzHqn8MTds5k=
+github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.10 h1:6obimjQAiRlEUZT7a2Q1ikH7ck4cPO3phGz4wqI5f2w=
+github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.10/go.mod h1:jAeo/PdIJZuDSwsvxJS94G4d6h8tStj7WXVuKwLHWU8=
+github.com/aws/aws-sdk-go-v2/service/sso v1.11.28 h1:gItLq3zBYyRDPmqAClgzTH8PBjDQGeyptYGHIwtYYNA=
+github.com/aws/aws-sdk-go-v2/service/sso v1.11.28/go.mod h1:wo/B7uUm/7zw/dWhBJ4FXuw1sySU5lyIhVg1Bu2yL9A=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.11 h1:KCacyVSs/wlcPGx37hcbT3IGYO8P8Jx+TgSDhAXtQMY=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.11/go.mod h1:TZSH7xLO7+phDtViY/KUp9WGCJMQkLJ/VpgkTFd5gh8=
+github.com/aws/aws-sdk-go-v2/service/sts v1.17.7 h1:9Mtq1KM6nD8/+HStvWcvYnixJ5N85DX+P+OY3kI3W2k=
+github.com/aws/aws-sdk-go-v2/service/sts v1.17.7/go.mod h1:+lGbb3+1ugwKrNTWcf2RT05Xmp543B06zDFTwiTLp7I=
github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8=
github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/aymanbagabas/go-osc52 v1.0.3/go.mod h1:zT8H+Rk4VSabYN90pWyugflM3ZhpTZNC7cASDfUCdT4=
@@ -77,8 +77,8 @@ github.com/charmbracelet/lipgloss v0.5.0/go.mod h1:EZLha/HbzEt7cYqdFPovlqy5FZPj0
github.com/charmbracelet/lipgloss v0.6.0 h1:1StyZB9vBSOyuZxQUcUwGr17JmojPNm87inij9N3wJY=
github.com/charmbracelet/lipgloss v0.6.0/go.mod h1:tHh2wr34xcHjC2HCXIlGSG1jaDF0S0atAUvBMP6Ppuk=
github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I=
-github.com/cloudflare/circl v1.3.0 h1:Anq00jxDtoyX3+aCaYUZ0vXC5r4k4epberfWGDXV1zE=
-github.com/cloudflare/circl v1.3.0/go.mod h1:+CauBF6R70Jqcyl8N2hC8pAXYbWkGIezuSbuGLtRhnw=
+github.com/cloudflare/circl v1.3.1 h1:4OVCZRL62ijwEwxnF6I7hLwxvIYi3VaZt8TflkqtrtA=
+github.com/cloudflare/circl v1.3.1/go.mod h1:+CauBF6R70Jqcyl8N2hC8pAXYbWkGIezuSbuGLtRhnw=
github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw=
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
@@ -266,7 +266,6 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
-github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
@@ -282,8 +281,8 @@ github.com/twpayne/go-vfs/v4 v4.1.0 h1:58tmzvh3AEKgqXlRZvlKn9HD6g1Q9T9bYdob0GhAR
github.com/twpayne/go-vfs/v4 v4.1.0/go.mod h1:05bOnh2SNnRsIp/ensn6WLeHSttxklPlQzi4JtTGofc=
github.com/twpayne/go-xdg/v6 v6.0.0 h1:kt2KGpflK5q8ZpkmQfX6kJphh6+oAWikf4LiAZxFT0Y=
github.com/twpayne/go-xdg/v6 v6.0.0/go.mod h1:XlfiGBU0iBxudVRWh+SXF+I1Cfb7rMq1IFwOprG4Ts8=
-github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8=
-github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
+github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
+github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1 h1:+dBg5k7nuTE38VVdoroRsT0Z88fmvdYrI2EjzJst35I=
github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1/go.mod h1:nmuySobZb4kFgFy6BptpXp/BBw+xFSyvVPP6auoJB4k=
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
@@ -299,11 +298,10 @@ github.com/zalando/go-keyring v0.2.1 h1:MBRN/Z8H4U5wEKXiD67YbDAr5cj/DOStmSga70/2
github.com/zalando/go-keyring v0.2.1/go.mod h1:g63M2PPn0w5vjmEbwAX3ib5I+41zdm4esSETOn9Y6Dw=
go.etcd.io/bbolt v1.3.7-0.20220226045046-fd5535f71f48 h1:edJBWeGHJkzwvJ8ReW0h50BRw6ikNVtrzhqtbseIAL8=
go.etcd.io/bbolt v1.3.7-0.20220226045046-fd5535f71f48/go.mod h1:sh/Yp01MYDakY7RVfzKZn+T1WOMTTFJrWjl7+M73RXA=
-go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
-go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8=
-go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
+go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
+go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
@@ -312,8 +310,8 @@ golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
-golang.org/x/exp v0.0.0-20221211140036-ad323defaf05 h1:T8EldfGCcveFMewH5xAYxxoX3PSQMrsechlUGVFlQBU=
-golang.org/x/exp v0.0.0-20221211140036-ad323defaf05/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
+golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15 h1:5oN1Pz/eDhCpbMbLstvIPa0b/BEQo6g6nwV3pLjfM6w=
+golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
chore
|
Update dependencies
|
c4a4779416721e6976baefb7fcbe3ebd3477f826
|
2022-05-16 23:55:33
|
Tom Payne
|
feat: Build for mips64 and mips64le
| false
|
diff --git a/.goreleaser.yaml b/.goreleaser.yaml
index 0979199ae11..b6b9e67ad72 100644
--- a/.goreleaser.yaml
+++ b/.goreleaser.yaml
@@ -52,6 +52,8 @@ builds:
- amd64
- arm
- arm64
+ - mips64
+ - mips64le
- ppc64
- ppc64le
- s390x
diff --git a/assets/chezmoi.io/docs/install.md.tmpl b/assets/chezmoi.io/docs/install.md.tmpl
index 5a41ac6f253..a45d6a0d5e6 100644
--- a/assets/chezmoi.io/docs/install.md.tmpl
+++ b/assets/chezmoi.io/docs/install.md.tmpl
@@ -148,19 +148,19 @@ Download a package for your distribution and architecture.
=== "deb"
-{{ range $arch := list "amd64" "arm64" "armel" "i386" "ppc64" "ppc64le" "s390x" }}
+{{ range $arch := list "amd64" "arm64" "armel" "i386" "mips64" "mips64le" "ppc64" "ppc64le" "s390x" }}
[`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_linux_{{ $arch }}.deb)
{{- end }}
=== "rpm"
-{{ range $arch := list "aarch64" "armhfp" "i686" "ppc64" "ppc64le" "s390x" "x86_64" }}
+{{ range $arch := list "aarch64" "armhfp" "i686" "mips64" "mips64le" "ppc64" "ppc64le" "s390x" "x86_64" }}
[`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi-{{ $version }}-{{ $arch }}.rpm)
{{- end }}
=== "apk"
-{{ range $arch := list "386" "amd64" "arm" "arm64" "ppc64" "ppc64le" "s390x" }}
+{{ range $arch := list "386" "amd64" "arm" "arm64" "mips64" "mips64le" "ppc64" "ppc64le" "s390x" }}
[`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_linux_{{ $arch }}.apk)
{{- end }}
@@ -171,7 +171,7 @@ pre-built binary and shell completions.
=== "Linux"
-{{ range $arch := list "amd64" "arm" "arm64" "i386" "ppc64" "ppc64le" "s390x" }}
+{{ range $arch := list "amd64" "arm" "arm64" "i386" "mips64" "mips64le" "ppc64" "ppc64le" "s390x" }}
[`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_linux_{{ $arch }}.tar.gz)
{{- end }}
[`amd64` (glibc)](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_linux-glibc_amd64.tar.gz)
diff --git a/assets/scripts/install.sh b/assets/scripts/install.sh
index 5e321284d01..5be59e10774 100644
--- a/assets/scripts/install.sh
+++ b/assets/scripts/install.sh
@@ -162,6 +162,8 @@ check_goos_goarch() {
linux/amd64) return 0 ;;
linux/arm) return 0 ;;
linux/arm64) return 0 ;;
+ linux/mips64) return 0 ;;
+ linux/mips64le) return 0 ;;
linux/ppc64) return 0 ;;
linux/ppc64le) return 0 ;;
linux/s390x) return 0 ;;
@@ -169,6 +171,7 @@ check_goos_goarch() {
openbsd/amd64) return 0 ;;
openbsd/arm) return 0 ;;
openbsd/arm64) return 0 ;;
+ openbsd/mips64) return 0 ;;
solaris/amd64) return 0 ;;
windows/386) return 0 ;;
windows/amd64) return 0 ;;
|
feat
|
Build for mips64 and mips64le
|
c6718acb5df8663caea1115456ab7aa3fd22815a
|
2022-10-31 22:18:15
|
Braden Hilton
|
fix: Revert cpina/github-action-push-to-another-repository version bump
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 25ec562e5b0..61723593f03 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -456,7 +456,7 @@ jobs:
cp assets/scripts/install.ps1 assets/get.chezmoi.io/ps1
cp LICENSE assets/get.chezmoi.io/LICENSE
- name: push-get.chezmoi.io
- uses: cpina/github-action-push-to-another-repository@940a2857e598a6392bd336330b07416c1ae8ea1f
+ uses: cpina/github-action-push-to-another-repository@9e487f29582587eeb4837c0552c886bb0644b6b9
env:
SSH_DEPLOY_KEY: ${{ secrets.GET_CHEZMOI_IO_SSH_DEPLOY_KEY }}
with:
|
fix
|
Revert cpina/github-action-push-to-another-repository version bump
|
48e23ff7eb976ccead098a7128cf26ec9d960f0f
|
2025-01-08 02:05:43
|
Tom Payne
|
feat: Show all contributors in README.md
| false
|
diff --git a/README.md b/README.md
index 0a01dc0be41..438121d2c97 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ If you're contributing to chezmoi, then please read the [developer guide](https:
## Contributors
<a href="https://github.com/twpayne/chezmoi/graphs/contributors">
- <img src="https://contrib.rocks/image?repo=twpayne/chezmoi" />
+ <img src="https://contrib.rocks/image?repo=twpayne/chezmoi&max=1024" />
</a>
## License
|
feat
|
Show all contributors in README.md
|
725f4b04ecc7da1ec0de06d2872cc85dd8ca17d1
|
2023-02-13 03:39:44
|
Tom Payne
|
feat: Print a warning when chezmoi add is called with an ignored entry
| false
|
diff --git a/assets/chezmoi.io/docs/reference/commands/add.md b/assets/chezmoi.io/docs/reference/commands/add.md
index f2459dfbd52..7845238c6a0 100644
--- a/assets/chezmoi.io/docs/reference/commands/add.md
+++ b/assets/chezmoi.io/docs/reference/commands/add.md
@@ -37,6 +37,10 @@ Only add entries of type *types*.
Interactively prompt before adding each file.
+## `-q`, `--quiet`
+
+Suppress warnings about adding ignored entries.
+
## `-r`, `--recursive`
Recursively add all files, directories, and symlinks.
diff --git a/pkg/chezmoi/sourcestate.go b/pkg/chezmoi/sourcestate.go
index 742c507ff79..58a6676a65c 100644
--- a/pkg/chezmoi/sourcestate.go
+++ b/pkg/chezmoi/sourcestate.go
@@ -290,6 +290,7 @@ type AddOptions struct {
EncryptedSuffix string // Suffix for encrypted files.
Exact bool // Add the exact_ attribute to added directories.
Filter *EntryTypeFilter // Entry type filter.
+ OnIgnoreFunc func(RelPath) // Function to call when a target is ignored.
PreAddFunc PreAddFunc // Function to be called before a source entry is added.
RemoveDir RelPath // Directory to remove before adding.
ReplaceFunc ReplaceFunc // Function to be called before a source entry is replaced.
@@ -325,6 +326,9 @@ DESTABSPATH:
targetRelPath := destAbsPath.MustTrimDirPrefix(s.destDirAbsPath)
if s.Ignore(targetRelPath) {
+ if options.OnIgnoreFunc != nil {
+ options.OnIgnoreFunc(targetRelPath)
+ }
continue
}
diff --git a/pkg/cmd/addcmd.go b/pkg/cmd/addcmd.go
index bb58655250d..bb0d1bbbc21 100644
--- a/pkg/cmd/addcmd.go
+++ b/pkg/cmd/addcmd.go
@@ -17,6 +17,7 @@ type addCmdConfig struct {
filter *chezmoi.EntryTypeFilter
follow bool
prompt bool
+ quiet bool
recursive bool
template bool
}
@@ -47,6 +48,7 @@ func (c *Config) newAddCmd() *cobra.Command {
flags.BoolVarP(&c.Add.follow, "follow", "f", c.Add.follow, "Add symlink targets instead of symlinks")
flags.VarP(c.Add.filter.Include, "include", "i", "Include entry types")
flags.BoolVarP(&c.Add.prompt, "prompt", "p", c.Add.prompt, "Prompt before adding each entry")
+ flags.BoolVarP(&c.Add.quiet, "quiet", "q", c.Add.quiet, "Suppress warnings")
flags.BoolVarP(&c.Add.recursive, "recursive", "r", c.Add.recursive, "Recurse into subdirectories")
flags.BoolVarP(&c.Add.template, "template", "T", c.Add.template, "Add files as templates")
flags.BoolVar(&c.Add.TemplateSymlinks, "template-symlinks", c.Add.TemplateSymlinks, "Add symlinks with target in source or home dirs as templates") //nolint:lll
@@ -56,6 +58,12 @@ func (c *Config) newAddCmd() *cobra.Command {
return addCmd
}
+func (c *Config) defaultOnIgnoreFunc(targetRelPath chezmoi.RelPath) {
+ if !c.Add.quiet {
+ c.errorf("warning: ignoring %s", targetRelPath)
+ }
+}
+
func (c *Config) defaultPreAddFunc(targetRelPath chezmoi.RelPath) error {
if !c.Add.prompt {
return nil
@@ -147,6 +155,7 @@ func (c *Config) runAddCmd(cmd *cobra.Command, args []string, sourceState *chezm
EncryptedSuffix: c.encryption.EncryptedSuffix(),
Exact: c.Add.exact,
Filter: c.Add.filter,
+ OnIgnoreFunc: c.defaultOnIgnoreFunc,
PreAddFunc: c.defaultPreAddFunc,
ReplaceFunc: c.defaultReplaceFunc,
Template: c.Add.template,
diff --git a/pkg/cmd/testdata/scripts/add.txtar b/pkg/cmd/testdata/scripts/add.txtar
index 4469d76adf7..91094644d6b 100644
--- a/pkg/cmd/testdata/scripts/add.txtar
+++ b/pkg/cmd/testdata/scripts/add.txtar
@@ -59,6 +59,7 @@ chhome home3/user
# test that chezmoi add respects .chezmoiignore
exec chezmoi add $HOME${/}.dir
exists $CHEZMOISOURCEDIR/dot_dir/file
+stderr 'warning: ignoring'
! exists $CHEZMOISOURCEDIR/dot_dir/ignore
chhome home4/user
|
feat
|
Print a warning when chezmoi add is called with an ignored entry
|
6b013c78ee463e4a5af027ea7483c1ace88693bb
|
2025-03-22 03:23:55
|
Ville Skyttä
|
feat: Prevent inapplicable filename positional arguments
| false
|
diff --git a/internal/cmd/catconfigcmd.go b/internal/cmd/catconfigcmd.go
index 73f6de346c7..c6210111373 100644
--- a/internal/cmd/catconfigcmd.go
+++ b/internal/cmd/catconfigcmd.go
@@ -4,12 +4,13 @@ import "github.com/spf13/cobra"
func (c *Config) newCatConfigCmd() *cobra.Command {
catConfigCmd := &cobra.Command{
- Use: "cat-config",
- Short: "Print the configuration file",
- Long: mustLongHelp("cat-config"),
- Example: example("cat-config"),
- Args: cobra.NoArgs,
- RunE: c.runCatConfigCmd,
+ Use: "cat-config",
+ Short: "Print the configuration file",
+ Long: mustLongHelp("cat-config"),
+ Example: example("cat-config"),
+ Args: cobra.NoArgs,
+ ValidArgsFunction: cobra.NoFileCompletions,
+ RunE: c.runCatConfigCmd,
Annotations: newAnnotations(
doesNotRequireValidConfig,
persistentStateModeReadOnly,
diff --git a/internal/cmd/datacmd.go b/internal/cmd/datacmd.go
index d7d97b934fb..4d05d904f85 100644
--- a/internal/cmd/datacmd.go
+++ b/internal/cmd/datacmd.go
@@ -14,12 +14,13 @@ type dataCmdConfig struct {
func (c *Config) newDataCmd() *cobra.Command {
dataCmd := &cobra.Command{
- Use: "data",
- Short: "Print the template data",
- Long: mustLongHelp("data"),
- Example: example("data"),
- Args: cobra.NoArgs,
- RunE: c.runDataCmd,
+ Use: "data",
+ Short: "Print the template data",
+ Long: mustLongHelp("data"),
+ Example: example("data"),
+ Args: cobra.NoArgs,
+ ValidArgsFunction: cobra.NoFileCompletions,
+ RunE: c.runDataCmd,
Annotations: newAnnotations(
persistentStateModeReadOnly,
),
diff --git a/internal/cmd/doctorcmd.go b/internal/cmd/doctorcmd.go
index db3e0b65853..df08bad3f1e 100644
--- a/internal/cmd/doctorcmd.go
+++ b/internal/cmd/doctorcmd.go
@@ -150,12 +150,13 @@ type doctorCmdConfig struct {
func (c *Config) newDoctorCmd() *cobra.Command {
doctorCmd := &cobra.Command{
- Args: cobra.NoArgs,
- Use: "doctor",
- Short: "Check your system for potential problems",
- Example: example("doctor"),
- Long: mustLongHelp("doctor"),
- RunE: c.runDoctorCmd,
+ Args: cobra.NoArgs,
+ ValidArgsFunction: cobra.NoFileCompletions,
+ Use: "doctor",
+ Short: "Check your system for potential problems",
+ Example: example("doctor"),
+ Long: mustLongHelp("doctor"),
+ RunE: c.runDoctorCmd,
Annotations: newAnnotations(
doesNotRequireValidConfig,
persistentStateModeNone,
diff --git a/internal/cmd/dumpconfigcmd.go b/internal/cmd/dumpconfigcmd.go
index 923d93371a5..e5751d8f95a 100644
--- a/internal/cmd/dumpconfigcmd.go
+++ b/internal/cmd/dumpconfigcmd.go
@@ -12,12 +12,13 @@ type dumpConfigCmdConfig struct {
func (c *Config) newDumpConfigCmd() *cobra.Command {
dumpConfigCmd := &cobra.Command{
- Use: "dump-config",
- Short: "Dump the configuration values",
- Long: mustLongHelp("dump-config"),
- Example: example("dump-config"),
- Args: cobra.NoArgs,
- RunE: c.runDumpConfigCmd,
+ Use: "dump-config",
+ Short: "Dump the configuration values",
+ Long: mustLongHelp("dump-config"),
+ Example: example("dump-config"),
+ Args: cobra.NoArgs,
+ ValidArgsFunction: cobra.NoFileCompletions,
+ RunE: c.runDumpConfigCmd,
Annotations: newAnnotations(
persistentStateModeReadOnly,
),
diff --git a/internal/cmd/editconfigcmd.go b/internal/cmd/editconfigcmd.go
index e85b80c7f49..c0dc588237d 100644
--- a/internal/cmd/editconfigcmd.go
+++ b/internal/cmd/editconfigcmd.go
@@ -6,12 +6,13 @@ import (
func (c *Config) newEditConfigCmd() *cobra.Command {
editConfigCmd := &cobra.Command{
- Use: "edit-config",
- Short: "Edit the configuration file",
- Long: mustLongHelp("edit-config"),
- Example: example("edit-config"),
- Args: cobra.NoArgs,
- RunE: c.runEditConfigCmd,
+ Use: "edit-config",
+ Short: "Edit the configuration file",
+ Long: mustLongHelp("edit-config"),
+ Example: example("edit-config"),
+ Args: cobra.NoArgs,
+ ValidArgsFunction: cobra.NoFileCompletions,
+ RunE: c.runEditConfigCmd,
Annotations: newAnnotations(
doesNotRequireValidConfig,
modifiesConfigFile,
diff --git a/internal/cmd/editconfigtemplatecmd.go b/internal/cmd/editconfigtemplatecmd.go
index e6304a3689e..908ae2d6710 100644
--- a/internal/cmd/editconfigtemplatecmd.go
+++ b/internal/cmd/editconfigtemplatecmd.go
@@ -11,12 +11,13 @@ import (
func (c *Config) newEditConfigTemplateCmd() *cobra.Command {
editConfigCmd := &cobra.Command{
- Use: "edit-config-template",
- Short: "Edit the configuration file template",
- Long: mustLongHelp("edit-config-template"),
- Example: example("edit-config-template"),
- Args: cobra.NoArgs,
- RunE: c.makeRunEWithSourceState(c.runEditConfigTemplateCmd),
+ Use: "edit-config-template",
+ Short: "Edit the configuration file template",
+ Long: mustLongHelp("edit-config-template"),
+ Example: example("edit-config-template"),
+ Args: cobra.NoArgs,
+ ValidArgsFunction: cobra.NoFileCompletions,
+ RunE: c.makeRunEWithSourceState(c.runEditConfigTemplateCmd),
Annotations: newAnnotations(
doesNotRequireValidConfig,
modifiesSourceDirectory,
diff --git a/internal/cmd/helpcmd.go b/internal/cmd/helpcmd.go
index aa810229400..328c44eebb4 100644
--- a/internal/cmd/helpcmd.go
+++ b/internal/cmd/helpcmd.go
@@ -9,11 +9,12 @@ import (
func (c *Config) newHelpCmd() *cobra.Command {
helpCmd := &cobra.Command{
- Use: "help [command]",
- Short: "Print help about a command",
- Long: mustLongHelp("help"),
- Example: example("help"),
- RunE: c.runHelpCmd,
+ Use: "help [command]",
+ Short: "Print help about a command",
+ Long: mustLongHelp("help"),
+ Example: example("help"),
+ RunE: c.runHelpCmd,
+ ValidArgsFunction: cobra.NoFileCompletions,
Annotations: newAnnotations(
doesNotRequireValidConfig,
persistentStateModeNone,
diff --git a/internal/cmd/ignoredcmd.go b/internal/cmd/ignoredcmd.go
index de917251233..59f929f4197 100644
--- a/internal/cmd/ignoredcmd.go
+++ b/internal/cmd/ignoredcmd.go
@@ -13,12 +13,13 @@ type ignoredCmdConfig struct {
func (c *Config) newIgnoredCmd() *cobra.Command {
ignoredCmd := &cobra.Command{
- Use: "ignored",
- Short: "Print ignored targets",
- Long: mustLongHelp("ignored"),
- Example: example("ignored"),
- Args: cobra.NoArgs,
- RunE: c.makeRunEWithSourceState(c.runIgnoredCmd),
+ Use: "ignored",
+ Short: "Print ignored targets",
+ Long: mustLongHelp("ignored"),
+ Example: example("ignored"),
+ Args: cobra.NoArgs,
+ ValidArgsFunction: cobra.NoFileCompletions,
+ RunE: c.makeRunEWithSourceState(c.runIgnoredCmd),
Annotations: newAnnotations(
persistentStateModeReadMockWrite,
),
diff --git a/internal/cmd/licensecmd.go b/internal/cmd/licensecmd.go
index 8314b7cf5b5..ed37617087a 100644
--- a/internal/cmd/licensecmd.go
+++ b/internal/cmd/licensecmd.go
@@ -6,12 +6,13 @@ import (
func (c *Config) newLicenseCmd() *cobra.Command {
licenseCmd := &cobra.Command{
- Use: "license",
- Short: "Print license",
- Long: mustLongHelp("license"),
- Example: example("license"),
- Args: cobra.NoArgs,
- RunE: c.runLicenseCmd,
+ Use: "license",
+ Short: "Print license",
+ Long: mustLongHelp("license"),
+ Example: example("license"),
+ Args: cobra.NoArgs,
+ ValidArgsFunction: cobra.NoFileCompletions,
+ RunE: c.runLicenseCmd,
Annotations: newAnnotations(
doesNotRequireValidConfig,
persistentStateModeNone,
diff --git a/internal/cmd/purgecmd.go b/internal/cmd/purgecmd.go
index bb96235b98f..00bd31b466a 100644
--- a/internal/cmd/purgecmd.go
+++ b/internal/cmd/purgecmd.go
@@ -19,12 +19,13 @@ type purgeCmdConfig struct {
func (c *Config) newPurgeCmd() *cobra.Command {
purgeCmd := &cobra.Command{
- Use: "purge",
- Short: "Purge chezmoi's configuration and data",
- Long: mustLongHelp("purge"),
- Example: example("purge"),
- Args: cobra.NoArgs,
- RunE: c.runPurgeCmd,
+ Use: "purge",
+ Short: "Purge chezmoi's configuration and data",
+ Long: mustLongHelp("purge"),
+ Example: example("purge"),
+ Args: cobra.NoArgs,
+ ValidArgsFunction: cobra.NoFileCompletions,
+ RunE: c.runPurgeCmd,
Annotations: newAnnotations(
modifiesDestinationDirectory,
modifiesSourceDirectory,
diff --git a/internal/cmd/updatecmd.go b/internal/cmd/updatecmd.go
index e6a7b8d4713..01735a83f6e 100644
--- a/internal/cmd/updatecmd.go
+++ b/internal/cmd/updatecmd.go
@@ -22,12 +22,13 @@ type updateCmdConfig struct {
func (c *Config) newUpdateCmd() *cobra.Command {
updateCmd := &cobra.Command{
- Use: "update",
- Short: "Pull and apply any changes",
- Long: mustLongHelp("update"),
- Example: example("update"),
- Args: cobra.NoArgs,
- RunE: c.runUpdateCmd,
+ Use: "update",
+ Short: "Pull and apply any changes",
+ Long: mustLongHelp("update"),
+ Example: example("update"),
+ Args: cobra.NoArgs,
+ ValidArgsFunction: cobra.NoFileCompletions,
+ RunE: c.runUpdateCmd,
Annotations: newAnnotations(
modifiesDestinationDirectory,
persistentStateModeReadWrite,
diff --git a/internal/cmd/upgradecmd.go b/internal/cmd/upgradecmd.go
index cbbadba6fb3..248ed0e239e 100644
--- a/internal/cmd/upgradecmd.go
+++ b/internal/cmd/upgradecmd.go
@@ -49,12 +49,13 @@ type upgradeCmdConfig struct {
func (c *Config) newUpgradeCmd() *cobra.Command {
upgradeCmd := &cobra.Command{
- Use: "upgrade",
- Short: "Upgrade chezmoi to the latest released version",
- Long: mustLongHelp("upgrade"),
- Example: example("upgrade"),
- Args: cobra.NoArgs,
- RunE: c.runUpgradeCmd,
+ Use: "upgrade",
+ Short: "Upgrade chezmoi to the latest released version",
+ Long: mustLongHelp("upgrade"),
+ Example: example("upgrade"),
+ Args: cobra.NoArgs,
+ ValidArgsFunction: cobra.NoFileCompletions,
+ RunE: c.runUpgradeCmd,
Annotations: newAnnotations(
persistentStateModeNone,
runsCommands,
|
feat
|
Prevent inapplicable filename positional arguments
|
d61300bac08afdf75397acefc970d4b425f67a36
|
2021-10-28 02:56:18
|
Tom Payne
|
chore: Improve upgrade command infrastructure
| false
|
diff --git a/internal/cmd/config.go b/internal/cmd/config.go
index 78615013ed8..fb374784014 100644
--- a/internal/cmd/config.go
+++ b/internal/cmd/config.go
@@ -365,6 +365,10 @@ func newConfig(options ...configOption) (*Config, error) {
include: chezmoi.NewEntryTypeSet(chezmoi.EntryTypesAll),
recursive: true,
},
+ upgrade: upgradeCmdConfig{
+ owner: "twpayne",
+ repo: "chezmoi",
+ },
verify: verifyCmdConfig{
exclude: chezmoi.NewEntryTypeSet(chezmoi.EntryTypesNone),
include: chezmoi.NewEntryTypeSet(chezmoi.EntryTypesAll &^ chezmoi.EntryTypeScripts),
diff --git a/internal/cmd/noupgradecmd.go b/internal/cmd/noupgradecmd.go
index 156ddd0810c..c6bc699f14f 100644
--- a/internal/cmd/noupgradecmd.go
+++ b/internal/cmd/noupgradecmd.go
@@ -7,7 +7,11 @@ import (
"github.com/spf13/cobra"
)
-type upgradeCmdConfig struct{}
+type upgradeCmdConfig struct {
+ method string
+ owner string
+ repo string
+}
func (c *Config) newUpgradeCmd() *cobra.Command {
return nil
diff --git a/internal/cmd/upgradecmd.go b/internal/cmd/upgradecmd.go
index 48519a179de..d6e49d11cfa 100644
--- a/internal/cmd/upgradecmd.go
+++ b/internal/cmd/upgradecmd.go
@@ -86,10 +86,6 @@ type upgradeCmdConfig struct {
}
func (c *Config) newUpgradeCmd() *cobra.Command {
- if runtime.GOOS == "windows" {
- return nil
- }
-
upgradeCmd := &cobra.Command{
Use: "upgrade",
Short: "Upgrade chezmoi to the latest released version",
@@ -103,9 +99,9 @@ func (c *Config) newUpgradeCmd() *cobra.Command {
}
flags := upgradeCmd.Flags()
- flags.StringVar(&c.upgrade.method, "method", "", "Set upgrade method")
- flags.StringVar(&c.upgrade.owner, "owner", "twpayne", "Set owner")
- flags.StringVar(&c.upgrade.repo, "repo", "chezmoi", "Set repo")
+ flags.StringVar(&c.upgrade.method, "method", c.upgrade.method, "Set upgrade method")
+ flags.StringVar(&c.upgrade.owner, "owner", c.upgrade.owner, "Set owner")
+ flags.StringVar(&c.upgrade.repo, "repo", c.upgrade.repo, "Set repo")
return upgradeCmd
}
@@ -172,7 +168,7 @@ func (c *Config) runUpgradeCmd(cmd *cobra.Command, args []string) error {
return err
}
default:
- return fmt.Errorf("%s: invalid --method value", method)
+ return fmt.Errorf("%s: invalid method", method)
}
// Find the executable. If we replaced the executable directly, then use
|
chore
|
Improve upgrade command infrastructure
|
fccc759a1cf5b08d33c1052580de19ec36c95d4f
|
2024-03-09 03:21:52
|
Tom Payne
|
fix: Handle copies in automatic commit messages
| false
|
diff --git a/assets/templates/COMMIT_MESSAGE.tmpl b/assets/templates/COMMIT_MESSAGE.tmpl
index dfaa92a40b7..244e89b38da 100644
--- a/assets/templates/COMMIT_MESSAGE.tmpl
+++ b/assets/templates/COMMIT_MESSAGE.tmpl
@@ -10,6 +10,7 @@
{{- range .RenamedOrCopied -}}
{{ if and (eq .X 'R') (eq .Y '.') }}Change attributes of {{ .Path | targetRelPath }}
+{{ else if and (eq .X 'C') (eq .Y '.') -}}Copy {{ .OrigPath | targetRelPath }} to {{ .Path | targetRelPath }}
{{ else }}{{with (printf "unsupported XY: %q" (printf "%c%c" .X .Y)) }}{{ fail . }}{{ end }}
{{ end }}
{{- end -}}
diff --git a/internal/chezmoigit/status_test.go b/internal/chezmoigit/status_test.go
index ca83916d9bb..a62c1e223fd 100644
--- a/internal/chezmoigit/status_test.go
+++ b/internal/chezmoigit/status_test.go
@@ -4,6 +4,8 @@ import (
"testing"
"github.com/alecthomas/assert/v2"
+
+ "github.com/twpayne/chezmoi/v2/internal/chezmoitest"
)
func TestParseStatusPorcelainV2(t *testing.T) {
@@ -56,6 +58,45 @@ func TestParseStatusPorcelainV2(t *testing.T) {
},
},
},
+ {
+ name: "copied",
+ outputStr: chezmoitest.JoinLines(
+ "2 C. N... 100644 100644 100644 4a58007052a65fbc2fc3f910f2855f45a4058e74 4a58007052a65fbc2fc3f910f2855f45a4058e74 C100 c\tb",
+ "2 R. N... 100644 100644 100644 4a58007052a65fbc2fc3f910f2855f45a4058e74 4a58007052a65fbc2fc3f910f2855f45a4058e74 R100 d\tb",
+ ),
+ expectedStatus: &Status{
+ RenamedOrCopied: []RenamedOrCopiedStatus{
+ {
+ X: 'C',
+ Y: '.',
+ Sub: "N...",
+ MH: 0o100644,
+ MI: 0o100644,
+ MW: 0o100644,
+ HH: "4a58007052a65fbc2fc3f910f2855f45a4058e74",
+ HI: "4a58007052a65fbc2fc3f910f2855f45a4058e74",
+ RC: 'C',
+ Score: 100,
+ Path: "c",
+ OrigPath: "b",
+ },
+ {
+ X: 'R',
+ Y: '.',
+ Sub: "N...",
+ MH: 0o100644,
+ MI: 0o100644,
+ MW: 0o100644,
+ HH: "4a58007052a65fbc2fc3f910f2855f45a4058e74",
+ HI: "4a58007052a65fbc2fc3f910f2855f45a4058e74",
+ RC: 'R',
+ Score: 100,
+ Path: "d",
+ OrigPath: "b",
+ },
+ },
+ },
+ },
{
name: "update",
outputStr: "1 .M N... 100644 100644 100644 353dbbb3c29a80fb44d4e26dac111739d25294db 353dbbb3c29a80fb44d4e26dac111739d25294db cmd/git.go\n",
diff --git a/internal/cmd/testdata/scripts/autocommit.txtar b/internal/cmd/testdata/scripts/autocommit.txtar
index caf7848dfbc..1ed0d473760 100644
--- a/internal/cmd/testdata/scripts/autocommit.txtar
+++ b/internal/cmd/testdata/scripts/autocommit.txtar
@@ -8,38 +8,47 @@ exec chezmoi init
# test that chezmoi add creates and pushes a commit
exec chezmoi add $HOME${/}.file
-exec git --git-dir=$CHEZMOISOURCEDIR/.git show HEAD
+exec git -C $CHEZMOISOURCEDIR show HEAD
stdout 'Add \.file'
# test that chezmoi edit creates and pushes a commit
exec chezmoi edit $HOME${/}.file
-exec git --git-dir=$CHEZMOISOURCEDIR/.git show HEAD
+exec git -C $CHEZMOISOURCEDIR show HEAD
stdout 'Update \.file'
# test that chezmoi chattr creates and pushes a commit
exec chezmoi chattr +executable $HOME${/}.file
-exec git --git-dir=$CHEZMOISOURCEDIR/.git show HEAD
+exec git -C $CHEZMOISOURCEDIR show HEAD
stdout 'Change attributes of \.file'
# test that chezmoi add on a directory creates and pushes a commit
exec chezmoi add $HOME${/}.dir
-exec git --git-dir=$CHEZMOISOURCEDIR/.git show HEAD
+exec git -C $CHEZMOISOURCEDIR show HEAD
stdout 'Add \.dir/file'
+# test that copying a file creates a valid commit message
+cp $CHEZMOISOURCEDIR/executable_dot_file $CHEZMOISOURCEDIR/executable_dot_file2
+mv $CHEZMOISOURCEDIR/executable_dot_file $CHEZMOISOURCEDIR/executable_dot_file3
+exec git -C $CHEZMOISOURCEDIR config --local diff.renames copies
+exec git -C $CHEZMOISOURCEDIR add .
+exec chezmoi edit $HOME${/}.dir${/}file
+exec git -C $CHEZMOISOURCEDIR show HEAD
+stdout 'Copy \.file to \.file2'
+
# test that chezmoi chattr on a file in a directory creates and pushes a commit
exec chezmoi chattr --debug +private $HOME${/}.dir/file
-exec git --git-dir=$CHEZMOISOURCEDIR/.git show HEAD
+exec git -C $CHEZMOISOURCEDIR show HEAD
stdout 'Change attributes of \.dir'
# test that chezmoi forget creates and pushes a commit
-exec chezmoi forget --force $HOME${/}.file
-exec git --git-dir=$CHEZMOISOURCEDIR/.git show HEAD
-stdout 'Remove \.file'
+exec chezmoi forget --force $HOME${/}.file2
+exec git -C $CHEZMOISOURCEDIR show HEAD
+stdout 'Remove \.file2'
# test that chezmoi edit uses a custom commit message template
appendline $CHEZMOICONFIGDIR/chezmoi.toml ' commitMessageTemplate = "{{ .prefix }}my commit message"'
exec chezmoi edit $HOME${/}.dir${/}file
-exec git --git-dir=$CHEZMOISOURCEDIR/.git show HEAD
+exec git -C $CHEZMOISOURCEDIR show HEAD
stdout 'feat: my commit message'
# test that only one of git.commitMessageTemplate and git.commitMessageTemplateFile can be set
@@ -50,7 +59,7 @@ removeline $CHEZMOICONFIGDIR/chezmoi.toml ' commitMessageTemplate = "{{ .pref
# test that chezmoi edit uses a custom commit message template file
exec chezmoi edit $HOME${/}.dir${/}file
-exec git --git-dir=$CHEZMOISOURCEDIR/.git show HEAD
+exec git -C $CHEZMOISOURCEDIR show HEAD
stdout 'feat: my commit message file'
removeline $CHEZMOICONFIGDIR/chezmoi.toml ' commitMessageTemplateFile = ".COMMIT_MESSAGE.tmpl"'
|
fix
|
Handle copies in automatic commit messages
|
a08c891939c7db4ccef801d377868d07e9c37d2f
|
2022-04-03 22:23:52
|
Tom Payne
|
fix: Fix use of drives as home directories on Windows
| false
|
diff --git a/pkg/chezmoi/abspath.go b/pkg/chezmoi/abspath.go
index 30e863c484a..d71a4709d0a 100644
--- a/pkg/chezmoi/abspath.go
+++ b/pkg/chezmoi/abspath.go
@@ -53,7 +53,7 @@ func (p AbsPath) Bytes() []byte {
// Dir returns p's directory.
func (p AbsPath) Dir() AbsPath {
- return NewAbsPath(path.Dir(p.absPath))
+ return NewAbsPath(filepath.Dir(p.absPath)).ToSlash()
}
// Empty returns if p is empty.
@@ -147,7 +147,7 @@ func (p AbsPath) TrimDirPrefix(dirPrefixAbsPath AbsPath) (RelPath, error) {
return EmptyRelPath, nil
}
dirAbsPath := dirPrefixAbsPath
- if dirAbsPath.absPath != "/" {
+ if !strings.HasSuffix(dirAbsPath.absPath, "/") {
dirAbsPath.absPath += "/"
}
if !strings.HasPrefix(p.absPath, dirAbsPath.absPath) {
diff --git a/pkg/chezmoi/path_windows_test.go b/pkg/chezmoi/path_windows_test.go
index fb295e1f7f1..b964076e293 100644
--- a/pkg/chezmoi/path_windows_test.go
+++ b/pkg/chezmoi/path_windows_test.go
@@ -1,11 +1,53 @@
package chezmoi
import (
+ "strconv"
"testing"
"github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
)
+func TestAbsPathTrimDirPrefix(t *testing.T) {
+ for i, tc := range []struct {
+ absPath AbsPath
+ dirPrefixAbsPath AbsPath
+ expected RelPath
+ }{
+ {
+ absPath: NewAbsPath("/home/user/.config"),
+ dirPrefixAbsPath: NewAbsPath("/home/user"),
+ expected: NewRelPath(".config"),
+ },
+ {
+ absPath: NewAbsPath("H:/.config"),
+ dirPrefixAbsPath: NewAbsPath("H:"),
+ expected: NewRelPath(".config"),
+ },
+ {
+ absPath: NewAbsPath("H:/.config"),
+ dirPrefixAbsPath: NewAbsPath("H:/"),
+ expected: NewRelPath(".config"),
+ },
+ {
+ absPath: NewAbsPath("H:/home/user/.config"),
+ dirPrefixAbsPath: NewAbsPath("H:/home/user"),
+ expected: NewRelPath(".config"),
+ },
+ {
+ absPath: NewAbsPath(`//server/user/.config`),
+ dirPrefixAbsPath: NewAbsPath(`//server/user`),
+ expected: NewRelPath(".config"),
+ },
+ } {
+ t.Run(strconv.Itoa(i), func(t *testing.T) {
+ actual, err := tc.absPath.TrimDirPrefix(tc.dirPrefixAbsPath)
+ require.NoError(t, err)
+ assert.Equal(t, tc.expected, actual)
+ })
+ }
+}
+
func TestNormalizeLinkname(t *testing.T) {
for _, tc := range []struct {
linkname string
|
fix
|
Fix use of drives as home directories on Windows
|
6866751451274c4d4255bdd62de524f86b48028e
|
2024-10-02 13:27:57
|
Tom Payne
|
chore: Build with Go 1.23.2
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 0d14c10e580..97a63a01c1b 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -16,7 +16,7 @@ env:
CHOCOLATEY_VERSION: 2.3.0 # https://github.com/chocolatey/choco/releases
EDITORCONFIG_CHECKER_VERSION: 3.0.3 # https://github.com/editorconfig-checker/editorconfig-checker/releases
FIND_TYPOS_VERSION: 0.0.3 # https://github.com/twpayne/find-typos/tags
- GO_VERSION: 1.23.1 # https://go.dev/doc/devel/release
+ GO_VERSION: 1.23.2 # https://go.dev/doc/devel/release
GOFUMPT_VERSION: 0.7.0 # https://github.com/mvdan/gofumpt/releases
GOLANGCI_LINT_VERSION: 1.61.0 # https://github.com/golangci/golangci-lint/releases
GOLINES_VERSION: 0.12.2 # https://github.com/segmentio/golines/releases
|
chore
|
Build with Go 1.23.2
|
f84b8e5ca2d59ba59cb5af7ca6f4430d0486d5a2
|
2024-09-19 23:03:50
|
Tom Payne
|
docs: Add note on reporting viruses or trojans on Windows
| false
|
diff --git a/assets/chezmoi.io/docs/developer-guide/security.md b/assets/chezmoi.io/docs/developer-guide/security.md
index a0dcd2597d0..6528c29e368 100644
--- a/assets/chezmoi.io/docs/developer-guide/security.md
+++ b/assets/chezmoi.io/docs/developer-guide/security.md
@@ -4,6 +4,16 @@
Only the most recent version of chezmoi is supported with security updates.
+## Virus scanner false positives
+
+Virus scanning software, especially on Windows machines, occasionally report
+viruses or trojans in the chezmoi binary. This is almost certainly a false
+positive.
+
+For more information see [Why does my virus-scanning software think my Go
+distribution or compiled binary is infected?](https://go.dev/doc/faq#virus) in
+the Go FAQ.
+
## Reporting a vulnerability
Please report vulnerabilities by [opening a GitHub
|
docs
|
Add note on reporting viruses or trojans on Windows
|
2d1dde49439b0638a0bf166ecdec1ab508496883
|
2024-11-05 02:55:53
|
Tom Payne
|
chore: Use must functions outside template functions
| false
|
diff --git a/internal/cmd/archivecmd.go b/internal/cmd/archivecmd.go
index a31367c69c4..dbe44e2531f 100644
--- a/internal/cmd/archivecmd.go
+++ b/internal/cmd/archivecmd.go
@@ -44,9 +44,7 @@ func (c *Config) newArchiveCmd() *cobra.Command {
archiveCmd.Flags().BoolVarP(&c.archive.parentDirs, "parent-dirs", "P", c.archive.parentDirs, "Archive parent directories")
archiveCmd.Flags().BoolVarP(&c.archive.recursive, "recursive", "r", c.archive.recursive, "Recurse into subdirectories")
- if err := archiveCmd.RegisterFlagCompletionFunc("format", chezmoi.ArchiveFormatFlagCompletionFunc); err != nil {
- panic(err)
- }
+ must(archiveCmd.RegisterFlagCompletionFunc("format", chezmoi.ArchiveFormatFlagCompletionFunc))
return archiveCmd
}
diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go
index d263b9ad1b9..efbfeea218b 100644
--- a/internal/cmd/cmd.go
+++ b/internal/cmd/cmd.go
@@ -52,10 +52,7 @@ type help struct {
}
func init() {
- dirEntries, err := commands.FS.ReadDir(".")
- if err != nil {
- panic(err)
- }
+ dirEntries := mustValue(commands.FS.ReadDir("."))
longHelpStyleConfig := styles.ASCIIStyleConfig
longHelpStyleConfig.Code.StylePrimitive.BlockPrefix = ""
@@ -63,39 +60,27 @@ func init() {
longHelpStyleConfig.Emph.BlockPrefix = ""
longHelpStyleConfig.Emph.BlockSuffix = ""
longHelpStyleConfig.H2.Prefix = ""
- longHelpTermRenderer, err := glamour.NewTermRenderer(
+ longHelpTermRenderer := mustValue(glamour.NewTermRenderer(
glamour.WithStyles(longHelpStyleConfig),
glamour.WithWordWrap(80),
- )
- if err != nil {
- panic(err)
- }
+ ))
exampleStyleConfig := styles.ASCIIStyleConfig
exampleStyleConfig.Code.StylePrimitive.BlockPrefix = ""
exampleStyleConfig.Code.StylePrimitive.BlockSuffix = ""
exampleStyleConfig.Document.Margin = nil
- exampleTermRenderer, err := glamour.NewTermRenderer(
+ exampleTermRenderer := mustValue(glamour.NewTermRenderer(
glamour.WithStyles(exampleStyleConfig),
glamour.WithWordWrap(80),
- )
- if err != nil {
- panic(err)
- }
+ ))
for _, dirEntry := range dirEntries {
if dirEntry.Name() == "index.md" {
continue
}
command := strings.TrimSuffix(dirEntry.Name(), ".md")
- data, err := commands.FS.ReadFile(dirEntry.Name())
- if err != nil {
- panic(err)
- }
- help, err := extractHelp(command, data, longHelpTermRenderer, exampleTermRenderer)
- if err != nil {
- panic(err)
- }
+ data := mustValue(commands.FS.ReadFile(dirEntry.Name()))
+ help := mustValue(extractHelp(command, data, longHelpTermRenderer, exampleTermRenderer))
helps[command] = help
}
}
diff --git a/internal/cmd/config.go b/internal/cmd/config.go
index 5e3c2fc52ee..b10c5e5aaff 100644
--- a/internal/cmd/config.go
+++ b/internal/cmd/config.go
@@ -1953,10 +1953,7 @@ func (c *Config) persistentPreRunRootE(cmd *cobra.Command, args []string) error
// Add the completion template function. This needs cmd, so we can't do it
// in newConfig.
c.addTemplateFunc("completion", func(shell string) string {
- completion, err := completion(cmd, shell)
- if err != nil {
- panic(err)
- }
+ completion := mustValue(completion(cmd, shell))
return completion
})
@@ -2942,9 +2939,7 @@ func (f *ConfigFile) toMap() map[string]any {
return nil
}
var result map[string]any
- if err := json.Unmarshal(data, &result); err != nil {
- panic(err)
- }
+ must(json.Unmarshal(data, &result))
return result
}
@@ -3009,9 +3004,7 @@ func registerCommonFlagCompletionFuncs(cmd *cobra.Command) {
return
}
if flagCompletionFunc, ok := commonFlagCompletionFuncs[flag.Name]; ok {
- if err := cmd.RegisterFlagCompletionFunc(flag.Name, flagCompletionFunc); err != nil {
- panic(err)
- }
+ must(cmd.RegisterFlagCompletionFunc(flag.Name, flagCompletionFunc))
}
})
for _, command := range cmd.Commands() {
diff --git a/internal/cmd/executetemplatecmd.go b/internal/cmd/executetemplatecmd.go
index 2366f2477d4..8d155145437 100644
--- a/internal/cmd/executetemplatecmd.go
+++ b/internal/cmd/executetemplatecmd.go
@@ -99,16 +99,12 @@ func (c *Config) runExecuteTemplateCmd(cmd *cobra.Command, args []string) error
}
return args[0]
default:
- err := fmt.Errorf("want 1 or 2 arguments, got %d", len(args)+1)
- panic(err)
+ panic(fmt.Errorf("want 1 or 2 arguments, got %d", len(args)+1))
}
}
promptBoolOnceInitTemplateFunc := func(m map[string]any, path any, field string, args ...bool) bool {
- nestedMap, lastKey, err := nestedMapAtPath(m, path)
- if err != nil {
- panic(err)
- }
+ nestedMap, lastKey := mustValues(nestedMapAtPath(m, path))
if value, ok := nestedMap[lastKey]; ok {
if boolValue, ok := value.(bool); ok {
return boolValue
@@ -118,10 +114,7 @@ func (c *Config) runExecuteTemplateCmd(cmd *cobra.Command, args []string) error
}
promptChoiceInitTemplateFunc := func(prompt string, choices any, args ...string) string {
- choiceStrs, err := anyToStringSlice(choices)
- if err != nil {
- panic(err)
- }
+ choiceStrs := mustValue(anyToStringSlice(choices))
switch len(args) {
case 0:
if value, ok := c.executeTemplate.promptChoice[prompt]; ok {
@@ -140,16 +133,12 @@ func (c *Config) runExecuteTemplateCmd(cmd *cobra.Command, args []string) error
}
return args[0]
default:
- err := fmt.Errorf("want 2 or 3 arguments, got %d", len(args)+1)
- panic(err)
+ panic(fmt.Errorf("want 2 or 3 arguments, got %d", len(args)+1))
}
}
promptChoiceOnceInitTemplateFunc := func(m map[string]any, path any, prompt string, choices []any, args ...string) string {
- nestedMap, lastKey, err := nestedMapAtPath(m, path)
- if err != nil {
- panic(err)
- }
+ nestedMap, lastKey := mustValues(nestedMapAtPath(m, path))
if value, ok := nestedMap[lastKey]; ok {
if stringValue, ok := value.(string); ok {
return stringValue
@@ -168,16 +157,12 @@ func (c *Config) runExecuteTemplateCmd(cmd *cobra.Command, args []string) error
}
return args[0]
default:
- err := fmt.Errorf("want 1 or 2 arguments, got %d", len(args)+1)
- panic(err)
+ panic(fmt.Errorf("want 1 or 2 arguments, got %d", len(args)+1))
}
}
promptIntOnceInitTemplateFunc := func(m map[string]any, path any, prompt string, args ...int64) int64 {
- nestedMap, lastKey, err := nestedMapAtPath(m, path)
- if err != nil {
- panic(err)
- }
+ nestedMap, lastKey := mustValues(nestedMapAtPath(m, path))
if value, ok := nestedMap[lastKey]; ok {
if intValue, ok := value.(int64); ok {
return intValue
@@ -199,16 +184,12 @@ func (c *Config) runExecuteTemplateCmd(cmd *cobra.Command, args []string) error
}
return args[0]
default:
- err := fmt.Errorf("want 1 or 2 arguments, got %d", len(args)+1)
- panic(err)
+ panic(fmt.Errorf("want 1 or 2 arguments, got %d", len(args)+1))
}
}
promptStringOnceInitTemplateFunc := func(m map[string]any, path any, prompt string, args ...string) string {
- nestedMap, lastKey, err := nestedMapAtPath(m, path)
- if err != nil {
- panic(err)
- }
+ nestedMap, lastKey := mustValues(nestedMapAtPath(m, path))
if value, ok := nestedMap[lastKey]; ok {
if stringValue, ok := value.(string); ok {
return stringValue
diff --git a/internal/cmd/unmanagedcmd.go b/internal/cmd/unmanagedcmd.go
index bd1b27a2380..b87616658cc 100644
--- a/internal/cmd/unmanagedcmd.go
+++ b/internal/cmd/unmanagedcmd.go
@@ -32,9 +32,7 @@ func (c *Config) newUnmanagedCmd() *cobra.Command {
unmanagedCmd.Flags().VarP(&c.unmanaged.pathStyle, "path-style", "p", "Path style")
unmanagedCmd.Flags().BoolVarP(&c.unmanaged.tree, "tree", "t", c.unmanaged.tree, "Print paths as a tree")
- if err := unmanagedCmd.RegisterFlagCompletionFunc("path-style", chezmoi.PathStyleSimpleFlagCompletionFunc); err != nil {
- panic(err)
- }
+ must(unmanagedCmd.RegisterFlagCompletionFunc("path-style", chezmoi.PathStyleSimpleFlagCompletionFunc))
return unmanagedCmd
}
|
chore
|
Use must functions outside template functions
|
89f72ee50a6a1cf3b05e4537047886ba388b0c4b
|
2024-09-10 04:04:21
|
Tom Payne
|
chore: Fix capitalization of chezmoi
| false
|
diff --git a/assets/chezmoi.io/docs/links/related-software.md b/assets/chezmoi.io/docs/links/related-software.md
index 9eff91d7924..ec544414101 100644
--- a/assets/chezmoi.io/docs/links/related-software.md
+++ b/assets/chezmoi.io/docs/links/related-software.md
@@ -39,7 +39,7 @@ Installs chezmoi on Ubuntu and Debian servers.
### [`github.com/johan-weitner/chezmoi-ui`](https://github.com/johan-weitner/chezmoi-ui)
-A web UI for managing a list of apps to seed/feed a Chezmoi setup.
+A web UI for managing a list of apps to seed/feed a chezmoi setup.
### [`github.com/joke/asdf-chezmoi`](https://github.com/joke/asdf-chezmoi)
diff --git a/assets/chezmoi.io/docs/reference/templates/1password-functions/index.md b/assets/chezmoi.io/docs/reference/templates/1password-functions/index.md
index f33e1ef8349..ceaf3ed0b3c 100644
--- a/assets/chezmoi.io/docs/reference/templates/1password-functions/index.md
+++ b/assets/chezmoi.io/docs/reference/templates/1password-functions/index.md
@@ -45,7 +45,7 @@ CLI](https://developer.1password.com/docs/cli) (`op`).
!!! warning
- Chezmoi has experimental support for [1Password secrets
+ chezmoi has experimental support for [1Password secrets
automation](../../../user-guide/password-managers/1password.md#secrets-automation)
modes. These modes change how the 1Password CLI works and affect all
functions. Most notably, `account` parameters are not allowed on all
diff --git a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/usage.md b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/usage.md
index a1cf3e1dc5c..19e5898ca06 100644
--- a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/usage.md
+++ b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/usage.md
@@ -115,7 +115,7 @@ if ! command -v curl >/dev/null; then
fi
```
-Chezmoi will make sure to execute it before templating other files.
+chezmoi will make sure to execute it before templating other files.
!!! tip
|
chore
|
Fix capitalization of chezmoi
|
8054dffcc66b4c6ff4f4b0388d3620833b055c30
|
2022-09-18 00:21:19
|
Tom Payne
|
fix: Don't write file specified by --output atomically
| false
|
diff --git a/pkg/cmd/config.go b/pkg/cmd/config.go
index 548ad1f92db..bcbfd8455f1 100644
--- a/pkg/cmd/config.go
+++ b/pkg/cmd/config.go
@@ -2175,7 +2175,8 @@ func (c *Config) writeOutput(data []byte) error {
_, err := c.stdout.Write(data)
return err
}
- return c.baseSystem.WriteFile(c.outputAbsPath, data, 0o666)
+ //nolint:gosec
+ return os.WriteFile(c.outputAbsPath.String(), data, 0o666)
}
// writeOutputString writes data to the configured output.
|
fix
|
Don't write file specified by --output atomically
|
f15b158d658228604943cad31c14a4e56c5cd777
|
2023-09-10 22:14:52
|
Tom Payne
|
feat: Add decryption of non-armored files to age command
| false
|
diff --git a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/encryption.md b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/encryption.md
index abca106a402..ac739715081 100644
--- a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/encryption.md
+++ b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/encryption.md
@@ -22,7 +22,7 @@ Generate an age private key encrypted with a passphrase in the file
`key.txt.age` with the command:
```console
-$ age-keygen | age --passphrase > key.txt.age
+$ age-keygen | age --armor --passphrase > key.txt.age
Public key: age193wd0hfuhtjfsunlq3c83s8m93pde442dkcn7lmj3lspeekm9g7stwutrl
Enter passphrase (leave empty to autogenerate a secure one):
Confirm passphrase:
diff --git a/internal/chezmoi/ageencryption.go b/internal/chezmoi/ageencryption.go
index db662555c60..a9785aabd3c 100644
--- a/internal/chezmoi/ageencryption.go
+++ b/internal/chezmoi/ageencryption.go
@@ -102,9 +102,11 @@ func (e *AgeEncryption) builtinDecrypt(ciphertext []byte) ([]byte, error) {
if err != nil {
return nil, err
}
- ciphertextReader := bytes.NewReader(ciphertext)
- armoredCiphertextReader := armor.NewReader(ciphertextReader)
- plaintextReader, err := age.Decrypt(armoredCiphertextReader, identities...)
+ var ciphertextReader io.Reader = bytes.NewReader(ciphertext)
+ if bytes.HasPrefix(ciphertext, []byte(armor.Header)) {
+ ciphertextReader = armor.NewReader(ciphertextReader)
+ }
+ plaintextReader, err := age.Decrypt(ciphertextReader, identities...)
if err != nil {
return nil, err
}
diff --git a/internal/cmd/agecmd.go b/internal/cmd/agecmd.go
index bc7ff05e061..70c084c0a20 100644
--- a/internal/cmd/agecmd.go
+++ b/internal/cmd/agecmd.go
@@ -68,14 +68,16 @@ func (c *Config) runAgeDecryptCmd(cmd *cobra.Command, args []string) error {
return errors.New("only passphrase encryption is supported")
}
decrypt := func(ciphertext []byte) ([]byte, error) {
- ciphertextReader := bytes.NewReader(ciphertext)
- armoredCiphertextReader := armor.NewReader(ciphertextReader)
+ var ciphertextReader io.Reader = bytes.NewReader(ciphertext)
+ if bytes.HasPrefix(ciphertext, []byte(armor.Header)) {
+ ciphertextReader = armor.NewReader(ciphertextReader)
+ }
identity := &LazyScryptIdentity{
Passphrase: func() (string, error) {
return c.readPassword("Enter passphrase: ")
},
}
- plaintextReader, err := age.Decrypt(armoredCiphertextReader, identity)
+ plaintextReader, err := age.Decrypt(ciphertextReader, identity)
if err != nil {
return nil, err
}
diff --git a/internal/cmd/testdata/scripts/age.txtar b/internal/cmd/testdata/scripts/age.txtar
index 17a9c2f3fa8..90ae998205e 100644
--- a/internal/cmd/testdata/scripts/age.txtar
+++ b/internal/cmd/testdata/scripts/age.txtar
@@ -3,7 +3,7 @@ stdin $HOME/passphrases
exec chezmoi age encrypt --output $HOME${/}secret.txt.age --passphrase --no-tty $HOME${/}secret.txt
grep '-----BEGIN AGE ENCRYPTED FILE----' $HOME/secret.txt.age
-# test that chezmoi decrypt decrypts a file with a passphrase
+# test that chezmoi age decrypt decrypts a file with a passphrase
stdin $HOME/passphrase
exec chezmoi age decrypt --output $HOME${/}secret.txt.decrypted --passphrase --no-tty $HOME${/}secret.txt.age
cmp $HOME/secret.txt.decrypted $HOME/secret.txt
@@ -13,7 +13,5 @@ passphrase
-- home/user/passphrases --
passphrase
passphrase
--- home/user/plaintext.txt --
-plaintext
-- home/user/secret.txt --
secret
|
feat
|
Add decryption of non-armored files to age command
|
cf9a38d4df47e801e59f9c25e06751a290b7667d
|
2024-07-07 13:40:58
|
Tom Payne
|
chore: Avoid using append in loops
| false
|
diff --git a/internal/chezmoi/abspath.go b/internal/chezmoi/abspath.go
index daee66af6f3..701a1a40be7 100644
--- a/internal/chezmoi/abspath.go
+++ b/internal/chezmoi/abspath.go
@@ -63,19 +63,19 @@ func (p AbsPath) Ext() string {
// Join returns a new AbsPath with relPaths appended.
func (p AbsPath) Join(relPaths ...RelPath) AbsPath {
- relPathStrs := make([]string, 0, len(relPaths)+1)
- relPathStrs = append(relPathStrs, string(p))
- for _, relPath := range relPaths {
- relPathStrs = append(relPathStrs, relPath.String())
+ relPathStrs := make([]string, len(relPaths)+1)
+ relPathStrs[0] = string(p)
+ for i, relPath := range relPaths {
+ relPathStrs[i+1] = relPath.String()
}
return NewAbsPath(path.Join(relPathStrs...))
}
// JoinString returns a new AbsPath with ss appended.
func (p AbsPath) JoinString(ss ...string) AbsPath {
- strs := make([]string, 0, len(ss)+1)
- strs = append(strs, string(p))
- strs = append(strs, ss...)
+ strs := make([]string, len(ss)+1)
+ strs[0] = string(p)
+ copy(strs[1:len(ss)+1], ss)
return NewAbsPath(path.Join(strs...))
}
diff --git a/internal/chezmoi/diff.go b/internal/chezmoi/diff.go
index 346a29b699d..f7c67285feb 100644
--- a/internal/chezmoi/diff.go
+++ b/internal/chezmoi/diff.go
@@ -118,13 +118,13 @@ func diffChunks(from, to string) []diff.Chunk {
dmp.DiffTimeout = time.Second
fromRunes, toRunes, runesToLines := dmp.DiffLinesToRunes(from, to)
diffs := dmp.DiffCharsToLines(dmp.DiffMainRunes(fromRunes, toRunes, false), runesToLines)
- chunks := make([]diff.Chunk, 0, len(diffs))
- for _, d := range diffs {
+ chunks := make([]diff.Chunk, len(diffs))
+ for i, d := range diffs {
chunk := &gitDiffChunk{
content: d.Text,
operation: gitDiffOperation[d.Type],
}
- chunks = append(chunks, chunk)
+ chunks[i] = chunk
}
return chunks
}
diff --git a/internal/chezmoi/encryption_test.go b/internal/chezmoi/encryption_test.go
index 117591e0f5c..486244c38dd 100644
--- a/internal/chezmoi/encryption_test.go
+++ b/internal/chezmoi/encryption_test.go
@@ -41,9 +41,9 @@ func (e *xorEncryption) EncryptedSuffix() string {
}
func (e *xorEncryption) xorWithKey(input []byte) []byte {
- output := make([]byte, 0, len(input))
- for _, b := range input {
- output = append(output, b^e.key)
+ output := make([]byte, len(input))
+ for i, b := range input {
+ output[i] = b ^ e.key
}
return output
}
diff --git a/internal/chezmoi/entrytypeset.go b/internal/chezmoi/entrytypeset.go
index 3374e5e6bcb..4ec13fff050 100644
--- a/internal/chezmoi/entrytypeset.go
+++ b/internal/chezmoi/entrytypeset.go
@@ -350,20 +350,20 @@ func StringSliceToEntryTypeSetHookFunc() mapstructure.DecodeHookFunc {
if to != reflect.TypeOf(EntryTypeSet{}) {
return data, nil
}
- sl, ok := data.([]any)
+ elemsAny, ok := data.([]any)
if !ok {
return nil, fmt.Errorf("expected a []string, got a %T", data)
}
- ss := make([]string, 0, len(sl))
- for _, i := range sl {
- s, ok := i.(string)
+ elemStrs := make([]string, len(elemsAny))
+ for i, elemAny := range elemsAny {
+ elemStr, ok := elemAny.(string)
if !ok {
- return nil, fmt.Errorf("expected a []string, got a %T element", i)
+ return nil, fmt.Errorf("expected a []string, got a %T element", elemAny)
}
- ss = append(ss, s)
+ elemStrs[i] = elemStr
}
s := NewEntryTypeSet(EntryTypesNone)
- if err := s.SetSlice(ss); err != nil {
+ if err := s.SetSlice(elemStrs); err != nil {
return nil, err
}
return s, nil
diff --git a/internal/chezmoi/relpath.go b/internal/chezmoi/relpath.go
index 8659b3888a9..f36d41aa5ea 100644
--- a/internal/chezmoi/relpath.go
+++ b/internal/chezmoi/relpath.go
@@ -73,9 +73,9 @@ func (p RelPath) Join(relPaths ...RelPath) RelPath {
// JoinString returns a new RelPath with ss appended.
func (p RelPath) JoinString(ss ...string) RelPath {
- strs := make([]string, 0, len(ss)+1)
- strs = append(strs, p.relPath)
- strs = append(strs, ss...)
+ strs := make([]string, len(ss)+1)
+ strs[0] = p.relPath
+ copy(strs[1:len(ss)+1], ss)
return NewRelPath(path.Join(strs...))
}
@@ -118,9 +118,9 @@ func (p RelPath) Split() (RelPath, RelPath) {
// SplitAll returns p's components.
func (p RelPath) SplitAll() []RelPath {
components := strings.Split(p.relPath, "/")
- relPaths := make([]RelPath, 0, len(components))
- for _, component := range components {
- relPaths = append(relPaths, NewRelPath(component))
+ relPaths := make([]RelPath, len(components))
+ for i, component := range components {
+ relPaths[i] = NewRelPath(component)
}
return relPaths
}
diff --git a/internal/chezmoi/sourcerelpath.go b/internal/chezmoi/sourcerelpath.go
index c10761673df..e942b233422 100644
--- a/internal/chezmoi/sourcerelpath.go
+++ b/internal/chezmoi/sourcerelpath.go
@@ -46,9 +46,9 @@ func (p SourceRelPath) Join(sourceRelPaths ...SourceRelPath) SourceRelPath {
if len(sourceRelPaths) == 0 {
return p
}
- relPaths := make([]RelPath, 0, len(sourceRelPaths))
- for _, sourceRelPath := range sourceRelPaths {
- relPaths = append(relPaths, sourceRelPath.relPath)
+ relPaths := make([]RelPath, len(sourceRelPaths))
+ for i, sourceRelPath := range sourceRelPaths {
+ relPaths[i] = sourceRelPath.relPath
}
return SourceRelPath{
relPath: p.relPath.Join(relPaths...),
diff --git a/internal/chezmoi/sourcestate.go b/internal/chezmoi/sourcestate.go
index 229bcd3dbd7..5ac5e11ae94 100644
--- a/internal/chezmoi/sourcestate.go
+++ b/internal/chezmoi/sourcestate.go
@@ -2817,14 +2817,14 @@ func (e *External) OriginString() string {
func canonicalSourceStateEntry(sourceStateEntries []SourceStateEntry) (SourceStateEntry, bool) {
// Find all directories to check for equivalence.
var firstSourceStateDir *SourceStateDir
- sourceStateDirs := make([]SourceStateEntry, 0, len(sourceStateEntries))
- for _, sourceStateEntry := range sourceStateEntries {
+ sourceStateDirs := make([]SourceStateEntry, len(sourceStateEntries))
+ for i, sourceStateEntry := range sourceStateEntries {
switch sourceStateEntry := sourceStateEntry.(type) {
case *SourceStateDir:
firstSourceStateDir = sourceStateEntry
- sourceStateDirs = append(sourceStateDirs, sourceStateEntry)
+ sourceStateDirs[i] = sourceStateEntry
case *SourceStateImplicitDir:
- sourceStateDirs = append(sourceStateDirs, sourceStateEntry)
+ sourceStateDirs[i] = sourceStateEntry
default:
return nil, false
}
diff --git a/internal/chezmoi/template.go b/internal/chezmoi/template.go
index 27b6c8322bc..195cda8c0e2 100644
--- a/internal/chezmoi/template.go
+++ b/internal/chezmoi/template.go
@@ -109,12 +109,12 @@ func (o *TemplateOptions) parseAndRemoveDirectives(data []byte) []byte {
// removeMatches returns data with matchesIndexes removed.
func removeMatches(data []byte, matchesIndexes [][]int) []byte {
- slices := make([][]byte, 0, len(matchesIndexes)+1)
- slices = append(slices, data[:matchesIndexes[0][0]])
+ slices := make([][]byte, len(matchesIndexes)+1)
+ slices[0] = data[:matchesIndexes[0][0]]
for i, matchIndexes := range matchesIndexes[1:] {
- slices = append(slices, data[matchesIndexes[i][1]:matchIndexes[0]])
+ slices[i+1] = data[matchesIndexes[i][1]:matchIndexes[0]]
}
- slices = append(slices, data[matchesIndexes[len(matchesIndexes)-1][1]:])
+ slices[len(matchesIndexes)] = data[matchesIndexes[len(matchesIndexes)-1][1]:]
return bytes.Join(slices, nil)
}
diff --git a/internal/chezmoibubbles/chezmoibubbles_test.go b/internal/chezmoibubbles/chezmoibubbles_test.go
index 56558c28d47..8305e888ca1 100644
--- a/internal/chezmoibubbles/chezmoibubbles_test.go
+++ b/internal/chezmoibubbles/chezmoibubbles_test.go
@@ -29,9 +29,9 @@ func makeKeyMsg(r rune) tea.Msg {
}
func makeKeyMsgs(s string) []tea.Msg {
- msgs := make([]tea.Msg, 0, len(s))
- for _, r := range s {
- msgs = append(msgs, makeKeyMsg(r))
+ msgs := make([]tea.Msg, len(s))
+ for i, r := range s {
+ msgs[i] = makeKeyMsg(r)
}
return msgs
}
diff --git a/internal/cmd/config.go b/internal/cmd/config.go
index b2890bb510d..5afe3253fc3 100644
--- a/internal/cmd/config.go
+++ b/internal/cmd/config.go
@@ -1321,10 +1321,10 @@ func (c *Config) findConfigTemplate() (*configTemplate, error) {
case 1:
return configTemplates[0], nil
default:
- sourceAbsPathStrs := make([]string, 0, len(configTemplates))
- for _, configTemplate := range configTemplates {
+ sourceAbsPathStrs := make([]string, len(configTemplates))
+ for i, configTemplate := range configTemplates {
sourceAbsPathStr := configTemplate.sourceAbsPath.String()
- sourceAbsPathStrs = append(sourceAbsPathStrs, sourceAbsPathStr)
+ sourceAbsPathStrs[i] = sourceAbsPathStr
}
return nil, fmt.Errorf("multiple config file templates: %s ", englishList(sourceAbsPathStrs))
}
@@ -2557,7 +2557,7 @@ func (c *Config) targetRelPaths(
// targetRelPathsBySourcePath returns the target relative paths for each arg in
// args.
func (c *Config) targetRelPathsBySourcePath(sourceState *chezmoi.SourceState, args []string) ([]chezmoi.RelPath, error) {
- targetRelPaths := make([]chezmoi.RelPath, 0, len(args))
+ targetRelPaths := make([]chezmoi.RelPath, len(args))
targetRelPathsBySourceRelPath := make(map[chezmoi.RelPath]chezmoi.RelPath)
_ = sourceState.ForEach(
func(targetRelPath chezmoi.RelPath, sourceStateEntry chezmoi.SourceStateEntry) error {
@@ -2566,7 +2566,7 @@ func (c *Config) targetRelPathsBySourcePath(sourceState *chezmoi.SourceState, ar
return nil
},
)
- for _, arg := range args {
+ for i, arg := range args {
argAbsPath, err := chezmoi.NewAbsPathFromExtPath(arg, c.homeDirAbsPath)
if err != nil {
return nil, err
@@ -2579,7 +2579,7 @@ func (c *Config) targetRelPathsBySourcePath(sourceState *chezmoi.SourceState, ar
if !ok {
return nil, fmt.Errorf("%s: not in source state", arg)
}
- targetRelPaths = append(targetRelPaths, targetRelPath)
+ targetRelPaths[i] = targetRelPath
}
return targetRelPaths, nil
}
diff --git a/internal/cmd/shellquote.go b/internal/cmd/shellquote.go
index b00a4afc046..95e3fd4ee7f 100644
--- a/internal/cmd/shellquote.go
+++ b/internal/cmd/shellquote.go
@@ -58,10 +58,10 @@ func shellQuoteCommand(command string, args []string) string {
if len(args) == 0 {
return shellQuote(command)
}
- elems := make([]string, 0, 1+len(args))
- elems = append(elems, shellQuote(command))
- for _, arg := range args {
- elems = append(elems, shellQuote(arg))
+ elems := make([]string, 1+len(args))
+ elems[0] = shellQuote(command)
+ for i, arg := range args {
+ elems[i+1] = shellQuote(arg)
}
return strings.Join(elems, " ")
}
diff --git a/internal/cmd/templatefuncs.go b/internal/cmd/templatefuncs.go
index 20dc51859cf..65129cd0317 100644
--- a/internal/cmd/templatefuncs.go
+++ b/internal/cmd/templatefuncs.go
@@ -406,8 +406,8 @@ func (c *Config) pruneEmptyDictsTemplateFunc(dict map[string]any) map[string]any
}
func (c *Config) quoteListTemplateFunc(list []any) []string {
- result := make([]string, 0, len(list))
- for _, elem := range list {
+ result := make([]string, len(list))
+ for i, elem := range list {
var elemStr string
switch elem := elem.(type) {
case []byte:
@@ -421,7 +421,7 @@ func (c *Config) quoteListTemplateFunc(list []any) []string {
default:
elemStr = fmt.Sprintf("%v", elem)
}
- result = append(result, strconv.Quote(elemStr))
+ result[i] = strconv.Quote(elemStr)
}
return result
}
@@ -611,7 +611,7 @@ func keysFromPath(path any) ([]string, string, error) {
if len(path) == 0 {
return nil, "", errEmptyPath
}
- keys := make([]string, 0, len(path))
+ keys := make([]string, len(path))
for i, pathElement := range path {
switch pathElementStr, ok := pathElement.(string); {
case !ok:
@@ -623,7 +623,7 @@ func keysFromPath(path any) ([]string, string, error) {
index: i,
}
default:
- keys = append(keys, pathElementStr)
+ keys[i] = pathElementStr
}
}
return keys[:len(keys)-1], keys[len(keys)-1], nil
diff --git a/internal/cmd/util.go b/internal/cmd/util.go
index 94ddf30092b..2a90131b852 100644
--- a/internal/cmd/util.go
+++ b/internal/cmd/util.go
@@ -48,11 +48,11 @@ func camelCaseToUpperSnakeCase(s string) string {
}
wordBoundaries = append(wordBoundaries, len(runes))
- words := make([]string, 0, len(wordBoundaries))
+ words := make([]string, len(wordBoundaries))
prevWordBoundary := 0
- for _, wordBoundary := range wordBoundaries {
+ for i, wordBoundary := range wordBoundaries {
word := string(runes[prevWordBoundary:wordBoundary])
- words = append(words, strings.ToUpper(word))
+ words[i] = strings.ToUpper(word)
prevWordBoundary = wordBoundary
}
return strings.Join(words, "_")
@@ -110,9 +110,9 @@ func pluralize(singular string) string {
// stringersToStrings converts a slice of fmt.Stringers to a list of strings.
func stringersToStrings[T fmt.Stringer](ss []T) []string {
- result := make([]string, 0, len(ss))
- for _, s := range ss {
- result = append(result, s.String())
+ result := make([]string, len(ss))
+ for i, s := range ss {
+ result[i] = s.String()
}
return result
}
|
chore
|
Avoid using append in loops
|
ba12f36f20b0ce4c80a68b4e16f5e1ac9d6ede53
|
2024-11-03 01:27:00
|
Tom Payne
|
docs: Add github.com/andre-kotake/nvim-chezmoi to related software
| false
|
diff --git a/assets/chezmoi.io/docs/links/related-software.md b/assets/chezmoi.io/docs/links/related-software.md
index ec544414101..13842d6ff02 100644
--- a/assets/chezmoi.io/docs/links/related-software.md
+++ b/assets/chezmoi.io/docs/links/related-software.md
@@ -2,6 +2,10 @@
## Editor integration
+### [`github.com/andre-kotake/nvim-chezmoi`](https://github.com/andre-kotake/nvim-chezmoi)
+
+A NeoVim plugin that integrates with chezmoi.
+
### [`github.com/alker0/chezmoi.vim`](https://github.com/alker0/chezmoi.vim)
Intelligent VIM syntax highlighting when editing files in your source directory.
|
docs
|
Add github.com/andre-kotake/nvim-chezmoi to related software
|
bb6e0616458b71d1fc9bac7c1c4ec78117178813
|
2022-01-27 05:06:01
|
Tom Payne
|
chore: Bump golangci-lint to v1.44.0
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index bed727b55a5..0a1b61b7530 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -12,7 +12,7 @@ env:
AGE_VERSION: 1.0.0
GO_VERSION: 1.17.6
GOFUMPT_VERSION: 0.2.1
- GOLANGCI_LINT_VERSION: 1.43.0
+ GOLANGCI_LINT_VERSION: 1.44.0
jobs:
changes:
runs-on: ubuntu-20.04
diff --git a/.golangci.yml b/.golangci.yml
index c043c5fd00c..3f6df742b02 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -5,11 +5,13 @@ linters:
- bodyclose
- contextcheck
- deadcode
+ - decorder
- depguard
- dogsled
- dupl
- durationcheck
- errcheck
+ - errchkjson
- errname
- errorlint
- exportloopref
@@ -31,6 +33,7 @@ linters:
- ifshort
- importas
- ineffassign
+ - ireturn
- lll
- makezero
- misspell
@@ -69,6 +72,7 @@ linters:
- godox
- goheader
- gomnd
+ - maintidx
- maligned
- nakedret
- nestif
@@ -91,6 +95,20 @@ linters-settings:
extra-rules: true
goimports:
local-prefixes: github.com/twpayne/chezmoi
+ ireturn:
+ allow:
+ - anon
+ - empty
+ - error
+ - github.com/go-git/go-git/v5/plumbing/format/diff\.File
+ - github.com/go-git/go-git/v5/plumbing/format/diff\.Patch
+ - github.com/mitchellh/mapstructure\.DecodeHookFunc
+ - github.com/twpayne/chezmoi/v2/pkg/chezmoi\.ActualStateEntry
+ - github.com/twpayne/chezmoi/v2/pkg/chezmoi\.Encryption
+ - github.com/twpayne/chezmoi/v2/pkg/chezmoi\.SourceStateEntry
+ - github.com/twpayne/chezmoi/v2/pkg/chezmoi\.TargetStateEntry
+ - github.com/twpayne/go-vfs/v4\.FS
+ - stdlib
misspell:
locale: US
diff --git a/pkg/cmd/util_unix.go b/pkg/cmd/util_unix.go
index 4167a460e36..f28b00fda5a 100644
--- a/pkg/cmd/util_unix.go
+++ b/pkg/cmd/util_unix.go
@@ -21,5 +21,6 @@ func enableVirtualTerminalProcessing(w io.Writer) error {
}
func fileInfoUID(info fs.FileInfo) int {
+ //nolint:forcetypeassert
return int(info.Sys().(*syscall.Stat_t).Uid)
}
|
chore
|
Bump golangci-lint to v1.44.0
|
998dfd33a4ee51b430401ddc27fbed389497053f
|
2022-10-13 00:07:36
|
Tom Payne
|
chore: Add shellcheck target
| false
|
diff --git a/Makefile b/Makefile
index 5e46ee375e2..64571a10e66 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,7 @@ PREFIX?=/usr/local
default: build
.PHONY: smoketest
-smoketest: run build-all test lint format
+smoketest: run build-all test lint shellcheck format
.PHONY: build
build:
@@ -138,6 +138,10 @@ release:
--rm-dist \
${GORELEASER_FLAGS}
+.PHONY: shellcheck
+shellcheck:
+ find . -type f -name \*.sh | xargs shellcheck
+
.PHONY: test-release
test-release:
goreleaser release \
|
chore
|
Add shellcheck target
|
f3e9d6cbb0585b5a39bb32c7f23e5d01ba3b4549
|
2024-11-08 04:02:08
|
Ruslan Sayfutdinov
|
chore: Fix typo in entrypoint.sh
| false
|
diff --git a/assets/docker/entrypoint.sh b/assets/docker/entrypoint.sh
index da79f94618f..e3d227c7955 100755
--- a/assets/docker/entrypoint.sh
+++ b/assets/docker/entrypoint.sh
@@ -7,10 +7,10 @@ git config --global --add safe.directory /chezmoi
GO=${GO:-go}
if [ -d "/go-cache" ]; then
- echo "Set GOCACHE to /go-cache"
export GOCACHE="/go-cache/cache"
- echo "Set GOMODCACHE to /go-cache/modcache"
+ echo "Set GOCACHE to ${GOCACHE}"
export GOMODCACHE="/go-cache/modcache"
+ echo "Set GOMODCACHE to ${GOMODCACHE}"
fi
cd /chezmoi
|
chore
|
Fix typo in entrypoint.sh
|
cf2bf1df5833d6848ab12d5405567062f2b8f63e
|
2022-04-02 15:32:33
|
Tom Payne
|
chore: Update dependencies
| false
|
diff --git a/go.mod b/go.mod
index 8b4c0e43ec2..e073cea7d31 100644
--- a/go.mod
+++ b/go.mod
@@ -34,7 +34,7 @@ require (
go.uber.org/multierr v1.8.0
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
- golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86
+ golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
@@ -69,7 +69,7 @@ require (
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
- github.com/kevinburke/ssh_config v1.1.0 // indirect
+ github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
@@ -93,14 +93,14 @@ require (
github.com/stretchr/objx v0.3.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/xanzy/ssh-agent v0.3.1 // indirect
- github.com/yuin/goldmark v1.4.10 // indirect
+ github.com/yuin/goldmark v1.4.11 // indirect
github.com/yuin/goldmark-emoji v1.0.1 // indirect
go.uber.org/atomic v1.9.0 // indirect
- golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect
- golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
+ golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 // indirect
+ golang.org/x/net v0.0.0-20220401154927-543a649e0bdd // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/appengine v1.6.7 // indirect
- google.golang.org/protobuf v1.27.1 // indirect
+ google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/errgo.v2 v2.1.0 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
diff --git a/go.sum b/go.sum
index 1a7faf746f7..5ce6f09fac7 100644
--- a/go.sum
+++ b/go.sum
@@ -27,31 +27,41 @@ cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aD
cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI=
cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4=
cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc=
+cloud.google.com/go v0.99.0 h1:y/cM2iqGgGi5D5DQZl6D9STN/3dR/Vx5Mp8s752oJTY=
cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
+cloud.google.com/go/bigquery v1.8.0 h1:PQcPefKFdaIzjQFbiyOgAqyx8q5djaE7x9Sqe712DPA=
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
+cloud.google.com/go/datastore v1.1.0 h1:/May9ojXjRkPBNVrq+oWLqmWCkr4OU5uRY29bu0mRyQ=
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
+cloud.google.com/go/firestore v1.6.1 h1:8rBq3zRjnHx8UtBvaOWqBB1xq9jH6/wltfQLlTMh2Fw=
cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY=
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
+cloud.google.com/go/pubsub v1.3.1 h1:ukjixP1wl0LpnZ6LWtZJ0mX5tBmjp1f8Sqer8Z2OMUU=
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
+cloud.google.com/go/storage v1.14.0 h1:6RRlFMv1omScs6iq2hfE3IvgE+l6RfJPampq8UZc5TU=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
+dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9 h1:VpgP7xuJadIUuKccphEpTJnWhS2jkQyMt6Y7pJCD7fY=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
filippo.io/age v1.0.0 h1:V6q14n0mqYU3qKFkZ6oOaF9oXneOviS3ubXsSVBRSzc=
filippo.io/age v1.0.0/go.mod h1:PaX+Si/Sd5G8LgfCwldsSba3H1DDQZhIhFGkhbHaBq8=
+filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU=
filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
+github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
@@ -69,6 +79,7 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
github.com/ProtonMail/go-crypto v0.0.0-20220113124808-70ae35bab23f h1:J2FzIrXN82q5uyUraeJpLIm7U6PffRwje2ORho5yIik=
github.com/ProtonMail/go-crypto v0.0.0-20220113124808-70ae35bab23f/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
+github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
@@ -85,6 +96,7 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYU
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
+github.com/armon/go-metrics v0.3.10 h1:FR+drcQStOe+32sYyJYyZ7FIdgoGGBnwLl+flodp8Uo=
github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
@@ -102,34 +114,46 @@ github.com/bradenhilton/cityhash v1.0.0 h1:1QauDCwfxwIGwO2jBTJdEBqXgfCusAgQOSgdl
github.com/bradenhilton/cityhash v1.0.0/go.mod h1:Wmb8yW1egA9ulrsRX4mxfYx5zq4nBWOCZ+j63oK6uz8=
github.com/bradenhilton/mozillainstallhash v1.0.0 h1:QL9byVGb4FrVOI7MubnME3uPNj5R78tqYQPlxuBmXMw=
github.com/bradenhilton/mozillainstallhash v1.0.0/go.mod h1:yVD0OX1izZHYl1lBm2UDojyE/k0xIqKJK78k+tdWV+k=
+github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 h1:tXKVfhE7FcSkhkv0UwkLvPDeZ4kz6OXd0PKPlFqf81M=
github.com/bradleyfalzon/ghinstallation/v2 v2.0.4/go.mod h1:B40qPqJxWE0jDZgOR1JmaMy+4AY1eBP+IByOvqyAKp0=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
+github.com/census-instrumentation/opencensus-proto v0.3.0 h1:t/LhUZLVitR1Ow2YOnduCsavhwFUklBMoGVYUCqmCqk=
github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/charmbracelet/glamour v0.5.0 h1:wu15ykPdB7X6chxugG/NNfDUbyyrCLV9XBalj5wdu3g=
github.com/charmbracelet/glamour v0.5.0/go.mod h1:9ZRtG19AUIzcTm7FGLGbq3D5WKQ5UyZBbQsMQN0XIqc=
+github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
+github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
+github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
+github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
+github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4 h1:hzAQntlaYRkVSFEfj9OTWlVV1H155FMD8BTKktLv0QI=
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
+github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490 h1:KwaoQzs/WeUxxJqiJsZ4euOly1Az/IgZXXSxlD/UBNk=
github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
+github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI=
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
+github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU=
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
+github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/danieljoos/wincred v1.1.0/go.mod h1:XYlo+eRTsVA9aHGp7NGjFkPla4m+DCL7hqDjlFjiygg=
github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0=
@@ -149,12 +173,16 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
+github.com/envoyproxy/go-control-plane v0.10.1 h1:cgDRLG7bs59Zd+apAWuzLQL95obVYAymNJek76W3mgw=
github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
+github.com/envoyproxy/protoc-gen-validate v0.6.2 h1:JiO+kJTpmYGjEodY7O1Zk8oZcNz1+f30UtwtXoFUPzE=
github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
+github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
+github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
@@ -170,14 +198,17 @@ github.com/go-git/go-git-fixtures/v4 v4.2.1 h1:n9gGL1Ct/yIw+nfsfr8s4+sbhT+Ncu2Su
github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0=
github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4=
github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc=
+github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1 h1:QbL/5oDUmRBzO9/Z7Seo6zf912W/a6Sr4Eu0G/3Jho0=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
+github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4 h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
+github.com/go-ole/go-ole v1.2.6-0.20210915003542-8b1f7f90f6b1 h1:4dntyT+x6QTOSCIrgczbQ+ockAEha0cfxD5Wi0iCzjY=
github.com/go-ole/go-ole v1.2.6-0.20210915003542-8b1f7f90f6b1/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
@@ -186,11 +217,14 @@ github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
+github.com/golang-jwt/jwt/v4 v4.0.0 h1:RAqyYixv1p7uEnocuy8P1nru5wprCh/MH2BIlW5z5/o=
github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
+github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
@@ -239,6 +273,7 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
+github.com/google/go-github/v41 v41.0.0 h1:HseJrM2JFf2vfiZJ8anY2hqBjdfY1Vlj/K27ueww4gg=
github.com/google/go-github/v41 v41.0.0/go.mod h1:XgmCA5H323A9rtgExdTcnDkcqp6S30AVACCBDOonIxg=
github.com/google/go-github/v43 v43.0.0 h1:y+GL7LIsAIF2NZlJ46ZoC/D1W1ivZasT0lnWHMYPZ+U=
github.com/google/go-github/v43 v43.0.0/go.mod h1:ZkTvvmCXBvsfPpTHXnH/d2hP9Y0cTbvN9kr5xqyXOIc=
@@ -247,8 +282,10 @@ github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gops v0.3.22 h1:lyvhDxfPLHAOR2xIYwjPhN387qHxyU21Sk9sz/GhmhQ=
github.com/google/gops v0.3.22/go.mod h1:7diIdLsqpCihPSX3fQagksT/Ku/y4RL9LHTlKyEUDl8=
+github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
+github.com/google/martian/v3 v3.1.0 h1:wCKgOCHuUEVfsaQLpPSJb7VdYCdTVZQAuOdYm1yc/60=
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
@@ -260,6 +297,7 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
+github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2 h1:LR89qFljJ48s990kEKGsk213yIJDPI4205OKOzbURK8=
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
@@ -277,27 +315,34 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0=
+github.com/googleapis/gax-go/v2 v2.1.1 h1:dp3bWCh+PPO1zjRRiCSczJav13sBvG4UhNyVTa1KqdU=
github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM=
+github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8 h1:tlyzajkF3030q6M8SvmJSemC9DTHL/xaMa18b65+JM4=
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 h1:+ngKgrYPPJrOjhax5N+uePQ0Fh1Z7PheYoUI/0nzkPA=
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
+github.com/hashicorp/consul/api v1.12.0 h1:k3y1FYv6nuKyNTqj6w9gXOx5r5CfLj/k/euUeBXj1OY=
github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0=
github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
+github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
+github.com/hashicorp/go-hclog v1.0.0 h1:bkKf0BeBXcSYa7f5Fyi9gMuQ8gNsxeiNpZjR6VxNZeo=
github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
+github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
+github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc=
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
@@ -305,18 +350,21 @@ github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc=
github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
+github.com/hashicorp/serf v0.9.6 h1:uuEX1kLR6aoda1TBttmJQKDLZE1Ob7KN0NPdE7EtCDc=
github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4=
github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
+github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639 h1:mV02weKRL81bEnm8A0HT1/CAelMQDBuQIfLw8n+d6xI=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
@@ -326,27 +374,35 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
+github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
+github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
-github.com/kevinburke/ssh_config v1.1.0 h1:pH/t1WS9NzT8go394IqZeJTMHVm6Cr6ZJ6AQ+mdNo/o=
-github.com/kevinburke/ssh_config v1.1.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
+github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
+github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
+github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19 h1:WjT3fLi9n8YWh/Ih8Q1LHAPsTqGddPcHqscN+PJ3i68=
github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19/go.mod h1:hY+WOq6m2FpbvyrI93sMaypsttvaIL5nhVR92dTMUcQ=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
+github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
+github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
+github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -363,6 +419,7 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
+github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
@@ -397,9 +454,11 @@ github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/muesli/combinator v0.3.0 h1:SZDuRzzwmVPLkbOzbhGzBTwd5+Y6aFN4UusOW2azrNA=
github.com/muesli/combinator v0.3.0/go.mod h1:ttPegJX0DPQaGDtJKMInIP6Vfp5pN8RX7QntFCcpy18=
@@ -409,6 +468,7 @@ github.com/muesli/termenv v0.9.0/go.mod h1:R/LzAKf+suGs4IsO95y7+7DpFHO0KABgnZqtl
github.com/muesli/termenv v0.11.0 h1:fwNUbu2mfWlgicwG7qYzs06aOI8Z/zKPAv8J4uKbT+o=
github.com/muesli/termenv v0.11.0/go.mod h1:Bd5NYQ7pd+SrtBSrSNoBBmXlcY8+Xj4BMJgh8qcZrvs=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
+github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
@@ -425,6 +485,7 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
+github.com/pkg/sftp v1.13.1 h1:I2qBYMChEhIjOgazfJmV3/mZM256btk6wkCDRmW7JYs=
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
@@ -435,6 +496,7 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
@@ -449,16 +511,20 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg=
github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=
+github.com/rs/xid v1.3.0 h1:6NjYksEUlhurdVehpc7S7dk6DAmcKv8V9gG0FsVN2U4=
github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.26.0/go.mod h1:yBiM87lvSqX8h0Ww4sdzNSkVYZ8dL2xjZJG1lAuGZEo=
github.com/rs/zerolog v1.26.1 h1:/ihwxqH+4z8UxyI70wM1z9yCvkWcfz/a3mj48k/Zngc=
github.com/rs/zerolog v1.26.1/go.mod h1:/wSSJWX7lVrsOwlbyTRSOJvqRlc+WjWlfes+CiJ+tmc=
+github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
+github.com/sagikazarmark/crypt v0.4.0 h1:Rqcx6Sf/bWQUmmfGQhcFx3wQQEfb2UZWhAKvGRairm0=
github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
+github.com/shirou/gopsutil/v3 v3.21.9 h1:Vn4MUz2uXhqLSiCbGFRc0DILbMVLAY92DSkT8bsYrHg=
github.com/shirou/gopsutil/v3 v3.21.9/go.mod h1:YWp/H8Qs5fVmf17v7JNZzA0mPJ+mS2e9JdiUF9LlKzQ=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
@@ -466,6 +532,7 @@ github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
+github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4=
@@ -497,7 +564,9 @@ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMT
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
+github.com/tklauser/go-sysconf v0.3.9 h1:JeUVdAOWhhxVcU6Eqr/ATFHgXk/mmiItdKeJPev3vTo=
github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs=
+github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2biQ=
github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/twpayne/go-pinentry v0.2.0 h1:hS5NEJiilop9xP9pBX/1NYduzDlGGMdg1KamTBTrOWw=
@@ -515,6 +584,7 @@ github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0o
github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
github.com/xanzy/ssh-agent v0.3.1 h1:AmzO1SSWxw73zxFZPRwaMN1MohDw8UyHnmuxyceTEGo=
github.com/xanzy/ssh-agent v0.3.1/go.mod h1:QIE4lCeL7nkC25x+yA3LBIYfwCc1TFziCtG7cBAac6w=
+github.com/xlab/treeprint v1.1.0 h1:G/1DjNkPpfZCFt9CSh6b5/nY4VimlbHF3Rh4obvtzDk=
github.com/xlab/treeprint v1.1.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -523,16 +593,19 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.4/go.mod h1:rmuwmfZ0+bvzB24eSC//bk1R1Zp3hM0OXYv/G2LIilg=
-github.com/yuin/goldmark v1.4.10 h1:+WgKGo8CQrlMTRJpGCFCyNddOhW801TKC2QijVV9QVg=
-github.com/yuin/goldmark v1.4.10/go.mod h1:rmuwmfZ0+bvzB24eSC//bk1R1Zp3hM0OXYv/G2LIilg=
+github.com/yuin/goldmark v1.4.11 h1:i45YIzqLnUc2tGaTlJCyUxSG8TvgyGqhqOZOUKIjJ6w=
+github.com/yuin/goldmark v1.4.11/go.mod h1:rmuwmfZ0+bvzB24eSC//bk1R1Zp3hM0OXYv/G2LIilg=
github.com/yuin/goldmark-emoji v1.0.1 h1:ctuWEyzGBwiucEqxzwe0SOYDXPAucOrE9NQC18Wa1os=
github.com/yuin/goldmark-emoji v1.0.1/go.mod h1:2w1E6FEWLcDQkoTE+7HU6QF1F6SLlNGjRIBbIZQFqkQ=
github.com/zalando/go-keyring v0.2.1 h1:MBRN/Z8H4U5wEKXiD67YbDAr5cj/DOStmSga70/2qKc=
github.com/zalando/go-keyring v0.2.1/go.mod h1:g63M2PPn0w5vjmEbwAX3ib5I+41zdm4esSETOn9Y6Dw=
go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
+go.etcd.io/etcd/api/v3 v3.5.1 h1:v28cktvBq+7vGyJXF8G+rWJmj+1XUmMtqcLnH8hDocM=
go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
+go.etcd.io/etcd/client/pkg/v3 v3.5.1 h1:XIQcHCFSG53bJETYeRJtIxdLv2EWRGxcfzR8lSnTH4E=
go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
+go.etcd.io/etcd/client/v2 v2.305.1 h1:vtxYCKWA9x31w0WJj7DdqsHFNjhkigdAnziDtkZb/l4=
go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
@@ -540,6 +613,7 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
+go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
@@ -566,8 +640,8 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
-golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd h1:XcWmESyNjXJMLahc3mqVQJcgSTDxFxhETVlfk9uGc38=
-golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
+golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 h1:tkVvjkPTB7pnW3jnid7kNyAMPVWllTNOf/qKDze4p9o=
+golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -577,8 +651,10 @@ golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
+golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
+golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
@@ -590,9 +666,11 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
+golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 h1:2M3HP5CCK1Si9FQhwnzYhXdG6DXeebvUHFpre8QvbyI=
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
+golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
@@ -602,6 +680,7 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -650,8 +729,8 @@ golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
-golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc=
-golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
+golang.org/x/net v0.0.0-20220401154927-543a649e0bdd h1:zYlwaUHTmxuf6H7hwO2dgwqozQmH7zf4x+/qql4oVWc=
+golang.org/x/net v0.0.0-20220401154927-543a649e0bdd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -760,8 +839,8 @@ golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86 h1:A9i04dxx7Cribqbs8jf3FQLogkL/CV2YN7hj9KWJCkc=
-golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f h1:rlezHXNlxYWvBCzNses9Dlc7nGFaNMJeqLolcmQSSZY=
+golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
@@ -778,6 +857,7 @@ golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -834,6 +914,7 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -871,6 +952,7 @@ google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqiv
google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI=
google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU=
google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I=
+google.golang.org/api v0.63.0 h1:n2bqqK895ygnBpdPDYetfy23K7fJ22wsrZKCyfuRkkA=
google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -942,6 +1024,7 @@ google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ6
google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
+google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa h1:I0YcKz0I7OAhddo7ya8kMnvprhcWM045PmkBdMO9zN0=
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
@@ -969,6 +1052,7 @@ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnD
google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
+google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM=
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
@@ -983,8 +1067,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
-google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
+google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
+google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
@@ -999,6 +1084,7 @@ gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4=
gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
+gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 h1:POO/ycCATvegFmVuPpQzZFJ+pGZeX22Ufu6fibxDVjU=
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
@@ -1018,10 +1104,15 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
+honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM=
howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
+rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
+rsc.io/goversion v1.2.0 h1:SPn+NLTiAG7w30IRK/DKp1BjvpWabYgxlLp/+kx5J8w=
rsc.io/goversion v1.2.0/go.mod h1:Eih9y/uIBS3ulggl7KNJ09xGSLcuNaLgmvvqa07sgfo=
+rsc.io/quote/v3 v3.1.0 h1:9JKUTTIUgS6kzR9mK1YuGKv6Nl+DijDNIc0ghT58FaY=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
+rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
chore
|
Update dependencies
|
b9839cb12a00735e20b05de2b74ddd8302249c22
|
2022-01-26 08:10:10
|
Tom Payne
|
chore: Read source directory concurrently
| false
|
diff --git a/go.mod b/go.mod
index c5d99e81a35..90c89ccdb9e 100644
--- a/go.mod
+++ b/go.mod
@@ -48,6 +48,7 @@ require (
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce // indirect
golang.org/x/net v0.0.0-20220111093109-d55c255bac03 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
+ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20220111092808-5a964db01320
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
gopkg.in/yaml.v2 v2.4.0
diff --git a/internal/chezmoi/patternset.go b/internal/chezmoi/patternset.go
index 1a469a162fa..0ada6bdecd7 100644
--- a/internal/chezmoi/patternset.go
+++ b/internal/chezmoi/patternset.go
@@ -5,6 +5,7 @@ import (
"path"
"path/filepath"
"sort"
+ "sync"
"github.com/bmatcuk/doublestar/v4"
"github.com/rs/zerolog"
@@ -13,6 +14,7 @@ import (
// An patternSet is a set of patterns.
type patternSet struct {
+ sync.Mutex
includePatterns stringSet
excludePatterns stringSet
}
@@ -40,6 +42,8 @@ func (ps *patternSet) add(pattern string, include bool) error {
if ok := doublestar.ValidatePattern(pattern); !ok {
return fmt.Errorf("%s: invalid pattern", pattern)
}
+ ps.Lock()
+ defer ps.Unlock()
if include {
ps.includePatterns.add(pattern)
} else {
diff --git a/internal/chezmoi/sourcestate.go b/internal/chezmoi/sourcestate.go
index 7f8ce7a2f84..de5fcc8093a 100644
--- a/internal/chezmoi/sourcestate.go
+++ b/internal/chezmoi/sourcestate.go
@@ -21,6 +21,7 @@ import (
"runtime"
"sort"
"strings"
+ "sync"
"text/template"
"time"
@@ -69,6 +70,7 @@ var externalCacheFormat = formatGzippedJSON{}
// A SourceState is a source state.
type SourceState struct {
+ sync.Mutex
root sourceStateEntryTreeNode
removeDirs map[RelPath]struct{}
baseSystem System
@@ -237,6 +239,7 @@ func NewSourceState(options ...SourceStateOption) *SourceState {
priorityTemplateData: make(map[string]interface{}),
userTemplateData: make(map[string]interface{}),
templateOptions: DefaultTemplateOptions,
+ templates: make(map[string]*template.Template),
externals: make(map[RelPath]External),
}
for _, option := range options {
@@ -790,8 +793,14 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
}
// Read all source entries.
+ var allSourceStateEntriesLock sync.Mutex
allSourceStateEntries := make(map[RelPath][]SourceStateEntry)
- walkFunc := func(sourceAbsPath AbsPath, fileInfo fs.FileInfo, err error) error {
+ addSourceStateEntries := func(relPath RelPath, sourceStateEntries ...SourceStateEntry) {
+ allSourceStateEntriesLock.Lock()
+ allSourceStateEntries[relPath] = append(allSourceStateEntries[relPath], sourceStateEntries...)
+ allSourceStateEntriesLock.Unlock()
+ }
+ walkFunc := func(ctx context.Context, sourceAbsPath AbsPath, fileInfo fs.FileInfo, err error) error {
if err != nil {
return err
}
@@ -826,7 +835,7 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
}
return s.addTemplateData(sourceAbsPath)
case fileInfo.Name() == templatesDirName:
- if err := s.addTemplatesDir(sourceAbsPath); err != nil {
+ if err := s.addTemplatesDir(ctx, sourceAbsPath); err != nil {
return err
}
return vfs.SkipDir
@@ -839,12 +848,12 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
case fileInfo.Name() == removeName:
return s.addPatterns(s.remove, sourceAbsPath, parentSourceRelPath)
case fileInfo.Name() == scriptsDirName:
- scriptsDirSourceStateEntries, err := s.readScriptsDir(sourceAbsPath)
+ scriptsDirSourceStateEntries, err := s.readScriptsDir(ctx, sourceAbsPath)
if err != nil {
return err
}
for relPath, scriptSourceStateEntries := range scriptsDirSourceStateEntries {
- allSourceStateEntries[relPath] = append(allSourceStateEntries[relPath], scriptSourceStateEntries...)
+ addSourceStateEntries(relPath, scriptSourceStateEntries...)
}
return vfs.SkipDir
case fileInfo.Name() == VersionName:
@@ -863,9 +872,11 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
return vfs.SkipDir
}
sourceStateDir := s.newSourceStateDir(sourceRelPath, da)
- allSourceStateEntries[targetRelPath] = append(allSourceStateEntries[targetRelPath], sourceStateDir)
+ addSourceStateEntries(targetRelPath, sourceStateDir)
if sourceStateDir.Attr.Remove {
+ s.Lock()
s.removeDirs[targetRelPath] = struct{}{}
+ s.Unlock()
}
return nil
case fileInfo.Mode().IsRegular():
@@ -876,7 +887,7 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
}
var sourceStateEntry SourceStateEntry
targetRelPath, sourceStateEntry = s.newSourceStateFile(sourceRelPath, fa, targetRelPath)
- allSourceStateEntries[targetRelPath] = append(allSourceStateEntries[targetRelPath], sourceStateEntry)
+ addSourceStateEntries(targetRelPath, sourceStateEntry)
return nil
default:
return &unsupportedFileTypeError{
@@ -885,7 +896,7 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
}
}
}
- if err := WalkSourceDir(s.system, s.sourceDirAbsPath, walkFunc); err != nil {
+ if err := concurrentWalkSourceDir(ctx, s.system, s.sourceDirAbsPath, walkFunc); err != nil {
return err
}
@@ -1087,6 +1098,8 @@ func (s *SourceState) addExternal(sourceAbsPath AbsPath) error {
if err := format.Unmarshal(data, &externals); err != nil {
return fmt.Errorf("%s: %w", sourceAbsPath, err)
}
+ s.Lock()
+ defer s.Unlock()
for relPathStr, external := range externals {
targetRelPath := parentTargetSourceRelPath.JoinString(relPathStr)
if _, ok := s.externals[targetRelPath]; ok {
@@ -1145,13 +1158,15 @@ func (s *SourceState) addTemplateData(sourceAbsPath AbsPath) error {
if err := format.Unmarshal(data, &templateData); err != nil {
return fmt.Errorf("%s: %w", sourceAbsPath, err)
}
+ s.Lock()
RecursiveMerge(s.userTemplateData, templateData)
+ s.Unlock()
return nil
}
// addTemplatesDir adds all templates in templatesDirAbsPath to s.
-func (s *SourceState) addTemplatesDir(templatesDirAbsPath AbsPath) error {
- walkFunc := func(templateAbsPath AbsPath, fileInfo fs.FileInfo, err error) error {
+func (s *SourceState) addTemplatesDir(ctx context.Context, templatesDirAbsPath AbsPath) error {
+ walkFunc := func(ctx context.Context, templateAbsPath AbsPath, fileInfo fs.FileInfo, err error) error {
if templateAbsPath == templatesDirAbsPath {
return nil
}
@@ -1179,10 +1194,9 @@ func (s *SourceState) addTemplatesDir(templatesDirAbsPath AbsPath) error {
if err != nil {
return err
}
- if s.templates == nil {
- s.templates = make(map[string]*template.Template)
- }
+ s.Lock()
s.templates[name] = tmpl
+ s.Unlock()
return nil
case fileInfo.IsDir():
return nil
@@ -1193,7 +1207,7 @@ func (s *SourceState) addTemplatesDir(templatesDirAbsPath AbsPath) error {
}
}
}
- return WalkSourceDir(s.system, templatesDirAbsPath, walkFunc)
+ return concurrentWalkSourceDir(ctx, s.system, templatesDirAbsPath, walkFunc)
}
// executeTemplate executes the template at path and returns the result.
@@ -1885,9 +1899,17 @@ func (s *SourceState) readExternalFile(
}
// readScriptsDir reads all scripts in scriptsDirAbsPath.
-func (s *SourceState) readScriptsDir(scriptsDirAbsPath AbsPath) (map[RelPath][]SourceStateEntry, error) {
+func (s *SourceState) readScriptsDir(
+ ctx context.Context, scriptsDirAbsPath AbsPath,
+) (map[RelPath][]SourceStateEntry, error) {
+ var allSourceStateEntriesLock sync.Mutex
allSourceStateEntries := make(map[RelPath][]SourceStateEntry)
- walkFunc := func(sourceAbsPath AbsPath, fileInfo fs.FileInfo, err error) error {
+ addSourceStateEntry := func(relPath RelPath, sourceStateEntry SourceStateEntry) {
+ allSourceStateEntriesLock.Lock()
+ allSourceStateEntries[relPath] = append(allSourceStateEntries[relPath], sourceStateEntry)
+ allSourceStateEntriesLock.Unlock()
+ }
+ walkFunc := func(ctx context.Context, sourceAbsPath AbsPath, fileInfo fs.FileInfo, err error) error {
if err != nil {
return err
}
@@ -1938,7 +1960,7 @@ func (s *SourceState) readScriptsDir(scriptsDirAbsPath AbsPath) (map[RelPath][]S
}
var sourceStateEntry SourceStateEntry
targetRelPath, sourceStateEntry = s.newSourceStateFile(sourceRelPath, fa, targetRelPath)
- allSourceStateEntries[targetRelPath] = append(allSourceStateEntries[targetRelPath], sourceStateEntry)
+ addSourceStateEntry(targetRelPath, sourceStateEntry)
return nil
default:
return &unsupportedFileTypeError{
@@ -1947,7 +1969,7 @@ func (s *SourceState) readScriptsDir(scriptsDirAbsPath AbsPath) (map[RelPath][]S
}
}
}
- if err := WalkSourceDir(s.system, scriptsDirAbsPath, walkFunc); err != nil {
+ if err := concurrentWalkSourceDir(ctx, s.system, scriptsDirAbsPath, walkFunc); err != nil {
return nil, err
}
return allSourceStateEntries, nil
diff --git a/internal/chezmoi/sourcestate_test.go b/internal/chezmoi/sourcestate_test.go
index 7248a682366..60b7222ba7d 100644
--- a/internal/chezmoi/sourcestate_test.go
+++ b/internal/chezmoi/sourcestate_test.go
@@ -1549,50 +1549,6 @@ func TestSourceStateTargetRelPaths(t *testing.T) {
}
}
-func TestWalkSourceDir(t *testing.T) {
- sourceDirAbsPath := NewAbsPath("/home/user/.local/share/chezmoi")
- root := map[string]interface{}{
- sourceDirAbsPath.String(): map[string]interface{}{
- ".chezmoi.toml.tmpl": "",
- ".chezmoidata.json": "",
- ".chezmoidata.toml": "",
- ".chezmoidata.yaml": "",
- ".chezmoiexternal.yaml": "",
- ".chezmoiignore": "",
- ".chezmoiremove": "",
- ".chezmoitemplates": &vfst.Dir{Perm: 0o777},
- ".chezmoiversion": "",
- "dot_file": "",
- },
- }
- expectedAbsPaths := []AbsPath{
- sourceDirAbsPath,
- sourceDirAbsPath.JoinString(".chezmoiversion"),
- sourceDirAbsPath.JoinString(".chezmoidata.json"),
- sourceDirAbsPath.JoinString(".chezmoidata.toml"),
- sourceDirAbsPath.JoinString(".chezmoidata.yaml"),
- sourceDirAbsPath.JoinString(".chezmoitemplates"),
- sourceDirAbsPath.JoinString(".chezmoi.toml.tmpl"),
- sourceDirAbsPath.JoinString(".chezmoiexternal.yaml"),
- sourceDirAbsPath.JoinString(".chezmoiignore"),
- sourceDirAbsPath.JoinString(".chezmoiremove"),
- sourceDirAbsPath.JoinString("dot_file"),
- }
-
- var actualAbsPaths []AbsPath
- chezmoitest.WithTestFS(t, root, func(fileSystem vfs.FS) {
- system := NewRealSystem(fileSystem)
- require.NoError(t, WalkSourceDir(system, sourceDirAbsPath, func(absPath AbsPath, fileInfo fs.FileInfo, err error) error {
- if err != nil {
- return err
- }
- actualAbsPaths = append(actualAbsPaths, absPath)
- return nil
- }))
- })
- assert.Equal(t, expectedAbsPaths, actualAbsPaths)
-}
-
// applyAll updates targetDirAbsPath in targetSystem to match s.
func (s *SourceState) applyAll(
targetSystem, destSystem System, persistentState PersistentState, targetDirAbsPath AbsPath, options ApplyOptions,
diff --git a/internal/chezmoi/system.go b/internal/chezmoi/system.go
index 342b50e12c9..e27c06259b4 100644
--- a/internal/chezmoi/system.go
+++ b/internal/chezmoi/system.go
@@ -1,12 +1,15 @@
package chezmoi
import (
+ "context"
"errors"
"io/fs"
"os/exec"
"sort"
+ "strings"
vfs "github.com/twpayne/go-vfs/v4"
+ "golang.org/x/sync/errgroup"
)
// A System reads from and writes to a filesystem, executes idempotent commands,
@@ -154,6 +157,10 @@ func Walk(system System, rootAbsPath AbsPath, walkFunc WalkFunc) error {
// directory.
type WalkSourceDirFunc func(absPath AbsPath, fileInfo fs.FileInfo, err error) error
+// A concurrentWalkSourceDirFunc is a function called concurrently for every
+// entry in a source directory.
+type concurrentWalkSourceDirFunc func(ctx context.Context, absPath AbsPath, fileInfo fs.FileInfo, err error) error
+
// WalkSourceDir walks the source directory rooted at sourceDirAbsPath in
// system, calling walkFunc for each file or directory in the tree, including
// sourceDirAbsPath.
@@ -207,20 +214,7 @@ func walkSourceDir(system System, name AbsPath, fileInfo fs.FileInfo, walkFunc W
}
}
- sort.Slice(dirEntries, func(i, j int) bool {
- nameI := dirEntries[i].Name()
- nameJ := dirEntries[j].Name()
- orderI := sourceDirEntryOrder[nameI]
- orderJ := sourceDirEntryOrder[nameJ]
- switch {
- case orderI < orderJ:
- return true
- case orderI == orderJ:
- return nameI < nameJ
- default:
- return false
- }
- })
+ sortSourceDirEntries(dirEntries)
for _, dirEntry := range dirEntries {
fileInfo, err := dirEntry.Info()
@@ -239,3 +233,71 @@ func walkSourceDir(system System, name AbsPath, fileInfo fs.FileInfo, walkFunc W
return nil
}
+
+func concurrentWalkSourceDir(
+ ctx context.Context, system System, dirAbsPath AbsPath, walkFunc concurrentWalkSourceDirFunc,
+) error {
+ dirEntries, err := system.ReadDir(dirAbsPath)
+ if err != nil {
+ return walkFunc(ctx, dirAbsPath, nil, err)
+ }
+ sortSourceDirEntries(dirEntries)
+
+ // Walk all control plane entries in order.
+ visitDirEntry := func(dirEntry fs.DirEntry) error {
+ absPath := dirAbsPath.Join(NewRelPath(dirEntry.Name()))
+ fileInfo, err := dirEntry.Info()
+ if err != nil {
+ return walkFunc(ctx, absPath, nil, err)
+ }
+ switch err := walkFunc(ctx, absPath, fileInfo, nil); {
+ case fileInfo.IsDir() && errors.Is(err, fs.SkipDir):
+ return nil
+ case err != nil:
+ return err
+ case fileInfo.IsDir():
+ return concurrentWalkSourceDir(ctx, system, absPath, walkFunc)
+ default:
+ return nil
+ }
+ }
+ i := 0
+ for ; i < len(dirEntries); i++ {
+ dirEntry := dirEntries[i]
+ if !strings.HasPrefix(dirEntry.Name(), ".") {
+ break
+ }
+ if err := visitDirEntry(dirEntry); err != nil {
+ return err
+ }
+ }
+
+ // Walk all remaining entries concurrently.
+ visitDirEntryFunc := func(dirEntry fs.DirEntry) func() error {
+ return func() error {
+ return visitDirEntry(dirEntry)
+ }
+ }
+ group, ctx := errgroup.WithContext(ctx)
+ for _, dirEntry := range dirEntries[i:] {
+ group.Go(visitDirEntryFunc(dirEntry))
+ }
+ return group.Wait()
+}
+
+func sortSourceDirEntries(dirEntries []fs.DirEntry) {
+ sort.Slice(dirEntries, func(i, j int) bool {
+ nameI := dirEntries[i].Name()
+ nameJ := dirEntries[j].Name()
+ orderI := sourceDirEntryOrder[nameI]
+ orderJ := sourceDirEntryOrder[nameJ]
+ switch {
+ case orderI < orderJ:
+ return true
+ case orderI == orderJ:
+ return nameI < nameJ
+ default:
+ return false
+ }
+ })
+}
diff --git a/internal/chezmoi/system_test.go b/internal/chezmoi/system_test.go
new file mode 100644
index 00000000000..f0f4c61a921
--- /dev/null
+++ b/internal/chezmoi/system_test.go
@@ -0,0 +1,91 @@
+package chezmoi
+
+import (
+ "context"
+ "io/fs"
+ "sort"
+ "sync"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+ "github.com/twpayne/go-vfs/v4"
+ "github.com/twpayne/go-vfs/v4/vfst"
+
+ "github.com/twpayne/chezmoi/v2/internal/chezmoitest"
+)
+
+func TestConcurrentWalkSourceDir(t *testing.T) {
+ sourceDirAbsPath := NewAbsPath("/home/user/.local/share/chezmoi")
+ root := map[string]interface{}{
+ sourceDirAbsPath.String(): map[string]interface{}{
+ ".chezmoiversion": "# contents of .chezmoiversion\n",
+ "dot_dir/file": "# contents of .dir/file\n",
+ },
+ }
+ expectedSourceAbsPaths := AbsPaths{
+ sourceDirAbsPath.JoinString(".chezmoiversion"),
+ sourceDirAbsPath.JoinString("dot_dir"),
+ sourceDirAbsPath.JoinString("dot_dir/file"),
+ }
+
+ var actualSourceAbsPaths AbsPaths
+ chezmoitest.WithTestFS(t, root, func(fileSystem vfs.FS) {
+ ctx := context.Background()
+ system := NewRealSystem(fileSystem)
+ var mutex sync.Mutex
+ walkFunc := func(ctx context.Context, sourceAbsPath AbsPath, fileInfo fs.FileInfo, err error) error {
+ mutex.Lock()
+ actualSourceAbsPaths = append(actualSourceAbsPaths, sourceAbsPath)
+ mutex.Unlock()
+ return nil
+ }
+ require.NoError(t, concurrentWalkSourceDir(ctx, system, sourceDirAbsPath, walkFunc))
+ })
+ sort.Sort(actualSourceAbsPaths)
+ assert.Equal(t, expectedSourceAbsPaths, actualSourceAbsPaths)
+}
+
+func TestWalkSourceDir(t *testing.T) {
+ sourceDirAbsPath := NewAbsPath("/home/user/.local/share/chezmoi")
+ root := map[string]interface{}{
+ sourceDirAbsPath.String(): map[string]interface{}{
+ ".chezmoi.toml.tmpl": "",
+ ".chezmoidata.json": "",
+ ".chezmoidata.toml": "",
+ ".chezmoidata.yaml": "",
+ ".chezmoiexternal.yaml": "",
+ ".chezmoiignore": "",
+ ".chezmoiremove": "",
+ ".chezmoitemplates": &vfst.Dir{Perm: 0o777},
+ ".chezmoiversion": "",
+ "dot_file": "",
+ },
+ }
+ expectedSourceDirAbsPaths := []AbsPath{
+ sourceDirAbsPath,
+ sourceDirAbsPath.JoinString(".chezmoiversion"),
+ sourceDirAbsPath.JoinString(".chezmoidata.json"),
+ sourceDirAbsPath.JoinString(".chezmoidata.toml"),
+ sourceDirAbsPath.JoinString(".chezmoidata.yaml"),
+ sourceDirAbsPath.JoinString(".chezmoitemplates"),
+ sourceDirAbsPath.JoinString(".chezmoi.toml.tmpl"),
+ sourceDirAbsPath.JoinString(".chezmoiexternal.yaml"),
+ sourceDirAbsPath.JoinString(".chezmoiignore"),
+ sourceDirAbsPath.JoinString(".chezmoiremove"),
+ sourceDirAbsPath.JoinString("dot_file"),
+ }
+
+ var actualSourceDirAbsPaths []AbsPath
+ chezmoitest.WithTestFS(t, root, func(fileSystem vfs.FS) {
+ system := NewRealSystem(fileSystem)
+ require.NoError(t, WalkSourceDir(system, sourceDirAbsPath, func(absPath AbsPath, fileInfo fs.FileInfo, err error) error {
+ if err != nil {
+ return err
+ }
+ actualSourceDirAbsPaths = append(actualSourceDirAbsPaths, absPath)
+ return nil
+ }))
+ })
+ assert.Equal(t, expectedSourceDirAbsPaths, actualSourceDirAbsPaths)
+}
|
chore
|
Read source directory concurrently
|
51fc86ae47936fdf9c7b42e9db70600791904e6d
|
2022-09-29 07:44:00
|
Tom Payne
|
chore: Add test that chezmoi apply uses textconv
| false
|
diff --git a/pkg/cmd/testdata/scripts/textconv.txtar b/pkg/cmd/testdata/scripts/textconv.txtar
index ebd6f1f7207..7ac65b4da2b 100644
--- a/pkg/cmd/testdata/scripts/textconv.txtar
+++ b/pkg/cmd/testdata/scripts/textconv.txtar
@@ -2,9 +2,14 @@
[!exec:tr] skip 'tr not found in $PATH'
# test that chezmoi diff uses textconv
-exec chezmoi --debug diff
+exec chezmoi diff
cmp stdout golden/diff
+# test that chezmoi apply uses textconv
+exec chezmoi apply --verbose
+cmp stdout golden/diff
+cmp $HOME/file.txt golden/file.txt
+
-- golden/diff --
diff --git a/file.txt b/file.txt
index b0ebb2af412bf3812b0bf8c5d7b950feb8a701be..4d977287915d918f15ef3df13146c1fa58914d30 100644
@@ -13,6 +18,8 @@ index b0ebb2af412bf3812b0bf8c5d7b950feb8a701be..4d977287915d918f15ef3df13146c1fa
@@ -1 +1 @@
-# PREVIOUS CONTENTS OF FILE.TXT
+# CONTENTS OF FILE.TXT
+-- golden/file.txt --
+# contents of file.txt
-- home/user/.config/chezmoi/chezmoi.yaml --
textconv:
- pattern: '**/*.txt'
|
chore
|
Add test that chezmoi apply uses textconv
|
eaf4c6664cd6d8a59797db6939eb3e98439f7d8c
|
2023-03-07 02:56:51
|
Tom Payne
|
feat: Don't allow chezmoi cd commands to nest
| false
|
diff --git a/pkg/cmd/cdcmd.go b/pkg/cmd/cdcmd.go
index caf9a12dc20..4c4417de788 100644
--- a/pkg/cmd/cdcmd.go
+++ b/pkg/cmd/cdcmd.go
@@ -1,6 +1,9 @@
package cmd
import (
+ "errors"
+ "os"
+
"github.com/spf13/cobra"
"github.com/twpayne/chezmoi/v2/pkg/chezmoi"
@@ -32,6 +35,10 @@ func (c *Config) newCDCmd() *cobra.Command {
}
func (c *Config) runCDCmd(cmd *cobra.Command, args []string) error {
+ if _, ok := os.LookupEnv("CHEZMOI"); ok {
+ return errors.New("already in a chezmoi subshell")
+ }
+
cdCommand, cdArgs, err := c.cdCommand()
if err != nil {
return err
|
feat
|
Don't allow chezmoi cd commands to nest
|
29e8c3062960ad5d2fca74dfb6f0b6403c3eff87
|
2023-08-13 22:46:27
|
Tom Payne
|
fix: Fix minor issues with promptBool docs and errors
| false
|
diff --git a/assets/chezmoi.io/docs/reference/templates/init-functions/promptBool.md b/assets/chezmoi.io/docs/reference/templates/init-functions/promptBool.md
index fe0a10a992e..9a9d101dbb5 100644
--- a/assets/chezmoi.io/docs/reference/templates/init-functions/promptBool.md
+++ b/assets/chezmoi.io/docs/reference/templates/init-functions/promptBool.md
@@ -1,9 +1,9 @@
# `promptBool` *prompt* [*default*]
`promptBool` prompts the user with *prompt* and returns the user's response
-interpreted as a boolean. If *default* is passed the user's response is empty
-then it returns *default*. The user's response is interpreted as follows (case
-insensitive):
+interpreted as a boolean. If *default* is passed and the user's response is
+empty then it returns *default*. The user's response is interpreted as follows
+(case insensitive):
| Response | Result |
| ----------------------- | ------- |
diff --git a/internal/cmd/interactivetemplatefuncs.go b/internal/cmd/interactivetemplatefuncs.go
index 09b014bcce6..76340893c1a 100644
--- a/internal/cmd/interactivetemplatefuncs.go
+++ b/internal/cmd/interactivetemplatefuncs.go
@@ -77,7 +77,7 @@ func (c *Config) promptBoolOnceInteractiveTemplateFunc(
args ...bool,
) bool {
if len(args) > 1 {
- err := fmt.Errorf("want 2 or 3 arguments, got %d", len(args)+2)
+ err := fmt.Errorf("want 3 or 4 arguments, got %d", len(args)+2)
panic(err)
}
|
fix
|
Fix minor issues with promptBool docs and errors
|
fe903d4b5e3b83c53f8cbeb594ba83bc5c095cc9
|
2023-08-29 18:51:55
|
Austin Ziegler
|
docs: Minor expansion of application order docs
| false
|
diff --git a/assets/chezmoi.io/docs/reference/application-order.md b/assets/chezmoi.io/docs/reference/application-order.md
index 87b5778321f..555f0dff531 100644
--- a/assets/chezmoi.io/docs/reference/application-order.md
+++ b/assets/chezmoi.io/docs/reference/application-order.md
@@ -6,8 +6,10 @@ chezmoi is deterministic in its order of application. The order is:
2. Read the destination state.
3. Compute the target state.
4. Run `run_before_` scripts in alphabetical order.
-5. Update entries in the target state (files, directories, scripts, symlinks,
- etc.) in alphabetical order of their target name.
+5. Update entries in the target state (files, directories, externals, scripts,
+ symlinks, etc.) in alphabetical order of their target name. Directories
+ (including those created by externals) are updated before the files they
+ contain.
6. Run `run_after_` scripts in alphabetical order.
Target names are considered after all attributes are stripped.
@@ -26,3 +28,9 @@ chezmoi's behavior when the above assumptions are violated is undefined. For
example, using a `run_before_` script to update files in the source or
destination states violates the assumption that the source and destination
states do not change while chezmoi is running.
+
+!!! note
+
+ External sources are updated during the update phase; it is inadvisable for
+ a `run_before_` script to depend on an external applied *during* the update
+ phase. `run_after_` scripts may freely depend on externals.
|
docs
|
Minor expansion of application order docs
|
1e408073fb0cd5ff755f6dcac160e66af1a34e95
|
2024-02-26 02:03:32
|
Tom Payne
|
chore: Fix struct tags
| false
|
diff --git a/internal/cmd/textconv.go b/internal/cmd/textconv.go
index 0f307ebe11e..d4d799507ca 100644
--- a/internal/cmd/textconv.go
+++ b/internal/cmd/textconv.go
@@ -12,9 +12,9 @@ import (
)
type textConvElement struct {
- Pattern string `json:"pattern" toml:"pattern" yaml:"pattern"`
- Command string `json:"command" toml:"command" yaml:"command"`
- Args []string `json:"args" toml:"args" yaml:"args"`
+ Pattern string `json:"pattern" mapstructure:"pattern" yaml:"pattern"`
+ Command string `json:"command" mapstructure:"command" yaml:"command"`
+ Args []string `json:"args" mapstructure:"args" yaml:"args"`
}
type textConv []*textConvElement
|
chore
|
Fix struct tags
|
7a68dfc6a2b2c6154ba6305d32df8e0bae3076df
|
2024-08-06 05:24:56
|
Tom Payne
|
chore: Minor tidy-ups
| false
|
diff --git a/assets/chezmoi.io/docs/reference/templates/github-functions/gitHubRelease.md b/assets/chezmoi.io/docs/reference/templates/github-functions/gitHubRelease.md
index b522999c412..cc2635b05ac 100644
--- a/assets/chezmoi.io/docs/reference/templates/github-functions/gitHubRelease.md
+++ b/assets/chezmoi.io/docs/reference/templates/github-functions/gitHubRelease.md
@@ -2,7 +2,7 @@
`gitHubRelease` calls the GitHub API to retrieve the latest releases about
the given *owner-repo*, It iterates through all the versions of the release,
-fetching the first entry equal to *version*
+fetching the first entry equal to *version*.
It then returns structured data as defined by the [GitHub Go API
bindings](https://pkg.go.dev/github.com/google/go-github/v63/github#RepositoryRelease).
diff --git a/internal/cmd/config.go b/internal/cmd/config.go
index 5d9fcf63f02..71286ded8fb 100644
--- a/internal/cmd/config.go
+++ b/internal/cmd/config.go
@@ -436,10 +436,10 @@ func newConfig(options ...configOption) (*Config, error) {
"fromYaml": c.fromYamlTemplateFunc,
"gitHubKeys": c.gitHubKeysTemplateFunc,
"gitHubLatestRelease": c.gitHubLatestReleaseTemplateFunc,
- "gitHubRelease": c.gitHubReleaseTemplateFunc,
"gitHubLatestReleaseAssetURL": c.gitHubLatestReleaseAssetURLTemplateFunc,
- "gitHubReleaseAssetURL": c.gitHubReleaseAssetURLTemplateFunc,
"gitHubLatestTag": c.gitHubLatestTagTemplateFunc,
+ "gitHubRelease": c.gitHubReleaseTemplateFunc,
+ "gitHubReleaseAssetURL": c.gitHubReleaseAssetURLTemplateFunc,
"gitHubReleases": c.gitHubReleasesTemplateFunc,
"gitHubTags": c.gitHubTagsTemplateFunc,
"glob": c.globTemplateFunc,
@@ -477,8 +477,8 @@ func newConfig(options ...configOption) (*Config, error) {
"output": c.outputTemplateFunc,
"pass": c.passTemplateFunc,
"passFields": c.passFieldsTemplateFunc,
- "passhole": c.passholeTemplateFunc,
"passRaw": c.passRawTemplateFunc,
+ "passhole": c.passholeTemplateFunc,
"pruneEmptyDicts": c.pruneEmptyDictsTemplateFunc,
"quoteList": c.quoteListTemplateFunc,
"rbw": c.rbwTemplateFunc,
diff --git a/internal/cmd/githubtemplatefuncs.go b/internal/cmd/githubtemplatefuncs.go
index 0b022d349fe..686e4d50ff4 100644
--- a/internal/cmd/githubtemplatefuncs.go
+++ b/internal/cmd/githubtemplatefuncs.go
@@ -38,10 +38,10 @@ type gitHubTagsState struct {
var (
gitHubKeysStateBucket = []byte("gitHubLatestKeysState")
- gitHubVersionReleaseStateBucket = []byte("gitHubVersionReleaseState")
gitHubLatestReleaseStateBucket = []byte("gitHubLatestReleaseState")
gitHubReleasesStateBucket = []byte("gitHubReleasesState")
gitHubTagsStateBucket = []byte("gitHubTagsState")
+ gitHubVersionReleaseStateBucket = []byte("gitHubVersionReleaseState")
)
type gitHubData struct {
diff --git a/internal/cmd/statecmd.go b/internal/cmd/statecmd.go
index 102a7981e65..24c64da7fd4 100644
--- a/internal/cmd/statecmd.go
+++ b/internal/cmd/statecmd.go
@@ -175,9 +175,9 @@ func (c *Config) runStateDumpCmd(cmd *cobra.Command, args []string) error {
"entryState": chezmoi.EntryStateBucket,
"gitHubKeysState": gitHubKeysStateBucket,
"gitHubLatestReleaseState": gitHubLatestReleaseStateBucket,
- "gitHubVersionReleaseState": gitHubVersionReleaseStateBucket,
"gitHubReleasesState": gitHubReleasesStateBucket,
"gitHubTagsState": gitHubTagsStateBucket,
+ "gitHubVersionReleaseState": gitHubVersionReleaseStateBucket,
"gitRepoExternalState": chezmoi.GitRepoExternalStateBucket,
"scriptState": chezmoi.ScriptStateBucket,
})
diff --git a/internal/cmd/testdata/scripts/githubtemplatefuncs.txtar b/internal/cmd/testdata/scripts/githubtemplatefuncs.txtar
index 79a3c93da00..1d0e9ba34c1 100644
--- a/internal/cmd/testdata/scripts/githubtemplatefuncs.txtar
+++ b/internal/cmd/testdata/scripts/githubtemplatefuncs.txtar
@@ -8,14 +8,6 @@ stdout ^ssh-rsa
exec chezmoi execute-template '{{ (gitHubLatestRelease "twpayne/chezmoi").TagName }}'
stdout ^v2\.
-# test gitHubLatestRelease template function
-exec chezmoi execute-template '{{ (gitHubLatestRelease "2.51.0" "twpayne/chezmoi").TagName }}'
-stdout ^v2.51.0
-
-# test gitHubLatestRelease template function
-exec chezmoi execute-template '{{ (gitHubLatestRelease "2.49.0" "twpayne/chezmoi").TagName }}'
-stdout ^v2.49.0
-
# test gitHubLatestTag template function
exec chezmoi execute-template '{{ (gitHubLatestTag "twpayne/chezmoi").Name }}'
stdout ^v2\.
@@ -24,9 +16,14 @@ stdout ^v2\.
exec chezmoi execute-template '{{ (index (gitHubTags "twpayne/chezmoi") 0).Name }}'
stdout ^v2\.
+# test gitHubRelease template function
+exec chezmoi execute-template '{{ (gitHubRelease "twpayne/chezmoi" "v2.49.0").TagName }}'
+stdout ^v2\.49\.0
+
+# test gitHubReleaseAssetURL template function
+[!windows] exec chezmoi execute-template '{{ gitHubReleaseAssetURL "twpayne/chezmoi" "v2.50.0" (printf "chezmoi-%s-%s" .chezmoi.os .chezmoi.arch) }}'
+[!windows] stdout https://github.com/twpayne/chezmoi/releases/download/v2\.50\.0/chezmoi-
+
# test gitHubReleases template functions
exec chezmoi execute-template '{{ (index (gitHubReleases "twpayne/chezmoi") 0).TagName }}'
stdout ^v2\.
-
-# gitHubReleases
-# gitHubTags
|
chore
|
Minor tidy-ups
|
809c657a4c37967b4e4771ad15c6377dfd1b5125
|
2024-11-02 02:58:14
|
Tom Payne
|
chore: Miscellaneous fixes suggested by gocritic
| false
|
diff --git a/.golangci.yml b/.golangci.yml
index 2fa3ebb68a6..5dd8ed478c0 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -124,6 +124,14 @@ linters-settings:
- standard
- default
- prefix(github.com/twpayne/chezmoi)
+ gocritic:
+ enable-all: true
+ disabled-checks:
+ - emptyFallthrough
+ - hugeParam
+ - rangeValCopy
+ - unnamedResult
+ - whyNoLint
gofumpt:
extra-rules: true
module-path: github.com/twpayne/chezmoi
diff --git a/internal/chezmoi/archive.go b/internal/chezmoi/archive.go
index e140a692e9b..efcc50f6f0e 100644
--- a/internal/chezmoi/archive.go
+++ b/internal/chezmoi/archive.go
@@ -78,20 +78,20 @@ func (f ArchiveFormat) Type() string {
return "format"
}
-// GuessArchiveFormat guesses the archive format from the path and data.
-func GuessArchiveFormat(path string, data []byte) ArchiveFormat {
- switch pathLower := strings.ToLower(path); {
- case strings.HasSuffix(pathLower, ".tar"):
+// GuessArchiveFormat guesses the archive format from the name and data.
+func GuessArchiveFormat(name string, data []byte) ArchiveFormat {
+ switch nameLower := strings.ToLower(name); {
+ case strings.HasSuffix(nameLower, ".tar"):
return ArchiveFormatTar
- case strings.HasSuffix(pathLower, ".tar.bz2") || strings.HasSuffix(pathLower, ".tbz2"):
+ case strings.HasSuffix(nameLower, ".tar.bz2") || strings.HasSuffix(nameLower, ".tbz2"):
return ArchiveFormatTarBz2
- case strings.HasSuffix(pathLower, ".tar.gz") || strings.HasSuffix(pathLower, ".tgz"):
+ case strings.HasSuffix(nameLower, ".tar.gz") || strings.HasSuffix(nameLower, ".tgz"):
return ArchiveFormatTarGz
- case strings.HasSuffix(pathLower, ".tar.xz") || strings.HasSuffix(pathLower, ".txz"):
+ case strings.HasSuffix(nameLower, ".tar.xz") || strings.HasSuffix(nameLower, ".txz"):
return ArchiveFormatTarXz
- case strings.HasSuffix(pathLower, ".tar.zst"):
+ case strings.HasSuffix(nameLower, ".tar.zst"):
return ArchiveFormatTarZst
- case strings.HasSuffix(pathLower, ".zip"):
+ case strings.HasSuffix(nameLower, ".zip"):
return ArchiveFormatZip
}
@@ -209,8 +209,7 @@ HEADER:
dirs, _ := path.Split(header.Name)
dirComponents := strings.Split(strings.TrimSuffix(dirs, "/"), "/")
for i := range dirComponents {
- dir := strings.Join(dirComponents[0:i+1], "/")
- if len(dir) > 0 {
+ if dir := strings.Join(dirComponents[0:i+1], "/"); dir != "" {
switch err := processHeader(implicitDirHeader(dir+"/", header.ModTime), dir+"/"); {
case errors.Is(err, fs.SkipDir):
continue HEADER
@@ -290,8 +289,7 @@ FILE:
dirs, _ := path.Split(name)
dirComponents := strings.Split(strings.TrimSuffix(dirs, "/"), "/")
for i := range dirComponents {
- dir := strings.Join(dirComponents[0:i+1], "/")
- if len(dir) > 0 {
+ if dir := strings.Join(dirComponents[0:i+1], "/"); dir != "" {
switch err := processHeader(fileInfo, dir+"/"); {
case errors.Is(err, fs.SkipDir):
continue FILE
diff --git a/internal/chezmoi/data.go b/internal/chezmoi/data.go
index 558fb573008..835d7d9de75 100644
--- a/internal/chezmoi/data.go
+++ b/internal/chezmoi/data.go
@@ -91,7 +91,7 @@ func parseOSRelease(r io.Reader) (map[string]any, error) {
// Trim all leading whitespace, but not necessarily trailing whitespace.
token := strings.TrimLeftFunc(s.Text(), unicode.IsSpace)
// If the line is empty or starts with #, skip.
- if len(token) == 0 || token[0] == '#' {
+ if token == "" || token[0] == '#' {
continue
}
key, value, ok := strings.Cut(token, "=")
diff --git a/internal/chezmoi/diff.go b/internal/chezmoi/diff.go
index f7c67285feb..70327b390c0 100644
--- a/internal/chezmoi/diff.go
+++ b/internal/chezmoi/diff.go
@@ -48,9 +48,9 @@ type gitDiffFilePatch struct {
chunks []diff.Chunk
}
-func (fp *gitDiffFilePatch) IsBinary() bool { return fp.isBinary }
-func (fp *gitDiffFilePatch) Files() (diff.File, diff.File) { return fp.from, fp.to }
-func (fp *gitDiffFilePatch) Chunks() []diff.Chunk { return fp.chunks }
+func (fp *gitDiffFilePatch) IsBinary() bool { return fp.isBinary }
+func (fp *gitDiffFilePatch) Files() (from, to diff.File) { return fp.from, fp.to }
+func (fp *gitDiffFilePatch) Chunks() []diff.Chunk { return fp.chunks }
// A gitDiffPatch implements the
// github.com/go-git/go-git/v5/plumbing/format/diff.Patch interface.
diff --git a/internal/chezmoi/sourcestate.go b/internal/chezmoi/sourcestate.go
index e7bf038fb62..68d07294b07 100644
--- a/internal/chezmoi/sourcestate.go
+++ b/internal/chezmoi/sourcestate.go
@@ -113,7 +113,7 @@ type External struct {
// A SourceState is a source state.
type SourceState struct {
- sync.Mutex
+ mutex sync.Mutex
root sourceStateEntryTreeNode
removeDirs chezmoiset.Set[RelPath]
baseSystem System
@@ -831,8 +831,8 @@ func (s *SourceState) Get(targetRelPath RelPath) SourceStateEntry {
// Ignore returns if targetRelPath should be ignored.
func (s *SourceState) Ignore(targetRelPath RelPath) bool {
- s.Lock()
- defer s.Unlock()
+ s.mutex.Lock()
+ defer s.mutex.Unlock()
ignore := s.ignore.match(targetRelPath.String()) == patternSetMatchInclude
if ignore {
s.ignoredRelPaths.Add(targetRelPath)
@@ -1036,9 +1036,9 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
return fs.SkipDir
}
if sourceStateDir.Attr.Remove {
- s.Lock()
+ s.mutex.Lock()
s.removeDirs.Add(targetRelPath)
- s.Unlock()
+ s.mutex.Unlock()
}
return nil
case fileInfo.Mode().IsRegular():
@@ -1310,8 +1310,8 @@ func (s *SourceState) TargetRelPaths() []RelPath {
// TemplateData returns a copy of s's template data.
func (s *SourceState) TemplateData() map[string]any {
- s.Lock()
- defer s.Unlock()
+ s.mutex.Lock()
+ defer s.mutex.Unlock()
if s.templateData == nil {
s.templateData = make(map[string]any)
@@ -1351,8 +1351,8 @@ func (s *SourceState) addExternal(sourceAbsPath, parentAbsPath AbsPath) error {
if err := format.Unmarshal(data, &externals); err != nil {
return fmt.Errorf("%s: %w", sourceAbsPath, err)
}
- s.Lock()
- defer s.Unlock()
+ s.mutex.Lock()
+ defer s.mutex.Unlock()
for path, external := range externals {
if strings.HasPrefix(path, "/") || filepath.IsAbs(path) {
return fmt.Errorf("%s: %s: path is not relative", sourceAbsPath, path)
@@ -1406,8 +1406,8 @@ func (s *SourceState) addPatterns(patternSet *patternSet, sourceAbsPath AbsPath,
return err
}
- s.Lock()
- defer s.Unlock()
+ s.mutex.Lock()
+ defer s.mutex.Unlock()
dir := sourceRelPath.Dir().TargetRelPath("")
scanner := bufio.NewScanner(bytes.NewReader(data))
@@ -1450,12 +1450,12 @@ func (s *SourceState) addTemplateData(sourceAbsPath AbsPath) error {
if err := format.Unmarshal(data, &templateData); err != nil {
return fmt.Errorf("%s: %w", sourceAbsPath, err)
}
- s.Lock()
+ s.mutex.Lock()
RecursiveMerge(s.userTemplateData, templateData)
// Clear the cached template data, as the change to the user template data
// means that the cached value is now invalid.
s.templateData = nil
- s.Unlock()
+ s.mutex.Unlock()
return nil
}
@@ -1525,9 +1525,9 @@ func (s *SourceState) addTemplatesDir(ctx context.Context, templatesDirAbsPath A
if err != nil {
return err
}
- s.Lock()
+ s.mutex.Lock()
s.templates[name] = tmpl
- s.Unlock()
+ s.mutex.Unlock()
return nil
case fileInfo.IsDir():
return nil
@@ -1936,7 +1936,8 @@ func (s *SourceState) newModifyTargetStateEntryFunc(
}
}
_, err = tempFile.Write(modifierContents)
- if chezmoierrors.CombineFunc(&err, tempFile.Close); err != nil {
+ err = chezmoierrors.Combine(err, tempFile.Close())
+ if err != nil {
return
}
@@ -2209,20 +2210,20 @@ func (s *SourceState) newSourceStateFileEntryFromSymlink(
return nil, err
}
contents := []byte(linkname)
- template := false
+ isTemplate := false
switch {
case options.AutoTemplate:
- contents, template = autoTemplate(contents, s.TemplateData())
+ contents, isTemplate = autoTemplate(contents, s.TemplateData())
case options.Template:
- template = true
+ isTemplate = true
case !options.Template && options.TemplateSymlinks:
switch {
case strings.HasPrefix(linkname, s.sourceDirAbsPath.String()+"/"):
contents = []byte("{{ .chezmoi.sourceDir }}/" + linkname[s.sourceDirAbsPath.Len()+1:])
- template = true
+ isTemplate = true
case strings.HasPrefix(linkname, s.destDirAbsPath.String()+"/"):
contents = []byte("{{ .chezmoi.homeDir }}/" + linkname[s.destDirAbsPath.Len()+1:])
- template = true
+ isTemplate = true
}
}
contents = append(contents, '\n')
@@ -2231,7 +2232,7 @@ func (s *SourceState) newSourceStateFileEntryFromSymlink(
fileAttr := FileAttr{
TargetName: fileInfo.Name(),
Type: SourceFileTypeSymlink,
- Template: template,
+ Template: isTemplate,
}
sourceRelPath := parentSourceRelPath.Join(NewSourceRelPath(fileAttr.SourceName(s.encryption.EncryptedSuffix())))
return &SourceStateFile{
@@ -2476,12 +2477,12 @@ func (s *SourceState) readExternalArchiveData(
return nil, ArchiveFormatUnknown, err
}
- url, err := url.Parse(external.URL)
+ externalURL, err := url.Parse(external.URL)
if err != nil {
err := fmt.Errorf("%s: %s: %w", externalRelPath, external.URL, err)
return nil, ArchiveFormatUnknown, err
}
- urlPath := url.Path
+ urlPath := externalURL.Path
if external.Encrypted {
urlPath = strings.TrimSuffix(urlPath, s.encryption.EncryptedSuffix())
}
diff --git a/internal/chezmoi/template.go b/internal/chezmoi/template.go
index 195cda8c0e2..a13a5cb086b 100644
--- a/internal/chezmoi/template.go
+++ b/internal/chezmoi/template.go
@@ -27,7 +27,7 @@ type TemplateOptions struct {
// templateOptions.
func ParseTemplate(name string, data []byte, funcs template.FuncMap, options TemplateOptions) (*Template, error) {
contents := options.parseAndRemoveDirectives(data)
- template, err := template.New(name).
+ tmpl, err := template.New(name).
Option(options.Options...).
Delims(options.LeftDelimiter, options.RightDelimiter).
Funcs(funcs).
@@ -37,7 +37,7 @@ func ParseTemplate(name string, data []byte, funcs template.FuncMap, options Tem
}
return &Template{
name: name,
- template: template,
+ template: tmpl,
options: options,
}, nil
}
diff --git a/internal/chezmoierrors/chezmoierrors.go b/internal/chezmoierrors/chezmoierrors.go
index 89aaff7fa7f..5f5634e8e43 100644
--- a/internal/chezmoierrors/chezmoierrors.go
+++ b/internal/chezmoierrors/chezmoierrors.go
@@ -27,7 +27,7 @@ func Combine(errs ...error) error {
// CombineFunc combines the error pointed to by errp with the result of calling
// f.
-func CombineFunc(errp *error, f func() error) {
+func CombineFunc(errp *error, f func() error) { //nolint:gocritic
if err := f(); err != nil {
*errp = Combine(*errp, err)
}
diff --git a/internal/cmd/awssecretsmanagertemplatefuncs.go b/internal/cmd/awssecretsmanagertemplatefuncs.go
index 871026574e3..f338d8e8971 100644
--- a/internal/cmd/awssecretsmanagertemplatefuncs.go
+++ b/internal/cmd/awssecretsmanagertemplatefuncs.go
@@ -25,10 +25,10 @@ func (c *Config) awsSecretsManagerRawTemplateFunc(arn string) string {
if c.AWSSecretsManager.svc == nil {
var opts []func(*config.LoadOptions) error
- if region := c.AWSSecretsManager.Region; len(region) > 0 {
+ if region := c.AWSSecretsManager.Region; region != "" {
opts = append(opts, config.WithRegion(region))
}
- if profile := c.AWSSecretsManager.Profile; len(profile) > 0 {
+ if profile := c.AWSSecretsManager.Profile; profile != "" {
opts = append(opts, config.WithSharedConfigProfile(profile))
}
diff --git a/internal/cmd/config.go b/internal/cmd/config.go
index f2344f21d06..d308270ee71 100644
--- a/internal/cmd/config.go
+++ b/internal/cmd/config.go
@@ -1848,7 +1848,7 @@ func (c *Config) newSourceState(
func (c *Config) persistentPostRunRootE(cmd *cobra.Command, args []string) error {
annotations := getAnnotations(cmd)
- // Verify modified config
+ // Verify modified config.
if annotations.hasTag(modifiesConfigFile) {
configFileContents, err := c.baseSystem.ReadFile(c.getConfigFileAbsPath())
switch {
@@ -1872,7 +1872,7 @@ func (c *Config) persistentPostRunRootE(cmd *cobra.Command, args []string) error
}
}
- // Perform auto git commands
+ // Perform auto git commands.
if annotations.hasTag(modifiesSourceDirectory) {
var status *chezmoigit.Status
if c.Git.AutoAdd || c.Git.AutoCommit || c.Git.AutoPush {
@@ -1901,7 +1901,7 @@ func (c *Config) persistentPostRunRootE(cmd *cobra.Command, args []string) error
return nil
}
-// persistentPostRunRootE is not run if command returns error, perform cleanup here.
+// finalizeRootCmd cleans up.
func (c *Config) finalizeRootCmd() {
if c.persistentState != nil {
if err := c.persistentState.Close(); err != nil {
@@ -2193,18 +2193,17 @@ func (c *Config) persistentPreRunRootE(cmd *cobra.Command, args []string) error
// Determine the working tree directory if it is not configured.
if c.WorkingTreeAbsPath.Empty() {
workingTreeAbsPath := c.SourceDirAbsPath
- FOR:
for {
gitDirAbsPath := workingTreeAbsPath.JoinString(git.GitDirName)
if _, err := c.baseSystem.Stat(gitDirAbsPath); err == nil {
c.WorkingTreeAbsPath = workingTreeAbsPath
- break FOR
+ break
}
prevWorkingTreeDirAbsPath := workingTreeAbsPath
workingTreeAbsPath = workingTreeAbsPath.Dir()
if workingTreeAbsPath == c.homeDirAbsPath || workingTreeAbsPath.Len() >= prevWorkingTreeDirAbsPath.Len() {
c.WorkingTreeAbsPath = c.SourceDirAbsPath
- break FOR
+ break
}
}
}
diff --git a/internal/cmd/config_tags_test.go b/internal/cmd/config_tags_test.go
index a4128ed25a9..bafbf9ef448 100644
--- a/internal/cmd/config_tags_test.go
+++ b/internal/cmd/config_tags_test.go
@@ -73,9 +73,9 @@ func verifyTagsArePresentAndMatch(structType reflect.Type) (failed bool, errMsg
for value, tagsMatching := range tagValueGroups {
if len(tagsMatching) == 1 {
- errs.WriteString(fmt.Sprintf("\n %s says \"%s\"", tagsMatching[0], value))
+ errs.WriteString(fmt.Sprintf("\n %s says %q", tagsMatching[0], value))
} else {
- errs.WriteString(fmt.Sprintf("\n (%s) each say \"%s\"", strings.Join(tagsMatching, ", "), value))
+ errs.WriteString(fmt.Sprintf("\n (%s) each say %q", strings.Join(tagsMatching, ", "), value))
}
}
failed = true
diff --git a/internal/cmd/config_test.go b/internal/cmd/config_test.go
index fe14e708d31..dddd4d30df4 100644
--- a/internal/cmd/config_test.go
+++ b/internal/cmd/config_test.go
@@ -47,9 +47,9 @@ func TestTagFieldNamesMatch(t *testing.T) {
valueMsgs := []string{}
for value, tagsMatching := range tagValueGroups {
if len(tagsMatching) == 1 {
- valueMsgs = append(valueMsgs, fmt.Sprintf("%s says \"%s\"", tagsMatching[0], value))
+ valueMsgs = append(valueMsgs, fmt.Sprintf("%s says %q", tagsMatching[0], value))
} else {
- valueMsgs = append(valueMsgs, fmt.Sprintf("(%s) each say \"%s\"", strings.Join(tagsMatching, ", "), value))
+ valueMsgs = append(valueMsgs, fmt.Sprintf("(%s) each say %q", strings.Join(tagsMatching, ", "), value))
}
}
t.Errorf("ConfigFile field %s has non-matching tag names:\n %s", f.Name, strings.Join(valueMsgs, "\n "))
@@ -600,13 +600,13 @@ func withTestUser(t *testing.T, username string) configOption {
var env string
switch runtime.GOOS {
case "plan9":
- config.homeDir = filepath.Join("/", "home", username)
+ config.homeDir = "/home/" + username
env = "home"
case "windows":
- config.homeDir = filepath.Join("C:\\", "home", username)
+ config.homeDir = "C:\\home\\" + username
env = "USERPROFILE"
default:
- config.homeDir = filepath.Join("/", "home", username)
+ config.homeDir = "/home/" + username
env = "HOME"
}
t.Setenv(env, config.homeDir)
diff --git a/internal/cmd/initcmd.go b/internal/cmd/initcmd.go
index 82eb8be2236..ebb77bbf2ec 100644
--- a/internal/cmd/initcmd.go
+++ b/internal/cmd/initcmd.go
@@ -44,7 +44,7 @@ var repoGuesses = []struct {
sshRepoGuessRepl: "[email protected]:$1/dotfiles.git",
},
{
- rx: regexp.MustCompile(`\A([-0-9A-Za-z]+)/([-\.0-9A-Z_a-z]+?)(\.git)?\z`),
+ rx: regexp.MustCompile(`\A([-0-9A-Za-z]+)/([-.0-9A-Z_a-z]+?)(\.git)?\z`),
httpRepoGuessRepl: "https://github.com/$1/$2.git",
sshRepoGuessRepl: "[email protected]:$1/$2.git",
},
diff --git a/internal/cmd/main_test.go b/internal/cmd/main_test.go
index 3f3861755f4..c935b4417a7 100644
--- a/internal/cmd/main_test.go
+++ b/internal/cmd/main_test.go
@@ -346,12 +346,12 @@ func cmdMkGitConfig(ts *testscript.TestScript, neg bool, args []string) {
if len(args) > 1 {
ts.Fatalf(("usage: mkgitconfig [path]"))
}
- path := filepath.Join(ts.Getenv("HOME"), ".gitconfig")
+ gitconfigPath := filepath.Join(ts.Getenv("HOME"), ".gitconfig")
if len(args) > 0 {
- path = ts.MkAbs(args[0])
+ gitconfigPath = ts.MkAbs(args[0])
}
- ts.Check(os.MkdirAll(filepath.Dir(path), fs.ModePerm))
- ts.Check(writeNewFile(path, []byte(chezmoitest.JoinLines(
+ ts.Check(os.MkdirAll(filepath.Dir(gitconfigPath), fs.ModePerm))
+ ts.Check(writeNewFile(gitconfigPath, []byte(chezmoitest.JoinLines(
`[core]`,
` autocrlf = false`,
`[init]`,
@@ -421,12 +421,12 @@ func cmdMkHomeDir(ts *testscript.TestScript, neg bool, args []string) {
if len(args) > 1 {
ts.Fatalf(("usage: mkhomedir [path]"))
}
- path := ts.Getenv("HOME")
+ homeDir := ts.Getenv("HOME")
if len(args) > 0 {
- path = ts.MkAbs(args[0])
+ homeDir = ts.MkAbs(args[0])
}
workDir := ts.Getenv("WORK")
- relPath, err := filepath.Rel(workDir, path)
+ relPath, err := filepath.Rel(workDir, homeDir)
ts.Check(err)
if err := vfst.NewBuilder().Build(vfs.NewPathFS(vfs.OSFS, workDir), map[string]any{
relPath: map[string]any{
@@ -761,8 +761,8 @@ func goosCondition(cond string) (result, valid bool) {
return
}
-func prependDirToPath(dir, path string) string {
- return strings.Join(append([]string{dir}, filepath.SplitList(path)...), string(os.PathListSeparator))
+func prependDirToPath(dir, pathStr string) string {
+ return strings.Join(append([]string{dir}, filepath.SplitList(pathStr)...), string(os.PathListSeparator))
}
func setup(env *testscript.Env) error {
diff --git a/internal/cmd/onepasswordsdktemplatefuncs.go b/internal/cmd/onepasswordsdktemplatefuncs.go
index 26abdbb0e8a..d3642ba5529 100644
--- a/internal/cmd/onepasswordsdktemplatefuncs.go
+++ b/internal/cmd/onepasswordsdktemplatefuncs.go
@@ -3,7 +3,6 @@ package cmd
import (
"context"
"os"
- "strings"
"github.com/1password/onepassword-sdk-go"
)
@@ -27,7 +26,7 @@ type onepasswordSDKItem struct {
}
func (c *Config) onepasswordSDKItemsGet(vaultID, itemID string) onepasswordSDKItem {
- key := strings.Join([]string{vaultID, itemID}, "\x00")
+ key := vaultID + "\x00" + itemID
if result, ok := c.OnepasswordSDK.itemsGetCache[key]; ok {
return result
}
diff --git a/internal/cmd/readhttpresponse.go b/internal/cmd/readhttpresponse.go
index a36f70ebcfb..a2a9f31ca4c 100644
--- a/internal/cmd/readhttpresponse.go
+++ b/internal/cmd/readhttpresponse.go
@@ -113,25 +113,25 @@ func (c *Config) readHTTPResponse(resp *http.Response) ([]byte, error) {
return io.ReadAll(resp.Body)
case resp.ContentLength >= 0:
- progress := progress.New(
+ httpProgress := progress.New(
progress.WithWidth(httpProgressWidth),
)
- progress.Full = '#'
- progress.FullColor = ""
- progress.Empty = ' '
- progress.EmptyColor = ""
- progress.ShowPercentage = false
+ httpProgress.Full = '#'
+ httpProgress.FullColor = ""
+ httpProgress.Empty = ' '
+ httpProgress.EmptyColor = ""
+ httpProgress.ShowPercentage = false
model := httpProgressModel{
url: resp.Request.URL.String(),
contentLength: int(resp.ContentLength),
- progress: progress,
+ progress: httpProgress,
}
return runReadHTTPResponse(model, resp)
default:
- spinner := spinner.New(
+ httpSpinner := spinner.New(
spinner.WithSpinner(spinner.Spinner{
Frames: makeNightriderFrames("+", ' ', httpProgressWidth),
FPS: time.Second / 60,
@@ -140,7 +140,7 @@ func (c *Config) readHTTPResponse(resp *http.Response) ([]byte, error) {
model := httpSpinnerModel{
url: resp.Request.URL.String(),
- spinner: spinner,
+ spinner: httpSpinner,
}
return runReadHTTPResponse(model, resp)
diff --git a/internal/cmd/upgradecmd_unix.go b/internal/cmd/upgradecmd_unix.go
index d199cb2fe79..913f03ffe49 100644
--- a/internal/cmd/upgradecmd_unix.go
+++ b/internal/cmd/upgradecmd_unix.go
@@ -68,15 +68,15 @@ func (c *Config) brewUpgrade() error {
return c.run(chezmoi.EmptyAbsPath, "brew", []string{"upgrade", "chezmoi"})
}
-func (c *Config) getPackageFilename(packageType string, version *semver.Version, os, arch string) (string, error) {
+func (c *Config) getPackageFilename(packageType string, version *semver.Version, goOS, arch string) (string, error) {
if archReplacement, ok := archReplacements[packageType][arch]; ok {
arch = archReplacement
}
switch packageType {
case packageTypeAPK:
- return fmt.Sprintf("chezmoi_%s_%s_%s.apk", version, os, arch), nil
+ return fmt.Sprintf("chezmoi_%s_%s_%s.apk", version, goOS, arch), nil
case packageTypeDEB:
- return fmt.Sprintf("chezmoi_%s_%s_%s.deb", version, os, arch), nil
+ return fmt.Sprintf("chezmoi_%s_%s_%s.deb", version, goOS, arch), nil
case packageTypeRPM:
return fmt.Sprintf("chezmoi-%s-%s.rpm", version, arch), nil
default:
@@ -114,12 +114,7 @@ func (c *Config) upgradeUNIXPackage(
}
// Find the release asset.
- packageFilename, err := c.getPackageFilename(
- packageType,
- version,
- runtime.GOOS,
- runtime.GOARCH,
- )
+ packageFilename, err := c.getPackageFilename(packageType, version, runtime.GOOS, runtime.GOARCH)
if err != nil {
return err
}
|
chore
|
Miscellaneous fixes suggested by gocritic
|
47a2940794e7fd0c1f4b07475d1cd4cca218d2e2
|
2022-05-08 04:55:54
|
ktetzlaff
|
docs: Add some additional details to contributing-changes.md
| false
|
diff --git a/assets/chezmoi.io/docs/developer/contributing-changes.md b/assets/chezmoi.io/docs/developer/contributing-changes.md
index 8174baee6b3..27bb7f14730 100644
--- a/assets/chezmoi.io/docs/developer/contributing-changes.md
+++ b/assets/chezmoi.io/docs/developer/contributing-changes.md
@@ -15,14 +15,15 @@ important.
All changes are made via pull requests. In your pull request, please make sure
that:
-* All existing tests pass.
+* All existing tests pass. You can ensure this by running `make test`.
* There are appropriate additional tests that demonstrate that your PR works as
intended.
-* The documentation is updated, if necessary. For new features you should add
- an entry in `assets/chezmoi.io/docs/user-guide/` and a complete description
- in `assets/chezmoi.io/docs/reference/`.
+* The documentation is updated, if necessary. For new features you should add an
+ entry in `assets/chezmoi.io/docs/user-guide/` and a complete description in
+ `assets/chezmoi.io/docs/reference/`. See [website](/developer/website/) for
+ instructions on how to build and view a local version of the documentation.
* All generated files are up to date. You can ensure this by running `make
generate` and including any modified files in your commit.
|
docs
|
Add some additional details to contributing-changes.md
|
8784a6713023568db5f524d8af16b24e1c462337
|
2023-11-18 03:24:50
|
Tom Payne
|
docs: Add links to blog posts
| false
|
diff --git a/assets/chezmoi.io/docs/links/articles.md.yaml b/assets/chezmoi.io/docs/links/articles.md.yaml
index 15318a8ac19..d7399b217f2 100644
--- a/assets/chezmoi.io/docs/links/articles.md.yaml
+++ b/assets/chezmoi.io/docs/links/articles.md.yaml
@@ -250,6 +250,10 @@ articles:
lang: CN
title: 使用chezmoi管理dotfiles
url: https://zhaohongxuan.github.io/2022/08/05/use-chezmoi-manage-dotfiles/
+- date: '2022-08-11'
+ version: 2.20.0
+ title: Chezmoi - a very cool tool to manage your dotfiles
+ url: https://wyssmann.com/blog/2022/08/chezmoi-a-very-cool-tool-to-manage-your-dotfiles/
- date: '2022-09-13'
version: 2.22.1
lang: IT
@@ -343,3 +347,8 @@ articles:
lang: JP
title: 複数OSに対応しているchezmoiを使ってdotfilesを効率的に管理する
url: https://www.asobou.co.jp/blog/web/chezmoi
+- date: '2023-10-29'
+ version: 2.40.4
+ lang: CN
+ title: 用 chezmoi 管理 dotfiles
+ url: https://thewang.net/blog/manage-dotfiles-with-chezmoi
|
docs
|
Add links to blog posts
|
bb4ce3c3bd7fc4051a45205be1a35c1acc99bbc3
|
2021-12-17 07:31:42
|
Tom Payne
|
chore: Bump gofumpt to version 0.2.1
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 8111ae279a6..46989e82ddb 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -11,6 +11,7 @@ on:
env:
AGE_VERSION: 1.0.0
GO_VERSION: 1.17.5
+ GOFUMPT_VERSION: 0.2.1
GOLANGCI_LINT_VERSION: 1.43.0
jobs:
changes:
diff --git a/Makefile b/Makefile
index 0ce959f0359..7e94d2571a9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
GO?=go
-GOLANGCI_LINT_VERSION=$(shell grep GOLANGCI_LINT_VERSION: .github/workflows/main.yml | awk '{ print $$2 }')
+GOFUMPT_VERSION=$(shell awk '/GOFUMPT_VERSION:/ { print $$2 }' .github/workflows/main.yml)
+GOLANGCI_LINT_VERSION=$(shell awk '/GOLANGCI_LINT_VERSION:/ { print $$2 }' .github/workflows/main.yml)
ifdef VERSION
GO_LDFLAGS+=-X main.version=${VERSION}
endif
@@ -103,16 +104,16 @@ lint: ensure-golangci-lint
.PHONY: format
format: ensure-gofumpt
- find . -name \*.go | xargs ./bin/gofumpt -w
+ find . -name \*.go | xargs ./bin/gofumpt -extra -w
.PHONY: ensure-tools
ensure-tools: ensure-gofumpt ensure-golangci-lint
.PHONY: ensure-gofumpt
ensure-gofumpt:
- if [ ! -x bin/gofumpt ] ; then \
+ if [ ! -x bin/gofumpt ] || ( ./bin/gofumpt --version | grep -Fqv "v${GOFUMPT_VERSION}" ) ; then \
mkdir -p bin ; \
- GOBIN=$(shell pwd)/bin ${GO} install mvdan.cc/[email protected] ; \
+ GOBIN=$(shell pwd)/bin ${GO} install "mvdan.cc/gofumpt@v${GOFUMPT_VERSION}" ; \
fi
.PHONY: ensure-golangci-lint
|
chore
|
Bump gofumpt to version 0.2.1
|
ad1e9450139e69fec57308dd0804a5281b2ebe35
|
2024-11-07 23:26:01
|
Tom Payne
|
chore: Factor out common choices
| false
|
diff --git a/internal/cmd/archivecmd.go b/internal/cmd/archivecmd.go
index 5372d5c289e..e8476e1ee56 100644
--- a/internal/cmd/archivecmd.go
+++ b/internal/cmd/archivecmd.go
@@ -14,6 +14,8 @@ import (
"github.com/twpayne/chezmoi/v2/internal/chezmoi"
)
+var archiveFormatValues = []string{"", "tar", "tar.gz", "tgz", "zip"}
+
type archiveCmdConfig struct {
filter *chezmoi.EntryTypeFilter
format *choiceFlag
diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go
index efbfeea218b..2a403ef9507 100644
--- a/internal/cmd/cmd.go
+++ b/internal/cmd/cmd.go
@@ -34,6 +34,11 @@ var (
helpFlagsRx = regexp.MustCompile("^### (?:`-([a-zA-Z])`, )?`--([a-zA-Z-]+)`")
helps = make(map[string]*help)
+
+ readFormatValues = []string{"", "json", "toml", "yaml"}
+ writeFormatValues = []string{"", "json", "yaml"}
+
+ targetPathStyleValues = []string{"absolute", "relative"}
)
// A VersionInfo contains a version.
diff --git a/internal/cmd/config.go b/internal/cmd/config.go
index ff8db38f258..c161867435d 100644
--- a/internal/cmd/config.go
+++ b/internal/cmd/config.go
@@ -341,7 +341,7 @@ func newConfig(options ...configOption) (*Config, error) {
ConfigFile: newConfigFile(bds),
// Global configuration.
- configFormat: newChoiceFlag("", []string{"", "json", "toml", "yaml"}),
+ configFormat: newChoiceFlag("", readFormatValues),
homeDir: userHomeDir,
templateFuncs: sprig.TxtFuncMap(),
@@ -352,19 +352,19 @@ func newConfig(options ...configOption) (*Config, error) {
},
archive: archiveCmdConfig{
filter: chezmoi.NewEntryTypeFilter(chezmoi.EntryTypesAll, chezmoi.EntryTypesNone),
- format: newChoiceFlag("tar.gz", []string{"", "tar", "tar.gz", "tgz", "zip"}),
+ format: newChoiceFlag("tar.gz", archiveFormatValues),
recursive: true,
},
data: dataCmdConfig{
- format: newChoiceFlag("", []string{"", "json", "yaml"}),
+ format: newChoiceFlag("", writeFormatValues),
},
dump: dumpCmdConfig{
filter: chezmoi.NewEntryTypeFilter(chezmoi.EntryTypesAll, chezmoi.EntryTypesNone),
- format: newChoiceFlag("", []string{"", "json", "yaml"}),
+ format: newChoiceFlag("", writeFormatValues),
recursive: true,
},
dumpConfig: dumpConfigCmdConfig{
- format: newChoiceFlag("", []string{"", "json", "yaml"}),
+ format: newChoiceFlag("", writeFormatValues),
},
executeTemplate: executeTemplateCmdConfig{
stdinIsATTY: true,
@@ -381,7 +381,7 @@ func newConfig(options ...configOption) (*Config, error) {
},
managed: managedCmdConfig{
filter: chezmoi.NewEntryTypeFilter(chezmoi.EntryTypesAll, chezmoi.EntryTypesNone),
- pathStyle: newChoiceFlag("relative", []string{"absolute", "relative", "source-absolute", "source-relative"}),
+ pathStyle: newChoiceFlag("relative", managedPathStyles),
},
mergeAll: mergeAllCmdConfig{
recursive: true,
@@ -392,17 +392,17 @@ func newConfig(options ...configOption) (*Config, error) {
},
state: stateCmdConfig{
data: stateDataCmdConfig{
- format: newChoiceFlag("json", []string{"", "json", "yaml"}),
+ format: newChoiceFlag("json", writeFormatValues),
},
dump: stateDumpCmdConfig{
- format: newChoiceFlag("json", []string{"", "json", "yaml"}),
+ format: newChoiceFlag("json", writeFormatValues),
},
getBucket: stateGetBucketCmdConfig{
- format: newChoiceFlag("json", []string{"", "json", "yaml"}),
+ format: newChoiceFlag("json", writeFormatValues),
},
},
unmanaged: unmanagedCmdConfig{
- pathStyle: newChoiceFlag("relative", []string{"absolute", "relative"}),
+ pathStyle: newChoiceFlag("relative", targetPathStyleValues),
},
// Configuration.
@@ -2937,7 +2937,7 @@ func newConfigFile(bds *xdg.BaseDirectorySpecification) ConfigFile {
},
Status: statusCmdConfig{
Exclude: chezmoi.NewEntryTypeSet(chezmoi.EntryTypesNone),
- PathStyle: newChoiceFlag("relative", []string{"absolute", "relative"}),
+ PathStyle: newChoiceFlag("relative", targetPathStyleValues),
include: chezmoi.NewEntryTypeSet(chezmoi.EntryTypesAll),
recursive: true,
},
diff --git a/internal/cmd/managedcmd.go b/internal/cmd/managedcmd.go
index 6f7d710acb1..b545be279cb 100644
--- a/internal/cmd/managedcmd.go
+++ b/internal/cmd/managedcmd.go
@@ -8,6 +8,8 @@ import (
"github.com/twpayne/chezmoi/v2/internal/chezmoi"
)
+var managedPathStyles = []string{"absolute", "relative", "source-absolute", "source-relative"}
+
type managedCmdConfig struct {
filter *chezmoi.EntryTypeFilter
pathStyle *choiceFlag
|
chore
|
Factor out common choices
|
132a7c97aaa290ff202531b0634c6143731a45d7
|
2024-08-06 06:25:48
|
Tom Payne
|
chore: Update dependencies
| false
|
diff --git a/go.mod b/go.mod
index 731828bb09a..df63573f5ec 100644
--- a/go.mod
+++ b/go.mod
@@ -6,7 +6,7 @@ toolchain go1.22.0
require (
filippo.io/age v1.2.0
- github.com/1password/onepassword-sdk-go v0.1.0-beta.11
+ github.com/1password/onepassword-sdk-go v0.1.0-beta.12
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.1.0
github.com/Masterminds/sprig/v3 v3.2.3
@@ -20,7 +20,7 @@ require (
github.com/bradenhilton/mozillainstallhash v1.0.1
github.com/charmbracelet/bubbles v0.18.0
github.com/charmbracelet/bubbletea v0.26.6
- github.com/charmbracelet/glamour v0.7.0
+ github.com/charmbracelet/glamour v0.8.0
github.com/coreos/go-semver v0.3.1
github.com/fsnotify/fsnotify v1.7.0
github.com/go-git/go-git/v5 v5.12.0
@@ -32,7 +32,7 @@ require (
github.com/mitchellh/copystructure v1.2.0
github.com/mitchellh/mapstructure v1.5.0
github.com/muesli/combinator v0.3.0
- github.com/muesli/termenv v0.15.2
+ github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a
github.com/pelletier/go-toml/v2 v2.2.2
github.com/rogpeppe/go-internal v1.12.0
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3
@@ -48,10 +48,10 @@ require (
github.com/zricethezav/gitleaks/v8 v8.18.4
go.etcd.io/bbolt v1.3.10
golang.org/x/crypto v0.25.0
- golang.org/x/crypto/x509roots/fallback v0.0.0-20240722173533-bb80217080b0
- golang.org/x/oauth2 v0.21.0
- golang.org/x/sync v0.7.0
- golang.org/x/sys v0.22.0
+ golang.org/x/crypto/x509roots/fallback v0.0.0-20240726163919-3375612bf41a
+ golang.org/x/oauth2 v0.22.0
+ golang.org/x/sync v0.8.0
+ golang.org/x/sys v0.23.0
golang.org/x/term v0.22.0
gopkg.in/ini.v1 v1.67.0
gopkg.in/yaml.v3 v3.0.1
@@ -98,7 +98,7 @@ require (
github.com/creack/pty/v2 v2.0.0-20231209135443-03db72c7b76c // indirect
github.com/cyphar/filepath-securejoin v0.3.1 // indirect
github.com/danieljoos/wincred v1.2.2 // indirect
- github.com/dlclark/regexp2 v1.11.2 // indirect
+ github.com/dlclark/regexp2 v1.11.4 // indirect
github.com/dustin/gojson v0.0.0-20160307161227-2e71ec9dd5ad // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
@@ -136,7 +136,6 @@ require (
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
- github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
diff --git a/go.sum b/go.sum
index f891de0a30f..3f50da38292 100644
--- a/go.sum
+++ b/go.sum
@@ -20,8 +20,8 @@ filippo.io/age v1.2.0 h1:vRDp7pUMaAJzXNIWJVAZnEf/Dyi4Vu4wI8S1LBzufhE=
filippo.io/age v1.2.0/go.mod h1:JL9ew2lTN+Pyft4RiNGguFfOpewKwSHm5ayKD/A4004=
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
-github.com/1password/onepassword-sdk-go v0.1.0-beta.11 h1:jPeG79h6JPNebFV4ZmZ7dGjsKPAmmQ9PWJgBA/MTj0o=
-github.com/1password/onepassword-sdk-go v0.1.0-beta.11/go.mod h1:Ljj6Qi8r++ygegjRXPttJEWpNFYNgtO0ICCPCYL+wCg=
+github.com/1password/onepassword-sdk-go v0.1.0-beta.12 h1:v9b2fow1cutaCWRsIU1sVxVSzzR90mfkDCwYJeaadWc=
+github.com/1password/onepassword-sdk-go v0.1.0-beta.12/go.mod h1:7wEQynLBXBC4svNx3X82QmCy0Adhm4e+UkM9t9mSSWA=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc=
@@ -112,14 +112,16 @@ github.com/charmbracelet/bubbles v0.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/
github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw=
github.com/charmbracelet/bubbletea v0.26.6 h1:zTCWSuST+3yZYZnVSvbXwKOPRSNZceVeqpzOLN2zq1s=
github.com/charmbracelet/bubbletea v0.26.6/go.mod h1:dz8CWPlfCCGLFbBlTY4N7bjLiyOGDJEnd2Muu7pOWhk=
-github.com/charmbracelet/glamour v0.7.0 h1:2BtKGZ4iVJCDfMF229EzbeR1QRKLWztO9dMtjmqZSng=
-github.com/charmbracelet/glamour v0.7.0/go.mod h1:jUMh5MeihljJPQbJ/wf4ldw2+yBP59+ctV36jASy7ps=
+github.com/charmbracelet/glamour v0.8.0 h1:tPrjL3aRcQbn++7t18wOpgLyl8wrOHUEDS7IZ68QtZs=
+github.com/charmbracelet/glamour v0.8.0/go.mod h1:ViRgmKkf3u5S7uakt2czJ272WSg2ZenlYEZXT2x7Bjw=
github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ=
github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=
github.com/charmbracelet/lipgloss v0.12.1 h1:/gmzszl+pedQpjCOH+wFkZr/N90Snz40J/NR7A0zQcs=
github.com/charmbracelet/lipgloss v0.12.1/go.mod h1:V2CiwIuhx9S1S1ZlADfOj9HmxeMAORuz5izHb0zGbB8=
github.com/charmbracelet/x/ansi v0.1.4 h1:IEU3D6+dWwPSgZ6HBH+v6oUuZ/nVawMiWj5831KfiLM=
github.com/charmbracelet/x/ansi v0.1.4/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
+github.com/charmbracelet/x/exp/golden v0.0.0-20240715153702-9ba8adf781c4 h1:6KzMkQeAF56rggw2NZu1L+TH7j9+DM1/2Kmh7KUxg1I=
+github.com/charmbracelet/x/exp/golden v0.0.0-20240715153702-9ba8adf781c4/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U=
github.com/charmbracelet/x/input v0.1.3 h1:oy4TMhyGQsYs/WWJwu1ELUMFnjiUAXwtDf048fHbCkg=
github.com/charmbracelet/x/input v0.1.3/go.mod h1:1gaCOyw1KI9e2j00j/BBZ4ErzRZqa05w0Ghn83yIhKU=
github.com/charmbracelet/x/term v0.1.1 h1:3cosVAiPOig+EV4X9U+3LDgtwwAoEzJjNdwbXDjF6yI=
@@ -149,8 +151,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/dlclark/regexp2 v1.11.2 h1:/u628IuisSTwri5/UKloiIsH8+qF2Pu7xEQX+yIKg68=
-github.com/dlclark/regexp2 v1.11.2/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
+github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
+github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
@@ -310,7 +312,6 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
-github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
@@ -342,16 +343,14 @@ github.com/muesli/combinator v0.3.0 h1:SZDuRzzwmVPLkbOzbhGzBTwd5+Y6aFN4UusOW2azr
github.com/muesli/combinator v0.3.0/go.mod h1:ttPegJX0DPQaGDtJKMInIP6Vfp5pN8RX7QntFCcpy18=
github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
-github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo=
-github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8=
+github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a h1:2MaM6YC3mGu54x+RKAA6JiFFHlHDY1UbkxqppT7wYOg=
+github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a/go.mod h1:hxSnBBYLK21Vtq/PHd0S2FYCxBXzBua8ov5s1RobyRQ=
github.com/nats-io/nats.go v1.34.0 h1:fnxnPCNiwIG5w08rlMcEKTUw4AV/nKyGCOJE8TdhSPk=
github.com/nats-io/nats.go v1.34.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8=
github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI=
github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
-github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
-github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ=
@@ -508,8 +507,8 @@ golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2Uz
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
-golang.org/x/crypto/x509roots/fallback v0.0.0-20240722173533-bb80217080b0 h1:gWoA9CSl/c0xptJ+VEEEhee9ksDuClLmbv8O2rXho2I=
-golang.org/x/crypto/x509roots/fallback v0.0.0-20240722173533-bb80217080b0/go.mod h1:kNa9WdvYnzFwC79zRpLRMJbdEFlhyM5RPFBBZp/wWH8=
+golang.org/x/crypto/x509roots/fallback v0.0.0-20240726163919-3375612bf41a h1:+mrX96OoIUobm534myLOZMfVxVLWu/TpbYrUu6sn4tQ=
+golang.org/x/crypto/x509roots/fallback v0.0.0-20240726163919-3375612bf41a/go.mod h1:kNa9WdvYnzFwC79zRpLRMJbdEFlhyM5RPFBBZp/wWH8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
@@ -525,13 +524,13 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
-golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
-golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
+golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA=
+golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
-golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
+golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -551,8 +550,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
-golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
-golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
+golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457 h1:zf5N6UOrA487eEFacMePxjXAJctxKmyjKUsjA11Uzuk=
golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go
index 7026c8385f8..169aca3c537 100644
--- a/internal/cmd/cmd.go
+++ b/internal/cmd/cmd.go
@@ -13,6 +13,7 @@ import (
"strings"
"github.com/charmbracelet/glamour"
+ "github.com/charmbracelet/glamour/styles"
"github.com/spf13/cobra"
"go.etcd.io/bbolt"
@@ -52,7 +53,7 @@ func init() {
panic(err)
}
- longHelpStyleConfig := glamour.ASCIIStyleConfig
+ longHelpStyleConfig := styles.ASCIIStyleConfig
longHelpStyleConfig.Code.StylePrimitive.BlockPrefix = ""
longHelpStyleConfig.Code.StylePrimitive.BlockSuffix = ""
longHelpStyleConfig.Emph.BlockPrefix = ""
@@ -66,7 +67,7 @@ func init() {
panic(err)
}
- exampleStyleConfig := glamour.ASCIIStyleConfig
+ exampleStyleConfig := styles.ASCIIStyleConfig
exampleStyleConfig.Code.StylePrimitive.BlockPrefix = ""
exampleStyleConfig.Code.StylePrimitive.BlockSuffix = ""
exampleStyleConfig.Document.Margin = nil
diff --git a/internal/cmd/licensecmd.go b/internal/cmd/licensecmd.go
index dcea7e3723e..f5bc1ec7a18 100644
--- a/internal/cmd/licensecmd.go
+++ b/internal/cmd/licensecmd.go
@@ -4,6 +4,7 @@ import (
"bytes"
"github.com/charmbracelet/glamour"
+ "github.com/charmbracelet/glamour/styles"
"github.com/spf13/cobra"
"github.com/twpayne/chezmoi/v2/assets/chezmoi.io/docs"
@@ -27,7 +28,7 @@ func (c *Config) newLicenseCmd() *cobra.Command {
func (c *Config) runLicenseCmd(cmd *cobra.Command, args []string) error {
renderer, err := glamour.NewTermRenderer(
- glamour.WithStyles(glamour.ASCIIStyleConfig),
+ glamour.WithStyles(styles.ASCIIStyleConfig),
glamour.WithWordWrap(80),
)
if err != nil {
|
chore
|
Update dependencies
|
82fe8f35129c925a71bfa24bd82c5db623b1021b
|
2022-09-17 00:14:59
|
Tom Payne
|
chore: Fix use of TTY in tests
| false
|
diff --git a/pkg/cmd/config_test.go b/pkg/cmd/config_test.go
index 539fa338e54..1df0af00fd4 100644
--- a/pkg/cmd/config_test.go
+++ b/pkg/cmd/config_test.go
@@ -190,6 +190,13 @@ func withDestSystem(destSystem chezmoi.System) configOption {
}
}
+func withNoTTY(noTTY bool) configOption {
+ return func(c *Config) error {
+ c.noTTY = noTTY
+ return nil
+ }
+}
+
func withSourceSystem(sourceSystem chezmoi.System) configOption {
return func(c *Config) error {
c.sourceSystem = sourceSystem
diff --git a/pkg/cmd/inittemplatefuncs_test.go b/pkg/cmd/inittemplatefuncs_test.go
index 7ad3e111a88..20825c13da7 100644
--- a/pkg/cmd/inittemplatefuncs_test.go
+++ b/pkg/cmd/inittemplatefuncs_test.go
@@ -64,6 +64,7 @@ func TestPromptBoolInitTemplateFunc(t *testing.T) {
stdin := strings.NewReader(tc.stdinStr)
stdout := &strings.Builder{}
config, err := newConfig(
+ withNoTTY(true),
withStdin(stdin),
withStdout(stdout),
)
@@ -136,6 +137,7 @@ func TestPromptIntInitTemplateFunc(t *testing.T) {
stdin := strings.NewReader(tc.stdinStr)
stdout := &strings.Builder{}
config, err := newConfig(
+ withNoTTY(true),
withStdin(stdin),
withStdout(stdout),
)
@@ -221,6 +223,7 @@ func TestPromptStringInitTemplateFunc(t *testing.T) {
stdin := strings.NewReader(tc.stdinStr)
stdout := &strings.Builder{}
config, err := newConfig(
+ withNoTTY(true),
withStdin(stdin),
withStdout(stdout),
)
diff --git a/pkg/cmd/testdata/scripts/inittemplatefuncs.txtar b/pkg/cmd/testdata/scripts/inittemplatefuncs.txtar
index 0713d1498e3..0699cb10aba 100644
--- a/pkg/cmd/testdata/scripts/inittemplatefuncs.txtar
+++ b/pkg/cmd/testdata/scripts/inittemplatefuncs.txtar
@@ -20,7 +20,7 @@ stdout string
# test prompt*Once functions without existing data
stdin golden/input
-exec chezmoi init
+exec chezmoi init --no-tty
cmp ${CHEZMOICONFIGDIR}/chezmoi.toml golden/chezmoi.toml
chhome home2/user
|
chore
|
Fix use of TTY in tests
|
19e6d0088c24c3ed55d9882804cd346a630e5374
|
2022-04-04 00:34:04
|
Tom Payne
|
docs: Factor out password manager functions into separate sections
| false
|
diff --git a/assets/chezmoi.io/docs/reference/templates/1password-functions/index.md b/assets/chezmoi.io/docs/reference/templates/1password-functions/index.md
new file mode 100644
index 00000000000..f288d3f4969
--- /dev/null
+++ b/assets/chezmoi.io/docs/reference/templates/1password-functions/index.md
@@ -0,0 +1,17 @@
+# 1Password functions
+
+The `onepassword*` template functions return structured data from
+[1Password](https://1password.com/) using the [1Password
+CLI](https://support.1password.com/command-line-getting-started/) (`op`).
+
+!!! warning
+
+ When using 1Password CLI 2.0, there may be an issue with pre-authenticating
+ `op` because the environment variable used to store the session key has
+ changed from `OP_SESSION_account` to `OP_SESSION_accountUUID`. Instead of
+ using *account-name*, it is recommended that you use the *account-uuid*.
+ This can be found using `op account list`.
+
+ This issue does not occur when using biometric authentication and 1Password
+ 8, or if you allow chezmoi to prompt you for 1Password authentication
+ (`1password.prompt = true`).
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/onepassword.md b/assets/chezmoi.io/docs/reference/templates/1password-functions/onepassword.md
similarity index 81%
rename from assets/chezmoi.io/docs/reference/templates/functions/onepassword.md
rename to assets/chezmoi.io/docs/reference/templates/1password-functions/onepassword.md
index 6c5dd851d7d..7cdf2ae7475 100644
--- a/assets/chezmoi.io/docs/reference/templates/functions/onepassword.md
+++ b/assets/chezmoi.io/docs/reference/templates/1password-functions/onepassword.md
@@ -45,7 +45,7 @@ interactively prompted to sign in.
{{ (onepassword "$UUID" "" "$ACCOUNT_NAME").details.password }}
```
-!!! danger
+!!! warning
When using [1Password CLI 2.0](https://developer.1password.com/), note that
the structure of the data returned by the `onepassword` template function
@@ -60,14 +60,3 @@ interactively prompted to sign in.
$ chezmoi execute-template "{{ onepassword \"$UUID\" | toJson }}" | jq .
```
-!!! warning
-
- When using 1Password CLI 2.0, there may be an issue with pre-authenticating
- `op` because the environment variable used to store the session key has
- changed from `OP_SESSION_account` to `OP_SESSION_accountUUID`. Instead of
- using *account-name*, it is recommended that you use the *account-uuid*.
- This can be found using `op account list`.
-
- This issue does not occur when using biometric authentication and 1Password
- 8, or if you allow chezmoi to prompt you for 1Password authentication
- (`1password.prompt = true`).
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/onepasswordDetailsFields.md b/assets/chezmoi.io/docs/reference/templates/1password-functions/onepasswordDetailsFields.md
similarity index 84%
rename from assets/chezmoi.io/docs/reference/templates/functions/onepasswordDetailsFields.md
rename to assets/chezmoi.io/docs/reference/templates/1password-functions/onepasswordDetailsFields.md
index 5103c684e7c..da88718a4a1 100644
--- a/assets/chezmoi.io/docs/reference/templates/functions/onepasswordDetailsFields.md
+++ b/assets/chezmoi.io/docs/reference/templates/1password-functions/onepasswordDetailsFields.md
@@ -75,7 +75,7 @@ work accounts).
}
```
-!!! danger
+!!! warning
When using [1Password CLI 2.0](https://developer.1password.com/), note that
the structure of the data returned by the `onepasswordDetailsFields`
@@ -88,15 +88,3 @@ work accounts).
```console
$ chezmoi execute-template "{{ onepasswordDetailsFields \"$UUID\" | toJson }}" | jq .
```
-
-!!! warning
-
- When using 1Password CLI 2.0, there may be an issue with pre-authenticating
- `op` because the environment variable used to store the session key has
- changed from `OP_SESSION_account` to `OP_SESSION_accountUUID`. Instead of
- using *account-name*, it is recommended that you use the *account-uuid*.
- This can be found using `op account list`.
-
- This issue does not occur when using biometric authentication and 1Password
- 8, or if you allow chezmoi to prompt you for 1Password authentication
- (`1password.prompt = true`).
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/onepasswordDocument.md b/assets/chezmoi.io/docs/reference/templates/1password-functions/onepasswordDocument.md
similarity index 65%
rename from assets/chezmoi.io/docs/reference/templates/functions/onepasswordDocument.md
rename to assets/chezmoi.io/docs/reference/templates/1password-functions/onepasswordDocument.md
index 5e402a98764..03f42f4b025 100644
--- a/assets/chezmoi.io/docs/reference/templates/functions/onepasswordDocument.md
+++ b/assets/chezmoi.io/docs/reference/templates/1password-functions/onepasswordDocument.md
@@ -21,16 +21,3 @@ will be interactively prompted to sign in.
{{- onepasswordDocument "$UUID" "$VAULT_UUID" "$ACCOUNT_NAME" -}}
{{- onepasswordDocument "$UUID" "" "$ACCOUNT_NAME" -}}
```
-
-!!! warning
-
- When you're using [1Password CLI 2.0](https://developer.1password.com/),
- there may be an issue with pre-authenticated usage of `op`. The environment
- variable used to store the session key has changed from `OP_SESSION_account`
- to `OP_SESSION_accountUUID`. Instead of using *account-name*, it is
- recommended that you use the *account-uuid*. This can be found using `op
- account list`.
-
- This issue does not occur when using biometric authentication and 1Password
- 8, or if you allow chezmoi to prompt you for 1Password authentication
- (`1password.prompt = true`).
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/onepasswordItemFields.md b/assets/chezmoi.io/docs/reference/templates/1password-functions/onepasswordItemFields.md
similarity index 59%
rename from assets/chezmoi.io/docs/reference/templates/functions/onepasswordItemFields.md
rename to assets/chezmoi.io/docs/reference/templates/1password-functions/onepasswordItemFields.md
index 916f2f166af..4a72ae96583 100644
--- a/assets/chezmoi.io/docs/reference/templates/functions/onepasswordItemFields.md
+++ b/assets/chezmoi.io/docs/reference/templates/1password-functions/onepasswordItemFields.md
@@ -45,30 +45,30 @@ interactively prompted to sign in.
```json
{
- "id": "$UUID",
- "title": "$TITLE",
- "version": 1,
- "vault": {
- "id": "$vaultUUID"
- },
- "category": "LOGIN",
- "last_edited_by": "userUUID",
- "created_at": "2022-01-12T16:29:26Z",
- "updated_at": "2022-01-12T16:29:26Z",
- "sections": [
- {
- "id": "$sectionID",
- "label": "Related Items"
- }
- ],
- "fields": [
- {
- "id": "nerlnqbfzdm5q5g6ydsgdqgdw4",
- "type": "STRING",
- "label": "exampleLabel",
- "value": "exampleValue"
- }
- ],
+ "id": "$UUID",
+ "title": "$TITLE",
+ "version": 1,
+ "vault": {
+ "id": "$vaultUUID"
+ },
+ "category": "LOGIN",
+ "last_edited_by": "userUUID",
+ "created_at": "2022-01-12T16:29:26Z",
+ "updated_at": "2022-01-12T16:29:26Z",
+ "sections": [
+ {
+ "id": "$sectionID",
+ "label": "Related Items"
+ }
+ ],
+ "fields": [
+ {
+ "id": "nerlnqbfzdm5q5g6ydsgdqgdw4",
+ "type": "STRING",
+ "label": "exampleLabel",
+ "value": "exampleValue"
+ }
+ ],
}
```
@@ -91,27 +91,27 @@ interactively prompted to sign in.
```json
{
- "uuid": "$UUID",
- "details": {
- "sections": [
- {
- "name": "linked items",
- "title": "Related Items"
- },
- {
- "fields": [
- {
- "k": "string",
- "n": "D4328E0846D2461E8E455D7A07B93397",
- "t": "exampleLabel",
- "v": "exampleValue"
- }
- ],
- "name": "Section_20E0BD380789477D8904F830BFE8A121",
- "title": ""
- }
- ]
- },
+ "uuid": "$UUID",
+ "details": {
+ "sections": [
+ {
+ "name": "linked items",
+ "title": "Related Items"
+ },
+ {
+ "fields": [
+ {
+ "k": "string",
+ "n": "D4328E0846D2461E8E455D7A07B93397",
+ "t": "exampleLabel",
+ "v": "exampleValue"
+ }
+ ],
+ "name": "Section_20E0BD380789477D8904F830BFE8A121",
+ "title": ""
+ }
+ ]
+ },
}
```
@@ -128,7 +128,7 @@ interactively prompted to sign in.
}
```
-!!! info
+!!! warning
When using [1Password CLI 2.0](https://developer.1password.com/), note that
the structure of the data returned by the `onepasswordItemFields` template
@@ -141,15 +141,3 @@ interactively prompted to sign in.
```console
$ chezmoi execute-template "{{ onepasswordItemFields \"$UUID\" | toJson }}" | jq .
```
-
-!!! warning
-
- When using 1Password CLI 2.0, there may be an issue with pre-authenticating
- `op` because the environment variable used to store the session key has
- changed from `OP_SESSION_account` to `OP_SESSION_accountUUID`. Instead of
- using *account-name*, it is recommended that you use the *account-uuid*.
- This can be found using `op account list`.
-
- This issue does not occur when using biometric authentication and 1Password
- 8, or if you allow chezmoi to prompt you for 1Password authentication
- (`1password.prompt = true`).
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/bitwarden.md b/assets/chezmoi.io/docs/reference/templates/bitwarden-functions/bitwarden.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/bitwarden.md
rename to assets/chezmoi.io/docs/reference/templates/bitwarden-functions/bitwarden.md
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/bitwardenAttachment.md b/assets/chezmoi.io/docs/reference/templates/bitwarden-functions/bitwardenAttachment.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/bitwardenAttachment.md
rename to assets/chezmoi.io/docs/reference/templates/bitwarden-functions/bitwardenAttachment.md
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/bitwardenFields.md b/assets/chezmoi.io/docs/reference/templates/bitwarden-functions/bitwardenFields.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/bitwardenFields.md
rename to assets/chezmoi.io/docs/reference/templates/bitwarden-functions/bitwardenFields.md
diff --git a/assets/chezmoi.io/docs/reference/templates/bitwarden-functions/index.md b/assets/chezmoi.io/docs/reference/templates/bitwarden-functions/index.md
new file mode 100644
index 00000000000..57ad88dd4bb
--- /dev/null
+++ b/assets/chezmoi.io/docs/reference/templates/bitwarden-functions/index.md
@@ -0,0 +1,4 @@
+# Bitwarden functions
+
+The `bitwarden*` functions return data from [Bitwarden](https://bitwarden.com)
+using the [Bitwarden CLI](https://bitwarden.com/help/article/cli/) (`bw`).
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/gopass.md b/assets/chezmoi.io/docs/reference/templates/gopass-functions/gopass.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/gopass.md
rename to assets/chezmoi.io/docs/reference/templates/gopass-functions/gopass.md
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/gopassRaw.md b/assets/chezmoi.io/docs/reference/templates/gopass-functions/gopassRaw.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/gopassRaw.md
rename to assets/chezmoi.io/docs/reference/templates/gopass-functions/gopassRaw.md
diff --git a/assets/chezmoi.io/docs/reference/templates/gopass-functions/index.md b/assets/chezmoi.io/docs/reference/templates/gopass-functions/index.md
new file mode 100644
index 00000000000..3bf811d62fb
--- /dev/null
+++ b/assets/chezmoi.io/docs/reference/templates/gopass-functions/index.md
@@ -0,0 +1,4 @@
+# gopass functions
+
+The `gopass*` template functions return data stored in
+[gopass](https://www.gopass.pw/) using the gopass CLI (`gopass`).
diff --git a/assets/chezmoi.io/docs/reference/templates/keepassxc-functions/index.md b/assets/chezmoi.io/docs/reference/templates/keepassxc-functions/index.md
new file mode 100644
index 00000000000..5639d583e4b
--- /dev/null
+++ b/assets/chezmoi.io/docs/reference/templates/keepassxc-functions/index.md
@@ -0,0 +1,5 @@
+# KeePassXC functions
+
+The `keepassxc*` template functions return structured data retrieved from a
+[KeePassXC](https://keepassxc.org/) database using the KeePassXC CLI
+(`keepassxc-cli`)
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/keepassxc.md b/assets/chezmoi.io/docs/reference/templates/keepassxc-functions/keepassxc.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/keepassxc.md
rename to assets/chezmoi.io/docs/reference/templates/keepassxc-functions/keepassxc.md
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/keepassxcAttachment.md b/assets/chezmoi.io/docs/reference/templates/keepassxc-functions/keepassxcAttachment.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/keepassxcAttachment.md
rename to assets/chezmoi.io/docs/reference/templates/keepassxc-functions/keepassxcAttachment.md
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/keepassxcAttribute.md b/assets/chezmoi.io/docs/reference/templates/keepassxc-functions/keepassxcAttribute.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/keepassxcAttribute.md
rename to assets/chezmoi.io/docs/reference/templates/keepassxc-functions/keepassxcAttribute.md
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/keyring.md b/assets/chezmoi.io/docs/reference/templates/keyring-functions/keyring.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/keyring.md
rename to assets/chezmoi.io/docs/reference/templates/keyring-functions/keyring.md
diff --git a/assets/chezmoi.io/docs/reference/templates/lastpass-functions/index.md b/assets/chezmoi.io/docs/reference/templates/lastpass-functions/index.md
new file mode 100644
index 00000000000..d393e0c8ec8
--- /dev/null
+++ b/assets/chezmoi.io/docs/reference/templates/lastpass-functions/index.md
@@ -0,0 +1,5 @@
+# LastPass functions
+
+The `lastpass*` template functions return structured data from
+[LastPass](https://lastpass.com/) using the [LastPass
+CLI](https://lastpass.github.io/lastpass-cli/lpass.1.html) (`lpass`).
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/lastpass.md b/assets/chezmoi.io/docs/reference/templates/lastpass-functions/lastpass.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/lastpass.md
rename to assets/chezmoi.io/docs/reference/templates/lastpass-functions/lastpass.md
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/lastpassRaw.md b/assets/chezmoi.io/docs/reference/templates/lastpass-functions/lastpassRaw.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/lastpassRaw.md
rename to assets/chezmoi.io/docs/reference/templates/lastpass-functions/lastpassRaw.md
diff --git a/assets/chezmoi.io/docs/reference/templates/pass-functions/index.md b/assets/chezmoi.io/docs/reference/templates/pass-functions/index.md
new file mode 100644
index 00000000000..02028c874b8
--- /dev/null
+++ b/assets/chezmoi.io/docs/reference/templates/pass-functions/index.md
@@ -0,0 +1,4 @@
+# pass functions
+
+The `pass` template functions return passwords stored in
+[pass](https://www.passwordstore.org/) using the pass CLI (`pass`).
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/pass.md b/assets/chezmoi.io/docs/reference/templates/pass-functions/pass.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/pass.md
rename to assets/chezmoi.io/docs/reference/templates/pass-functions/pass.md
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/passFields.md b/assets/chezmoi.io/docs/reference/templates/pass-functions/passFields.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/passFields.md
rename to assets/chezmoi.io/docs/reference/templates/pass-functions/passFields.md
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/passRaw.md b/assets/chezmoi.io/docs/reference/templates/pass-functions/passRaw.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/passRaw.md
rename to assets/chezmoi.io/docs/reference/templates/pass-functions/passRaw.md
diff --git a/assets/chezmoi.io/docs/reference/templates/secret-functions/index.md b/assets/chezmoi.io/docs/reference/templates/secret-functions/index.md
new file mode 100644
index 00000000000..4b3b56059bc
--- /dev/null
+++ b/assets/chezmoi.io/docs/reference/templates/secret-functions/index.md
@@ -0,0 +1,4 @@
+# Generic secret functions
+
+The `secret*` template functions return the output of the generic secret command
+defined by the `secret.command` configuration variable.
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/secret.md b/assets/chezmoi.io/docs/reference/templates/secret-functions/secret.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/secret.md
rename to assets/chezmoi.io/docs/reference/templates/secret-functions/secret.md
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/secretJSON.md b/assets/chezmoi.io/docs/reference/templates/secret-functions/secretJSON.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/secretJSON.md
rename to assets/chezmoi.io/docs/reference/templates/secret-functions/secretJSON.md
diff --git a/assets/chezmoi.io/docs/reference/templates/functions/vault.md b/assets/chezmoi.io/docs/reference/templates/vault-functions/vault.md
similarity index 100%
rename from assets/chezmoi.io/docs/reference/templates/functions/vault.md
rename to assets/chezmoi.io/docs/reference/templates/vault-functions/vault.md
diff --git a/assets/chezmoi.io/mkdocs.yml b/assets/chezmoi.io/mkdocs.yml
index bb5094f1ce6..7f60163b49e 100644
--- a/assets/chezmoi.io/mkdocs.yml
+++ b/assets/chezmoi.io/mkdocs.yml
@@ -148,41 +148,20 @@ nav:
- Variables: reference/templates/variables.md
- Functions:
- reference/templates/functions/index.md
- - bitwarden: reference/templates/functions/bitwarden.md
- - bitwardenAttachment: reference/templates/functions/bitwardenAttachment.md
- - bitwardenFields: reference/templates/functions/bitwardenFields.md
- decrypt: reference/templates/functions/decrypt.md
- encrypt: reference/templates/functions/encrypt.md
- fromYaml: reference/templates/functions/fromYaml.md
- gitHubKeys: reference/templates/functions/gitHubKeys.md
- gitHubLatestRelease: reference/templates/functions/gitHubLatestRelease.md
- - gopass: reference/templates/functions/gopass.md
- - gopassRaw: reference/templates/functions/gopassRaw.md
- include: reference/templates/functions/include.md
- ioreg: reference/templates/functions/ioreg.md
- joinPath: reference/templates/functions/joinPath.md
- - keepassxc: reference/templates/functions/keepassxc.md
- - keepassxcAttachment: reference/templates/functions/keepassxcAttachment.md
- - keepassxcAttribute: reference/templates/functions/keepassxcAttribute.md
- - keyring: reference/templates/functions/keyring.md
- - lastpass: reference/templates/functions/lastpass.md
- - lastpassRaw: reference/templates/functions/lastpassRaw.md
- lookPath: reference/templates/functions/lookPath.md
- mozillaInstallHash: reference/templates/functions/mozillaInstallHash.md
- - onepassword: reference/templates/functions/onepassword.md
- - onepasswordDocument: reference/templates/functions/onepasswordDocument.md
- - onepasswordDetailsFields: reference/templates/functions/onepasswordDetailsFields.md
- - onepasswordItemFields: reference/templates/functions/onepasswordItemFields.md
- output: reference/templates/functions/output.md
- - pass: reference/templates/functions/pass.md
- - passFields: reference/templates/functions/passFields.md
- - passRaw: reference/templates/functions/passRaw.md
- - secret: reference/templates/functions/secret.md
- - secretJSON: reference/templates/functions/secretJSON.md
- stat: reference/templates/functions/stat.md
- toYaml: reference/templates/functions/toYaml.md
- - vault: reference/templates/functions/vault.md
- - Init Functions:
+ - Init functions:
- reference/templates/init-functions/index.md
- exit: reference/templates/init-functions/exit.md
- promptBool: reference/templates/init-functions/promptBool.md
@@ -190,6 +169,43 @@ nav:
- promptString: reference/templates/init-functions/promptString.md
- stdinIsATTY: reference/templates/init-functions/stdinIsATTY.md
- writeToStdout: reference/templates/init-functions/writeToStdout.md
+ - 1Password functions:
+ - reference/templates/1password-functions/index.md
+ - onepassword: reference/templates/1password-functions/onepassword.md
+ - onepasswordDocument: reference/templates/1password-functions/onepasswordDocument.md
+ - onepasswordDetailsFields: reference/templates/1password-functions/onepasswordDetailsFields.md
+ - onepasswordItemFields: reference/templates/1password-functions/onepasswordItemFields.md
+ - Bitwarden functions:
+ - reference/templates/bitwarden-functions/index.md
+ - bitwarden: reference/templates/bitwarden-functions/bitwarden.md
+ - bitwardenAttachment: reference/templates/bitwarden-functions/bitwardenAttachment.md
+ - bitwardenFields: reference/templates/bitwarden-functions/bitwardenFields.md
+ - gopass functions:
+ - reference/templates/gopass-functions/index.md
+ - gopass: reference/templates/gopass-functions/gopass.md
+ - gopassRaw: reference/templates/gopass-functions/gopassRaw.md
+ - KeePassXC functions:
+ - reference/templates/keepassxc-functions/index.md
+ - keepassxc: reference/templates/keepassxc-functions/keepassxc.md
+ - keepassxcAttachment: reference/templates/keepassxc-functions/keepassxcAttachment.md
+ - keepassxcAttribute: reference/templates/keepassxc-functions/keepassxcAttribute.md
+ - Keyring functions:
+ - keyring: reference/templates/keyring-functions/keyring.md
+ - LastPass functions:
+ - reference/templates/lastpass-functions/index.md
+ - lastpass: reference/templates/lastpass-functions/lastpass.md
+ - lastpassRaw: reference/templates/lastpass-functions/lastpassRaw.md
+ - pass functions:
+ - reference/templates/pass-functions/index.md
+ - pass: reference/templates/pass-functions/pass.md
+ - passFields: reference/templates/pass-functions/passFields.md
+ - passRaw: reference/templates/pass-functions/passRaw.md
+ - Vault functions:
+ - vault: reference/templates/vault-functions/vault.md
+ - Generic secret functions:
+ - reference/templates/secret-functions/index.md
+ - secret: reference/templates/secret-functions/secret.md
+ - secretJSON: reference/templates/secret-functions/secretJSON.md
- Developer:
- Developing locally: developer/developing-locally.md
- Contributing changes: developer/contributing-changes.md
|
docs
|
Factor out password manager functions into separate sections
|
5bea2f925fc2b6fcf2ee116a20bae68869746787
|
2023-05-15 23:06:14
|
Tom Payne
|
chore: Update dependencies
| false
|
diff --git a/go.mod b/go.mod
index 8f5591e6d76..3184510fba2 100644
--- a/go.mod
+++ b/go.mod
@@ -42,7 +42,7 @@ require (
go.etcd.io/bbolt v1.3.7
go.uber.org/multierr v1.11.0
golang.org/x/crypto v0.9.0
- golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
+ golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea
golang.org/x/oauth2 v0.8.0
golang.org/x/sync v0.2.0
golang.org/x/sys v0.8.0
@@ -80,8 +80,8 @@ require (
github.com/charmbracelet/lipgloss v0.7.1 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/containerd/console v1.0.3 // indirect
- github.com/danieljoos/wincred v1.1.2 // indirect
- github.com/dlclark/regexp2 v1.9.0 // indirect
+ github.com/danieljoos/wincred v1.2.0 // indirect
+ github.com/dlclark/regexp2 v1.10.0 // indirect
github.com/dustin/gojson v0.0.0-20160307161227-2e71ec9dd5ad // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
@@ -116,8 +116,8 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
- github.com/skeema/knownhosts v1.1.0 // indirect
- github.com/spf13/cast v1.5.0 // indirect
+ github.com/skeema/knownhosts v1.1.1 // indirect
+ github.com/spf13/cast v1.5.1 // indirect
github.com/stretchr/testify v1.8.2 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/yuin/goldmark v1.5.4 // indirect
@@ -125,13 +125,14 @@ require (
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/text v0.9.0 // indirect
- golang.org/x/tools v0.8.0 // indirect
+ golang.org/x/tools v0.9.1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
)
exclude (
+ github.com/charmbracelet/bubbletea v0.24.0 // https://github.com/charmbracelet/bubbletea/issues/737
github.com/sergi/go-diff v1.2.0 // https://github.com/sergi/go-diff/issues/123
github.com/sergi/go-diff v1.3.0
github.com/sergi/go-diff v1.3.1 // https://github.com/twpayne/chezmoi/issues/2706
diff --git a/go.sum b/go.sum
index 269e0959a28..0f9808980f9 100644
--- a/go.sum
+++ b/go.sum
@@ -1,5 +1,7 @@
+cloud.google.com/go/compute/metadata v0.2.0 h1:nBbNSZyDpkNlo3DepaaLKVuO7ClyifSAmNloSCZrHnQ=
filippo.io/age v1.1.1 h1:pIpO7l151hCnQ4BdyBujnGP2YlUo0uj6sAVNHGBvXHg=
filippo.io/age v1.1.1/go.mod h1:l03SrzDUrBkdBx8+IILdnn2KZysqQdbEBUQ4p3sqEQE=
+filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
@@ -58,6 +60,7 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.19.0/go.mod h1:BgQOMsg8av8jset59jely
github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8=
github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/aymanbagabas/go-osc52 v1.0.3/go.mod h1:zT8H+Rk4VSabYN90pWyugflM3ZhpTZNC7cASDfUCdT4=
+github.com/aymanbagabas/go-osc52 v1.2.1 h1:q2sWUyDcozPLcLabEMd+a+7Ea2DitxZVN9hTxab9L4E=
github.com/aymanbagabas/go-osc52 v1.2.1/go.mod h1:zT8H+Rk4VSabYN90pWyugflM3ZhpTZNC7cASDfUCdT4=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
@@ -70,6 +73,7 @@ github.com/bradenhilton/cityhash v1.0.0/go.mod h1:Wmb8yW1egA9ulrsRX4mxfYx5zq4nBW
github.com/bradenhilton/mozillainstallhash v1.0.1 h1:JVAVsItiWlLoudJX4L+tIuml+hoxjlzCwkhlENi9yS4=
github.com/bradenhilton/mozillainstallhash v1.0.1/go.mod h1:J6cA36kUZrgaTkDl2bHRqI+4i2UKO1ImDB1P1x1PyOA=
github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
+github.com/bwesterb/go-ristretto v1.2.3 h1:1w53tCkGhCQ5djbat3+MH0BAQ5Kfgbt56UZQ/JMzngw=
github.com/charmbracelet/bubbles v0.15.0 h1:c5vZ3woHV5W2b8YZI1q7v4ZNQaPetfHuoHzx+56Z6TI=
github.com/charmbracelet/bubbles v0.15.0/go.mod h1:Y7gSFbBzlMpUDR/XM9MhZI374Q+1p1kluf1uLl8iK74=
github.com/charmbracelet/bubbletea v0.23.1/go.mod h1:JAfGK/3/pPKHTnAS8JIE2u9f61BjWTQY57RbT25aMXU=
@@ -89,17 +93,20 @@ github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARu
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
+github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
+github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
-github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0=
-github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0=
+github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
+github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE=
+github.com/danieljoos/wincred v1.2.0/go.mod h1:FzQLLMKBFdvu+osBrnFODiv32YGwCfx0SkRa/eYHgec=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
-github.com/dlclark/regexp2 v1.9.0 h1:pTK/l/3qYIKaRXuHnEnIf7Y5NxfRPfpb7dis6/gdlVI=
-github.com/dlclark/regexp2 v1.9.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
+github.com/dlclark/regexp2 v1.10.0 h1:+/GIL799phkJqYW+3YbOd8LCcbHzT0Pbo8zl70MHsq0=
+github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/dustin/gojson v0.0.0-20160307161227-2e71ec9dd5ad h1:Qk76DOWdOp+GlyDKBAG3Klr9cn7N+LcYc82AZ2S7+cA=
github.com/dustin/gojson v0.0.0-20160307161227-2e71ec9dd5ad/go.mod h1:mPKfmRa823oBIgl2r20LeMSpTAteW5j7FLkc0vjmzyQ=
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
@@ -165,8 +172,11 @@ github.com/itchyny/timefmt-go v0.1.5/go.mod h1:nEP7L+2YmAbT2kZ2HfSs1d8Xtw9LY8D2s
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
+github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
+github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
+github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
@@ -176,10 +186,12 @@ github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQs
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
+github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
@@ -212,6 +224,7 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
+github.com/mmcloughlin/avo v0.5.0 h1:nAco9/aI9Lg2kiuROBY6BhCI/z0t5jEvJfjWbL8qXLU=
github.com/mmcloughlin/avo v0.5.0/go.mod h1:ChHFdoV7ql95Wi7vuq2YT1bwCJqiWdZrQ1im3VujLYM=
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b/go.mod h1:fQuZ0gauxyBcmsdE3ZT4NasjaRdxmbCS0jRHsrWu3Ho=
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
@@ -228,6 +241,7 @@ github.com/muesli/termenv v0.13.0/go.mod h1:sP1+uffeLaEYpyOTb8pLCUctGcGLnoFjSn4Y
github.com/muesli/termenv v0.14.0/go.mod h1:kG/pF1E7fh949Xhe156crRUrHNyK221IuGO7Ez60Uc8=
github.com/muesli/termenv v0.15.1 h1:UzuTb/+hhlBugQz28rpzey4ZuKcZ03MeKsoG7IJZIxs=
github.com/muesli/termenv v0.15.1/go.mod h1:HeAQPTzpfs016yGtA4g00CsdYnVLJvxsS4ANqrZs2sQ=
+github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
@@ -237,6 +251,7 @@ github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+v
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI=
+github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -247,24 +262,30 @@ github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
+github.com/rs/xid v1.4.0 h1:qd7wPTDkN6KQx2VmMBLrpHkiyQwgFXRnkOLacUiaSNY=
github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc=
github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU=
+github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/sahilm/fuzzy v0.1.0 h1:FzWGaw2Opqyu+794ZQ9SYifWv2EIXpwP4q8dY1kDAwI=
github.com/sahilm/fuzzy v0.1.0/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
+github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
-github.com/skeema/knownhosts v1.1.0 h1:Wvr9V0MxhjRbl3f9nMnKnFfiWTJmtECJ9Njkea3ysW0=
+github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/skeema/knownhosts v1.1.0/go.mod h1:sKFq3RD6/TKZkSWn8boUbDC7Qkgcv+8XXijpFO6roag=
+github.com/skeema/knownhosts v1.1.1 h1:MTk78x9FPgDFVFkDLTrsnnfCJl7g1C/nnKvePgrIngE=
+github.com/skeema/knownhosts v1.1.1/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo=
github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
-github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
-github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
+github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA=
+github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48=
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
@@ -292,6 +313,7 @@ github.com/twpayne/go-xdg/v6 v6.1.1 h1:OzoxnDWEaqO1b32F8zZaDj3aJWgWyTsL8zOiun7UK
github.com/twpayne/go-xdg/v6 v6.1.1/go.mod h1:+0KSJ4Dx+xaZeDXWZITF84BcNc1UiHDm0DP8txprfD8=
github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
+github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA=
github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1 h1:+dBg5k7nuTE38VVdoroRsT0Z88fmvdYrI2EjzJst35I=
github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1/go.mod h1:nmuySobZb4kFgFy6BptpXp/BBw+xFSyvVPP6auoJB4k=
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
@@ -307,8 +329,11 @@ github.com/zalando/go-keyring v0.2.2 h1:f0xmpYiSrHtSNAVgwip93Cg8tuF45HJM6rHq/A5R
github.com/zalando/go-keyring v0.2.2/go.mod h1:sI3evg9Wvpw3+n4SqplGSJUMwtDeROfD4nsFz4z9PG0=
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
+go.etcd.io/gofail v0.1.0 h1:XItAMIhOojXFQMgrxjnd2EIIHun/d5qL0Pf7FzVTkFg=
+go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
+golang.org/x/arch v0.1.0 h1:oMxhUYsO9VsR1dcoVUjJjIGhx1LXol3989T/yZ59Xsw=
golang.org/x/arch v0.1.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
@@ -321,8 +346,8 @@ golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
-golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o=
-golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
+golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea h1:vLCWI/yYrdEHyN2JzIzPO3aaQJHQdp89IZBA/+azVC4=
+golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
@@ -358,7 +383,6 @@ golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -400,9 +424,10 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
-golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y=
-golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4=
+golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo=
+golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
@@ -419,10 +444,12 @@ gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
+gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 h1:POO/ycCATvegFmVuPpQzZFJ+pGZeX22Ufu6fibxDVjU=
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
@@ -431,6 +458,8 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM=
howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
+mvdan.cc/editorconfig v0.2.0 h1:XL+7ys6ls/RKrkUNFQvEwIvNHh+JKx8Mj1pUV5wQxQE=
mvdan.cc/sh/v3 v3.6.0 h1:gtva4EXJ0dFNvl5bHjcUEvws+KRcDslT8VKheTYkbGU=
mvdan.cc/sh/v3 v3.6.0/go.mod h1:U4mhtBLZ32iWhif5/lD+ygy1zrgaQhUu+XFy7C8+TTA=
+rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
chore
|
Update dependencies
|
da2d47dbe6939be2760de8b9cdea1660ee2b6f83
|
2024-10-23 04:31:13
|
Tom Payne
|
chore: Update dependencies
| false
|
diff --git a/go.mod b/go.mod
index 0808f5ea544..a46449d0909 100644
--- a/go.mod
+++ b/go.mod
@@ -6,7 +6,7 @@ require (
filippo.io/age v1.2.0
github.com/1password/onepassword-sdk-go v0.1.3
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0
- github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.1.0
+ github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.2.0
github.com/Masterminds/sprig/v3 v3.3.0
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2
github.com/Shopify/ejson v1.5.2
@@ -47,7 +47,7 @@ require (
go.etcd.io/bbolt v1.3.11
go.uber.org/automaxprocs v1.6.0
golang.org/x/crypto v0.28.0
- golang.org/x/crypto/x509roots/fallback v0.0.0-20241016071619-7cfb9161e8d8
+ golang.org/x/crypto/x509roots/fallback v0.0.0-20241022195102-750a45fe5e47
golang.org/x/oauth2 v0.23.0
golang.org/x/sync v0.8.0
golang.org/x/sys v0.26.0
@@ -55,14 +55,14 @@ require (
gopkg.in/ini.v1 v1.67.0
gopkg.in/yaml.v3 v3.0.1
howett.net/plist v1.0.1
- mvdan.cc/sh/v3 v3.9.0
+ mvdan.cc/sh/v3 v3.10.0
)
require (
dario.cat/mergo v1.0.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
- github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.1 // indirect
+ github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.1.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
github.com/BobuSumisu/aho-corasick v1.0.3 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
@@ -88,7 +88,7 @@ require (
github.com/aymerick/douceur v0.2.0 // indirect
github.com/bradenhilton/cityhash v1.0.0 // indirect
github.com/charmbracelet/harmonica v0.2.0 // indirect
- github.com/charmbracelet/lipgloss v0.13.0 // indirect
+ github.com/charmbracelet/lipgloss v0.13.1 // indirect
github.com/charmbracelet/x/ansi v0.3.2 // indirect
github.com/charmbracelet/x/term v0.2.0 // indirect
github.com/cloudflare/circl v1.5.0 // indirect
@@ -104,7 +104,7 @@ require (
github.com/fatih/semgroup v1.3.0 // indirect
github.com/gitleaks/go-gitdiff v0.9.1 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
- github.com/go-git/go-billy/v5 v5.5.0 // indirect
+ github.com/go-git/go-billy/v5 v5.6.0 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
diff --git a/go.sum b/go.sum
index 5975e1f03b7..0d462172e35 100644
--- a/go.sum
+++ b/go.sum
@@ -30,10 +30,10 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.0 h1:+m0M/LFxN43KvUL
github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.0/go.mod h1:PwOyop78lveYMRs6oCxjiVyBdyCgIYH6XHIVZO9/SFQ=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY=
-github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.1.0 h1:h4Zxgmi9oyZL2l8jeg1iRTqPloHktywWcu0nlJmo1tA=
-github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.1.0/go.mod h1:LgLGXawqSreJz135Elog0ywTJDsm0Hz2k+N+6ZK35u8=
-github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.1 h1:9fXQS/0TtQmKXp8SureKouF+idbQvp7cPUxykiohnBs=
-github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.1/go.mod h1:f+OaoSg0VQYPMqB0Jp2D54j1VHzITYcJaCNwV+k00ts=
+github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.2.0 h1:TkNl6WlpHdZSMt0Zngw8y0c9ZMi3GwmYl0kKNbW9PvU=
+github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.2.0/go.mod h1:ukmL56lWl275SgNFijuwx0Wv6n6HmzzpPWW4kMoy/wY=
+github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.1.0 h1:eXnN9kaS8TiDwXjoie3hMRLuwdUBUMW9KRgOqB3mCaw=
+github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.1.0/go.mod h1:XIpam8wumeZ5rVMuhdDQLMfIPDf1WO3IzrCRO3e3e3o=
github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM=
github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
@@ -125,8 +125,8 @@ github.com/charmbracelet/glamour v0.8.0 h1:tPrjL3aRcQbn++7t18wOpgLyl8wrOHUEDS7IZ
github.com/charmbracelet/glamour v0.8.0/go.mod h1:ViRgmKkf3u5S7uakt2czJ272WSg2ZenlYEZXT2x7Bjw=
github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ=
github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=
-github.com/charmbracelet/lipgloss v0.13.0 h1:4X3PPeoWEDCMvzDvGmTajSyYPcZM4+y8sCA/SsA3cjw=
-github.com/charmbracelet/lipgloss v0.13.0/go.mod h1:nw4zy0SBX/F/eAO1cWdcvy6qnkDUxr8Lw7dvFrAIbbY=
+github.com/charmbracelet/lipgloss v0.13.1 h1:Oik/oqDTMVA01GetT4JdEC033dNzWoQHdWnHnQmXE2A=
+github.com/charmbracelet/lipgloss v0.13.1/go.mod h1:zaYVJ2xKSKEnTEEbX6uAHabh2d975RJ+0yfkFpRBz5U=
github.com/charmbracelet/x/ansi v0.3.2 h1:wsEwgAN+C9U06l9dCVMX0/L3x7ptvY1qmjMwyfE6USY=
github.com/charmbracelet/x/ansi v0.3.2/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
github.com/charmbracelet/x/exp/golden v0.0.0-20240815200342-61de596daa2b h1:MnAMdlwSltxJyULnrYbkZpp4k58Co7Tah3ciKhSNo0Q=
@@ -142,8 +142,8 @@ github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
-github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0=
-github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
+github.com/creack/pty v1.1.23 h1:4M6+isWdcStXEf15G/RbrMPOQj1dZ7HPZCGwE4kOeP0=
+github.com/creack/pty v1.1.23/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
github.com/creack/pty/v2 v2.0.0-20231209135443-03db72c7b76c h1:5l8y/PgjeX1aUyZxXabtAf2ahCYQaqWzlFzQgU16o0U=
github.com/creack/pty/v2 v2.0.0-20231209135443-03db72c7b76c/go.mod h1:1gZ4PfMDNcYx8FxDdnF/6HYP327cTeB/ru6UdoWVQvw=
github.com/cyphar/filepath-securejoin v0.3.4 h1:VBWugsJh2ZxJmLFSM06/0qzQyiQX2Qs0ViKrUAcqdZ8=
@@ -158,8 +158,6 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
-github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
-github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/dustin/gojson v0.0.0-20160307161227-2e71ec9dd5ad h1:Qk76DOWdOp+GlyDKBAG3Klr9cn7N+LcYc82AZ2S7+cA=
@@ -190,8 +188,8 @@ github.com/gliderlabs/ssh v0.3.7 h1:iV3Bqi942d9huXnzEF2Mt+CY9gLu8DNM4Obd+8bODRE=
github.com/gliderlabs/ssh v0.3.7/go.mod h1:zpHEXBstFnQYtGnB8k8kQLol82umzn/2/snG7alWVD8=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
-github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU=
-github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow=
+github.com/go-git/go-billy/v5 v5.6.0 h1:w2hPNtoehvJIxR00Vb4xX94qHQi/ApZfX+nBE2Cjio8=
+github.com/go-git/go-billy/v5 v5.6.0/go.mod h1:sFDq7xD3fn3E0GOwUSZqHo9lrkmx8xJhA0ZrfvjBRGM=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys=
@@ -359,8 +357,8 @@ github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI=
github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
-github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
-github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
+github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
+github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ=
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
@@ -520,8 +518,8 @@ golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2Uz
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
-golang.org/x/crypto/x509roots/fallback v0.0.0-20241016071619-7cfb9161e8d8 h1:6mF9FjlsDdSfvxo62WHvHELQtoPNOmZuIA4H6YeXD44=
-golang.org/x/crypto/x509roots/fallback v0.0.0-20241016071619-7cfb9161e8d8/go.mod h1:kNa9WdvYnzFwC79zRpLRMJbdEFlhyM5RPFBBZp/wWH8=
+golang.org/x/crypto/x509roots/fallback v0.0.0-20241022195102-750a45fe5e47 h1:m1OiIChtSir3E2VcmUbCjURt0/sRo1QBSduRjcLFJ1o=
+golang.org/x/crypto/x509roots/fallback v0.0.0-20241022195102-750a45fe5e47/go.mod h1:kNa9WdvYnzFwC79zRpLRMJbdEFlhyM5RPFBBZp/wWH8=
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY=
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
@@ -629,5 +627,5 @@ howett.net/plist v1.0.1 h1:37GdZ8tP09Q35o9ych3ehygcsL+HqKSwzctveSlarvM=
howett.net/plist v1.0.1/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
mvdan.cc/editorconfig v0.3.0 h1:D1D2wLYEYGpawWT5SpM5pRivgEgXjtEXwC9MWhEY0gQ=
mvdan.cc/editorconfig v0.3.0/go.mod h1:NcJHuDtNOTEJ6251indKiWuzK6+VcrMuLzGMLKBFupQ=
-mvdan.cc/sh/v3 v3.9.0 h1:it14fyjCdQUk4jf/aYxLO3FG8jFarR9GzMCtnlvvD7c=
-mvdan.cc/sh/v3 v3.9.0/go.mod h1:cdBk8bgoiBI7lSZqK5JhUuq7OB64VQ7fgm85xelw3Nk=
+mvdan.cc/sh/v3 v3.10.0 h1:v9z7N1DLZ7owyLM/SXZQkBSXcwr2IGMm2LY2pmhVXj4=
+mvdan.cc/sh/v3 v3.10.0/go.mod h1:z/mSSVyLFGZzqb3ZIKojjyqIx/xbmz/UHdCSv9HmqXY=
|
chore
|
Update dependencies
|
d37a25958f7735947d458fcec01be5def1d85c61
|
2021-12-27 02:23:00
|
Tim Byrne
|
docs: Update yadm comparison (directory)
| false
|
diff --git a/docs/COMPARISON.md b/docs/COMPARISON.md
index 11655f2a2c5..434d9a8fe03 100644
--- a/docs/COMPARISON.md
+++ b/docs/COMPARISON.md
@@ -42,7 +42,7 @@
| Externals | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Manage partial files | ✅ | ❌ | ❌ | ❌ | ⁉️ | ✅ | ⁉️ |
| File removal | ✅ | ❌ | ❌ | ❌ | ✅ | ✅ | ❌ |
-| Directory creation | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ |
+| Directory creation | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
| Run scripts | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ |
| Run once scripts | ✅ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ |
| Machine-to-machine symlink differences | ✅ | ❌ | ❌ | ❌ | ⁉️ | ✅ | ⁉️ |
|
docs
|
Update yadm comparison (directory)
|
e52f73a71198972fd706445128a564a3c8358a4e
|
2023-06-17 04:54:29
|
Tom Payne
|
feat: Add --promptDefaults flag to init command
| false
|
diff --git a/assets/chezmoi.io/docs/reference/commands/init.md b/assets/chezmoi.io/docs/reference/commands/init.md
index 9fe00a3e98b..9c495f5bc56 100644
--- a/assets/chezmoi.io/docs/reference/commands/init.md
+++ b/assets/chezmoi.io/docs/reference/commands/init.md
@@ -66,6 +66,11 @@ a comma-separated list of *prompt*`=`*value* pairs. If `promptBool` is called
with a *prompt* that does not match any of *pairs*, then it prompts the user for
a value.
+## `--promptDefaults`
+
+Make all `prompt*` template function calls with a default value return that
+default value instead of prompting.
+
## `--promptInt` *pairs*
Populate the `promptInt` template function with values from *pairs*. *pairs* is
diff --git a/pkg/cmd/interactivetemplatefuncs.go b/pkg/cmd/interactivetemplatefuncs.go
index cc18f79e3b9..76b91bf2dd7 100644
--- a/pkg/cmd/interactivetemplatefuncs.go
+++ b/pkg/cmd/interactivetemplatefuncs.go
@@ -11,6 +11,7 @@ import (
type interactiveTemplateFuncsConfig struct {
forcePromptOnce bool
promptBool map[string]string
+ promptDefaults bool
promptInt map[string]int
promptString map[string]string
}
@@ -22,6 +23,12 @@ func (c *Config) addInteractiveTemplateFuncFlags(flags *pflag.FlagSet) {
c.interactiveTemplateFuncs.forcePromptOnce,
"Force prompt*Once template functions to prompt",
)
+ flags.BoolVar(
+ &c.interactiveTemplateFuncs.promptDefaults,
+ "promptDefaults",
+ c.interactiveTemplateFuncs.promptDefaults,
+ "Make prompt functions return default values",
+ )
flags.StringToStringVar(
&c.interactiveTemplateFuncs.promptBool,
"promptBool",
diff --git a/pkg/cmd/prompt.go b/pkg/cmd/prompt.go
index ade8f95fb4a..7bee9e4bc03 100644
--- a/pkg/cmd/prompt.go
+++ b/pkg/cmd/prompt.go
@@ -177,6 +177,9 @@ func (c *Config) promptBool(prompt string, args ...bool) (bool, error) {
default:
return false, fmt.Errorf("want 1 or 2 arguments, got %d", len(args)+1)
}
+ if c.interactiveTemplateFuncs.promptDefaults && defaultValue != nil {
+ return *defaultValue, nil
+ }
return c.readBool(prompt, defaultValue)
}
@@ -194,6 +197,9 @@ func (c *Config) promptChoice(prompt string, choices []string, args ...string) (
default:
return "", fmt.Errorf("want 2 or 3 arguments, got %d", len(args)+2)
}
+ if c.interactiveTemplateFuncs.promptDefaults && defaultValue != nil {
+ return *defaultValue, nil
+ }
return c.readChoice(prompt, choices, defaultValue)
}
@@ -207,6 +213,9 @@ func (c *Config) promptInt(prompt string, args ...int64) (int64, error) {
default:
return 0, fmt.Errorf("want 1 or 2 arguments, got %d", len(args)+1)
}
+ if c.interactiveTemplateFuncs.promptDefaults && defaultValue != nil {
+ return *defaultValue, nil
+ }
return c.readInt(prompt, defaultValue)
}
@@ -221,6 +230,9 @@ func (c *Config) promptString(prompt string, args ...string) (string, error) {
default:
return "", fmt.Errorf("want 1 or 2 arguments, got %d", len(args)+1)
}
+ if c.interactiveTemplateFuncs.promptDefaults && defaultValue != nil {
+ return *defaultValue, nil
+ }
return c.readString(prompt, defaultValue)
}
|
feat
|
Add --promptDefaults flag to init command
|
3d5533b570adb8f991393bfc7da07f770c4c3dba
|
2024-07-15 19:27:23
|
Tom Payne
|
chore: Update dependencies
| false
|
diff --git a/go.mod b/go.mod
index 041d4b99a31..85e6271e35f 100644
--- a/go.mod
+++ b/go.mod
@@ -88,15 +88,15 @@ require (
github.com/aymerick/douceur v0.2.0 // indirect
github.com/bradenhilton/cityhash v1.0.0 // indirect
github.com/charmbracelet/harmonica v0.2.0 // indirect
- github.com/charmbracelet/lipgloss v0.12.0 // indirect
- github.com/charmbracelet/x/ansi v0.1.3 // indirect
+ github.com/charmbracelet/lipgloss v0.12.1 // indirect
+ github.com/charmbracelet/x/ansi v0.1.4 // indirect
github.com/charmbracelet/x/input v0.1.2 // indirect
github.com/charmbracelet/x/term v0.1.1 // indirect
github.com/charmbracelet/x/windows v0.1.2 // indirect
github.com/cloudflare/circl v1.3.9 // indirect
github.com/creack/pty/v2 v2.0.0-20231209135443-03db72c7b76c // indirect
github.com/cyphar/filepath-securejoin v0.3.0 // indirect
- github.com/danieljoos/wincred v1.2.1 // indirect
+ github.com/danieljoos/wincred v1.2.2 // indirect
github.com/dlclark/regexp2 v1.11.2 // indirect
github.com/dustin/gojson v0.0.0-20160307161227-2e71ec9dd5ad // indirect
github.com/emirpasic/gods v1.18.1 // indirect
diff --git a/go.sum b/go.sum
index 6a1d9f2cebb..e3255bb044c 100644
--- a/go.sum
+++ b/go.sum
@@ -114,10 +114,10 @@ github.com/charmbracelet/glamour v0.7.0 h1:2BtKGZ4iVJCDfMF229EzbeR1QRKLWztO9dMtj
github.com/charmbracelet/glamour v0.7.0/go.mod h1:jUMh5MeihljJPQbJ/wf4ldw2+yBP59+ctV36jASy7ps=
github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ=
github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=
-github.com/charmbracelet/lipgloss v0.12.0 h1:k2RgmrgUjrWWu9FaMERoYK1iiPiwg+SSqGYu9t8/k4Y=
-github.com/charmbracelet/lipgloss v0.12.0/go.mod h1:beLlcmkF7MWA+5UrKKIRo/VJ21xGXr7YJ9miWfdMRIU=
-github.com/charmbracelet/x/ansi v0.1.3 h1:RBh/eleNWML5R524mjUF0yVRePTwqN9tPtV+DPgO5Lw=
-github.com/charmbracelet/x/ansi v0.1.3/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
+github.com/charmbracelet/lipgloss v0.12.1 h1:/gmzszl+pedQpjCOH+wFkZr/N90Snz40J/NR7A0zQcs=
+github.com/charmbracelet/lipgloss v0.12.1/go.mod h1:V2CiwIuhx9S1S1ZlADfOj9HmxeMAORuz5izHb0zGbB8=
+github.com/charmbracelet/x/ansi v0.1.4 h1:IEU3D6+dWwPSgZ6HBH+v6oUuZ/nVawMiWj5831KfiLM=
+github.com/charmbracelet/x/ansi v0.1.4/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
github.com/charmbracelet/x/input v0.1.2 h1:QJAZr33eOhDowkkEQ24rsJy4Llxlm+fRDf/cQrmqJa0=
github.com/charmbracelet/x/input v0.1.2/go.mod h1:LGBim0maUY4Pitjn/4fHnuXb4KirU3DODsyuHuXdOyA=
github.com/charmbracelet/x/term v0.1.1 h1:3cosVAiPOig+EV4X9U+3LDgtwwAoEzJjNdwbXDjF6yI=
@@ -141,8 +141,8 @@ github.com/creack/pty/v2 v2.0.0-20231209135443-03db72c7b76c h1:5l8y/PgjeX1aUyZxX
github.com/creack/pty/v2 v2.0.0-20231209135443-03db72c7b76c/go.mod h1:1gZ4PfMDNcYx8FxDdnF/6HYP327cTeB/ru6UdoWVQvw=
github.com/cyphar/filepath-securejoin v0.3.0 h1:tXpmbiaeBrS/K2US8nhgwdKYnfAOnVfkcLPKFgFHeA0=
github.com/cyphar/filepath-securejoin v0.3.0/go.mod h1:F7i41x/9cBF7lzCrVsYs9fuzwRZm4NQsGTBdpp6mETc=
-github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs=
-github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps=
+github.com/danieljoos/wincred v1.2.2 h1:774zMFJrqaeYCK2W57BgAem/MLi6mtSE47MB6BOJ0i0=
+github.com/danieljoos/wincred v1.2.2/go.mod h1:w7w4Utbrz8lqeMbDAK0lkNJUv5sAOkFi7nd/ogr0Uh8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
chore
|
Update dependencies
|
259303fa2201be0b8a3b76c1356643b7337d1d36
|
2021-10-02 04:03:12
|
Tom Payne
|
chore: Improve doctor command output
| false
|
diff --git a/internal/cmd/doctorcmd.go b/internal/cmd/doctorcmd.go
index f11029da9d7..1bfeaf83567 100644
--- a/internal/cmd/doctorcmd.go
+++ b/internal/cmd/doctorcmd.go
@@ -129,7 +129,7 @@ func (c *Config) runDoctorCmd(cmd *cobra.Command, args []string) error {
return err
}
shell, _ := shell.CurrentUserShell()
- editor, _ := c.editor()
+ editCommand, _ := c.editor()
checks := []check{
&versionCheck{
versionInfo: c.versionInfo,
@@ -164,14 +164,14 @@ func (c *Config) runDoctorCmd(cmd *cobra.Command, args []string) error {
ifNotExist: checkResultError,
},
&binaryCheck{
- name: "editor",
- binaryname: editor,
+ name: "edit-command",
+ binaryname: editCommand,
ifNotSet: checkResultWarning,
ifNotExist: checkResultWarning,
},
&umaskCheck{},
&binaryCheck{
- name: "git-cli",
+ name: "git-command",
binaryname: c.Git.Command,
ifNotSet: checkResultWarning,
ifNotExist: checkResultWarning,
@@ -179,27 +179,27 @@ func (c *Config) runDoctorCmd(cmd *cobra.Command, args []string) error {
versionRx: regexp.MustCompile(`^git\s+version\s+(\d+\.\d+\.\d+)`),
},
&binaryCheck{
- name: "merge-cli",
+ name: "merge-command",
binaryname: c.Merge.Command,
ifNotSet: checkResultWarning,
ifNotExist: checkResultWarning,
},
&binaryCheck{
- name: "age-cli",
- binaryname: "age",
+ name: "age-command",
+ binaryname: c.Age.Command,
versionArgs: []string{"-version"},
versionRx: regexp.MustCompile(`v(\d+\.\d+\.\d+\S*)`),
ifNotSet: checkResultWarning,
},
&binaryCheck{
- name: "gnupg-cli",
- binaryname: "gpg",
+ name: "gpg-command",
+ binaryname: c.GPG.Command,
versionArgs: []string{"--version"},
versionRx: regexp.MustCompile(`^gpg\s+\(.*?\)\s+(\d+\.\d+\.\d+)`),
ifNotSet: checkResultWarning,
},
&binaryCheck{
- name: "1password-cli",
+ name: "1password-command",
binaryname: c.Onepassword.Command,
ifNotSet: checkResultWarning,
ifNotExist: checkResultInfo,
@@ -207,7 +207,7 @@ func (c *Config) runDoctorCmd(cmd *cobra.Command, args []string) error {
versionRx: regexp.MustCompile(`^(\d+\.\d+\.\d+)`),
},
&binaryCheck{
- name: "bitwarden-cli",
+ name: "bitwarden-command",
binaryname: c.Bitwarden.Command,
ifNotSet: checkResultWarning,
ifNotExist: checkResultInfo,
@@ -215,7 +215,7 @@ func (c *Config) runDoctorCmd(cmd *cobra.Command, args []string) error {
versionRx: regexp.MustCompile(`^(\d+\.\d+\.\d+)`),
},
&binaryCheck{
- name: "gopass-cli",
+ name: "gopass-command",
binaryname: c.Gopass.Command,
ifNotSet: checkResultWarning,
ifNotExist: checkResultInfo,
@@ -224,7 +224,7 @@ func (c *Config) runDoctorCmd(cmd *cobra.Command, args []string) error {
minVersion: &gopassMinVersion,
},
&binaryCheck{
- name: "keepassxc-cli",
+ name: "keepassxc-command",
binaryname: c.Keepassxc.Command,
ifNotSet: checkResultWarning,
ifNotExist: checkResultInfo,
@@ -238,7 +238,7 @@ func (c *Config) runDoctorCmd(cmd *cobra.Command, args []string) error {
ifNotExist: checkResultInfo,
},
&binaryCheck{
- name: "lastpass-cli",
+ name: "lastpass-command",
binaryname: c.Lastpass.Command,
ifNotSet: checkResultWarning,
ifNotExist: checkResultInfo,
@@ -247,7 +247,7 @@ func (c *Config) runDoctorCmd(cmd *cobra.Command, args []string) error {
minVersion: &lastpassMinVersion,
},
&binaryCheck{
- name: "pass-cli",
+ name: "pass-command",
binaryname: c.Pass.Command,
ifNotSet: checkResultWarning,
ifNotExist: checkResultInfo,
@@ -255,7 +255,7 @@ func (c *Config) runDoctorCmd(cmd *cobra.Command, args []string) error {
versionRx: regexp.MustCompile(`(?m)=\s*v(\d+\.\d+\.\d+)`),
},
&binaryCheck{
- name: "vault-cli",
+ name: "vault-command",
binaryname: c.Vault.Command,
ifNotSet: checkResultWarning,
ifNotExist: checkResultInfo,
@@ -263,7 +263,7 @@ func (c *Config) runDoctorCmd(cmd *cobra.Command, args []string) error {
versionRx: regexp.MustCompile(`^Vault\s+v(\d+\.\d+\.\d+)`),
},
&binaryCheck{
- name: "secret-cli",
+ name: "secret-command",
binaryname: c.Secret.Command,
ifNotSet: checkResultInfo,
ifNotExist: checkResultInfo,
diff --git a/internal/cmd/testdata/scripts/doctor_unix.txt b/internal/cmd/testdata/scripts/doctor_unix.txt
index 6b4041163ca..09c1531d696 100644
--- a/internal/cmd/testdata/scripts/doctor_unix.txt
+++ b/internal/cmd/testdata/scripts/doctor_unix.txt
@@ -25,20 +25,20 @@ stdout '^ok\s+source-dir\s+'
stdout '^ok\s+suspicious-entries\s+'
stdout '^ok\s+dest-dir\s+'
stdout '^ok\s+shell\s+'
-stdout '^ok\s+editor\s+'
-stdout '^ok\s+git-cli\s+'
-stdout '^ok\s+merge-cli\s+'
-stdout '^ok\s+age-cli\s+'
-stdout '^ok\s+gnupg-cli\s+'
-stdout '^ok\s+1password-cli\s+'
-stdout '^ok\s+bitwarden-cli\s+'
-stdout '^ok\s+gopass-cli\s+'
-stdout '^ok\s+keepassxc-cli\s+'
+stdout '^ok\s+edit-command\s+'
+stdout '^ok\s+git-command\s+'
+stdout '^ok\s+merge-command\s+'
+stdout '^ok\s+age-command\s+'
+stdout '^ok\s+gpg-command\s+'
+stdout '^ok\s+1password-command\s+'
+stdout '^ok\s+bitwarden-command\s+'
+stdout '^ok\s+gopass-command\s+'
+stdout '^ok\s+keepassxc-command\s+'
stdout '^info\s+keepassxc-db\s+'
-stdout '^ok\s+lastpass-cli\s+'
-stdout '^ok\s+pass-cli\s+'
-stdout '^ok\s+vault-cli\s+'
-stdout '^ok\s+secret-cli\s+'
+stdout '^ok\s+lastpass-command\s+'
+stdout '^ok\s+pass-command\s+'
+stdout '^ok\s+vault-command\s+'
+stdout '^ok\s+secret-command\s+'
chhome home2/user
|
chore
|
Improve doctor command output
|
11c40d2e1c3cd91c88d4475336a6cf29019f4838
|
2022-06-17 20:04:47
|
Tom Payne
|
chore: Add test for reading hostname from myname on OpenBSD
| false
|
diff --git a/pkg/chezmoi/chezmoi_unix.go b/pkg/chezmoi/chezmoi_unix.go
index b2254aefc34..5913b867017 100644
--- a/pkg/chezmoi/chezmoi_unix.go
+++ b/pkg/chezmoi/chezmoi_unix.go
@@ -65,7 +65,9 @@ func etcMynameFQDNHostname(fileSystem vfs.FS) (string, error) {
s := bufio.NewScanner(bytes.NewReader(contents))
for s.Scan() {
text := s.Text()
- text, _, _ = CutString(text, "#")
+ if strings.HasPrefix(text, "#") {
+ continue
+ }
if hostname := strings.TrimSpace(text); hostname != "" {
return hostname, nil
}
diff --git a/pkg/chezmoi/chezmoi_unix_test.go b/pkg/chezmoi/chezmoi_unix_test.go
index 6d52310229f..63bf80fbaf0 100644
--- a/pkg/chezmoi/chezmoi_unix_test.go
+++ b/pkg/chezmoi/chezmoi_unix_test.go
@@ -4,6 +4,7 @@
package chezmoi
import (
+ "runtime"
"testing"
"github.com/stretchr/testify/assert"
@@ -16,6 +17,7 @@ import (
func TestFQDNHostname(t *testing.T) {
for _, tc := range []struct {
name string
+ goos string
root interface{}
expected string
}{
@@ -81,8 +83,23 @@ func TestFQDNHostname(t *testing.T) {
},
expected: "hostname.example.com",
},
+ {
+ name: "etc_myname",
+ goos: "openbsd",
+ root: map[string]interface{}{
+ "/etc/myname": chezmoitest.JoinLines(
+ "# comment",
+ "",
+ "hostname.example.com",
+ ),
+ },
+ expected: "hostname.example.com",
+ },
} {
t.Run(tc.name, func(t *testing.T) {
+ if tc.goos != "" && runtime.GOOS != tc.goos {
+ t.Skipf("skipping %s test on %s", tc.goos, runtime.GOOS)
+ }
chezmoitest.WithTestFS(t, tc.root, func(fileSystem vfs.FS) {
assert.Equal(t, tc.expected, FQDNHostname(fileSystem))
})
|
chore
|
Add test for reading hostname from myname on OpenBSD
|
c458f159ed6f32c018b997c0aaa1640d081ea02d
|
2021-11-12 03:40:28
|
Tom Payne
|
chore: Increase golangci-lint timeout to five minutes
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 912a1d09785..b2b14b4fc89 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -409,6 +409,7 @@ jobs:
uses: golangci/golangci-lint-action@v2
with:
version: v${{ env.GOLANGCI_LINT_VERSION }}
+ args: --timeout=5m
release: # FIXME this should be merged into test-ubuntu above
if: startsWith(github.ref, 'refs/tags/')
needs:
|
chore
|
Increase golangci-lint timeout to five minutes
|
f42337bc74f4f09bca621c62bb8d1c1ee237dc52
|
2023-12-26 22:14:26
|
Tom Payne
|
chore: Tidy up control flow
| false
|
diff --git a/internal/chezmoi/sourcestatetreenode.go b/internal/chezmoi/sourcestatetreenode.go
index 257dcd62360..57f384e11d7 100644
--- a/internal/chezmoi/sourcestatetreenode.go
+++ b/internal/chezmoi/sourcestatetreenode.go
@@ -37,9 +37,9 @@ func (n *sourceStateEntryTreeNode) GetNode(targetRelPath RelPath) *sourceStateEn
node := n
for _, childRelPath := range targetRelPath.SplitAll() {
- var ok bool
- node, ok = node.children[childRelPath]
- if !ok {
+ if childNode, ok := node.children[childRelPath]; ok {
+ node = childNode
+ } else {
return nil
}
}
|
chore
|
Tidy up control flow
|
36ce9b385ead23987b9eb1d30a25a4388d7927fb
|
2022-03-07 02:02:34
|
Tom Payne
|
chore: Tidy up variable names
| false
|
diff --git a/pkg/chezmoi/zipwritersystem.go b/pkg/chezmoi/zipwritersystem.go
index 1674f3faba2..d46ce672319 100644
--- a/pkg/chezmoi/zipwritersystem.go
+++ b/pkg/chezmoi/zipwritersystem.go
@@ -47,34 +47,34 @@ func (s *ZIPWriterSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte
// WriteFile implements System.WriteFile.
func (s *ZIPWriterSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error {
- fh := zip.FileHeader{
+ fileHeader := zip.FileHeader{
Name: filename.String(),
Method: zip.Deflate,
Modified: s.modified,
UncompressedSize64: uint64(len(data)),
}
- fh.SetMode(perm)
- fw, err := s.zipWriter.CreateHeader(&fh)
+ fileHeader.SetMode(perm)
+ fileWriter, err := s.zipWriter.CreateHeader(&fileHeader)
if err != nil {
return err
}
- _, err = fw.Write(data)
+ _, err = fileWriter.Write(data)
return err
}
// WriteSymlink implements System.WriteSymlink.
func (s *ZIPWriterSystem) WriteSymlink(oldname string, newname AbsPath) error {
data := []byte(oldname)
- fh := zip.FileHeader{
+ fileHeader := zip.FileHeader{
Name: newname.String(),
Modified: s.modified,
UncompressedSize64: uint64(len(data)),
}
- fh.SetMode(fs.ModeSymlink)
- fw, err := s.zipWriter.CreateHeader(&fh)
+ fileHeader.SetMode(fs.ModeSymlink)
+ fileWriter, err := s.zipWriter.CreateHeader(&fileHeader)
if err != nil {
return err
}
- _, err = fw.Write(data)
+ _, err = fileWriter.Write(data)
return err
}
|
chore
|
Tidy up variable names
|
15206c0bc93d3edad78daacfc64fd65fbfac5d7b
|
2024-09-27 04:48:28
|
Tom Payne
|
chore: Update GitHub Actions
| false
|
diff --git a/.github/workflows/govulncheck.yml b/.github/workflows/govulncheck.yml
index 05f43847f96..babca12a0db 100644
--- a/.github/workflows/govulncheck.yml
+++ b/.github/workflows/govulncheck.yml
@@ -16,7 +16,7 @@ jobs:
permissions:
contents: read
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- name: go-version
id: go-version
run: |
diff --git a/.github/workflows/installer.yml b/.github/workflows/installer.yml
index 18dd41f5978..7f70f4b497d 100644
--- a/.github/workflows/installer.yml
+++ b/.github/workflows/installer.yml
@@ -17,7 +17,7 @@ jobs:
permissions:
contents: read
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- id: filter
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
with:
@@ -36,7 +36,7 @@ jobs:
permissions:
contents: read
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: reviewdog/action-misspell@ef8b22c1cca06c8d306fc6be302c3dab0f6ca12f
with:
locale: US
@@ -54,7 +54,7 @@ jobs:
env:
BINARY: ${{ matrix.os == 'windows-2022' && 'bin/chezmoi.exe' || 'bin/chezmoi' }}
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- name: test-${{ matrix.os }}-local
shell: bash
run: |
@@ -77,7 +77,7 @@ jobs:
env:
BINARY: ${{ matrix.os == 'windows-2022' && 'bin/chezmoi.exe' || 'bin/chezmoi' }}
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- name: test-${{ matrix.os }}-local-pwsh
shell: pwsh
run: |
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 185eac4c3fd..fbe3368b951 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -33,7 +33,7 @@ jobs:
permissions:
contents: read
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- id: filter
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
with:
@@ -59,7 +59,7 @@ jobs:
permissions:
security-events: write
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
fetch-depth: 1
- uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93
@@ -71,7 +71,7 @@ jobs:
permissions:
contents: read
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: reviewdog/action-misspell@ef8b22c1cca06c8d306fc6be302c3dab0f6ca12f
with:
locale: US
@@ -83,7 +83,7 @@ jobs:
permissions:
contents: read
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- name: test
env:
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
@@ -96,7 +96,7 @@ jobs:
permissions:
contents: read
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- name: test
env:
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
@@ -109,7 +109,7 @@ jobs:
permissions:
contents: read
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
with:
go-version: ${{ env.GO_VERSION }}
@@ -144,7 +144,7 @@ jobs:
permissions:
contents: read
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
with:
go-version: oldstable
@@ -177,7 +177,7 @@ jobs:
permissions:
contents: read
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
fetch-depth: 0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
@@ -238,7 +238,7 @@ jobs:
permissions:
contents: read
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
fetch-depth: 0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
@@ -280,11 +280,11 @@ jobs:
permissions:
contents: read
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
with:
go-version: ${{ env.GO_VERSION }}
- - uses: astral-sh/setup-uv@abac0ce7b0768476333db78faaf98b1130f5face
+ - uses: astral-sh/setup-uv@4cda7d73322c50eac316ad623a716f09a2db2ac7
with:
version: ${{ env.UV_VERSION }}
- name: install-website-dependencies
@@ -302,7 +302,7 @@ jobs:
permissions:
contents: read
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
with:
go-version: ${{ env.GO_VERSION }}
@@ -328,7 +328,7 @@ jobs:
permissions:
contents: read
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
fetch-depth: 0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
@@ -384,7 +384,7 @@ jobs:
permissions:
contents: read
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
with:
go-version: stable
@@ -422,7 +422,7 @@ jobs:
run: snapcraft whoami
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
fetch-depth: 0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
@@ -450,13 +450,13 @@ jobs:
permissions:
contents: write
steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
+ - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
fetch-depth: 0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
with:
go-version: ${{ env.GO_VERSION }}
- - uses: astral-sh/setup-uv@abac0ce7b0768476333db78faaf98b1130f5face
+ - uses: astral-sh/setup-uv@4cda7d73322c50eac316ad623a716f09a2db2ac7
with:
version: ${{ env.UV_VERSION }}
- name: prepare-chezmoi.io
|
chore
|
Update GitHub Actions
|
775c8d3eefd5b44b10b28a691122719a089e7e2d
|
2022-10-18 00:47:59
|
Tom Payne
|
feat: Allow missing key behavior to be set by template directive
| false
|
diff --git a/assets/chezmoi.io/docs/reference/templates/delimiters.md b/assets/chezmoi.io/docs/reference/templates/delimiters.md
deleted file mode 100644
index a6420153eb8..00000000000
--- a/assets/chezmoi.io/docs/reference/templates/delimiters.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# Delimiters
-
-By default, chezmoi uses the standard `text/template` delimiters `{{` and `}}`.
-If a template contains the string
-
- chezmoi:template:left-delimiter=$LEFT right-delimiter=$RIGHT
-
-Then the delimiters `$LEFT` and `$RIGHT` are used instead. Either or both of
-`left-delimiter=$LEFT` and `right-delimiter=$RIGHT` may be omitted. `$LEFT` and
-`$RIGHT` must be quoted if they contain spaces. If either `$LEFT` or `$RIGHT`
-is empty then the default delimiter (`{{` and `}}` respectively) is set
-instead.
-
-chezmoi will remove the line containing `chezmoi:template:` directives to
-avoid parse errors from the delimiters. If multiple directives are present in a
-file, later directives override earlier ones.
-
-The delimiters are specific to the file in which they appear and are not
-inherited by templates called from the file.
-
-!!! example
-
- ```sh
- #!/bin/sh
- # chezmoi:template:left-delimiter="# [[" right-delimiter=]]
-
- # [[ "true" ]]
- ```
diff --git a/assets/chezmoi.io/docs/reference/templates/directives.md b/assets/chezmoi.io/docs/reference/templates/directives.md
new file mode 100644
index 00000000000..0a3b2c06dea
--- /dev/null
+++ b/assets/chezmoi.io/docs/reference/templates/directives.md
@@ -0,0 +1,54 @@
+# Directives
+
+File-specific template options can be set using template directives in the
+template of the form:
+
+ chezmoi:template:$KEY=$VALUE
+
+which sets the template option `$KEY` to `$VALUE`. `$VALUE` must be quoted if it
+contains spaces or double quotes. Multiple key/value pairs may be specified on a
+single line.
+
+Lines containing template directives are removed to avoid parse errors from any
+delimiters. If multiple directives are present in a file, later directives
+override earlier ones.
+
+## Delimiters
+
+By default, chezmoi uses the standard `text/template` delimiters `{{` and `}}`.
+If a template contains the string:
+
+ chezmoi:template:left-delimiter=$LEFT right-delimiter=$RIGHT
+
+Then the delimiters `$LEFT` and `$RIGHT` are used instead. Either or both of
+`left-delimiter=$LEFT` and `right-delimiter=$RIGHT` may be omitted. If either
+`$LEFT` or `$RIGHT` is empty then the default delimiter (`{{` and `}}`
+respectively) is set instead.
+
+The delimiters are specific to the file in which they appear and are not
+inherited by templates called from the file.
+
+!!! example
+
+ ```sh
+ #!/bin/sh
+ # chezmoi:template:left-delimiter="# [[" right-delimiter=]]
+
+ # [[ "true" ]]
+ ```
+
+## Missing keys
+
+By default, chezmoi will return an error if a template indexes a map with a key
+that is not present in the map. This behavior can be changed globally with the
+`template.options` configuration variable or with a template directive:
+
+ chezmoi:template:missing-key=$VALUE
+
+`$VALUE` can be one of:
+
+| Value | Effect |
+| --------- | ---------------------------------------------------------------------------------------------- |
+| `error` | Return an error on any missing key (default). |
+| `invalid` | Ignore missing keys. If printed, the result of the index operation is the string `<no value>`. |
+| `zero` | Ignore missing keys. If printed, the result of the index operation is the zero value. |
diff --git a/assets/chezmoi.io/mkdocs.yml b/assets/chezmoi.io/mkdocs.yml
index 9edfdbd10d7..d303e4b7ec4 100644
--- a/assets/chezmoi.io/mkdocs.yml
+++ b/assets/chezmoi.io/mkdocs.yml
@@ -168,7 +168,7 @@ nav:
- Templates:
- reference/templates/index.md
- Variables: reference/templates/variables.md
- - Delimiters: reference/templates/delimiters.md
+ - Directives: reference/templates/directives.md
- Functions:
- reference/templates/functions/index.md
- comment: reference/templates/functions/comment.md
diff --git a/pkg/chezmoi/sourcestate.go b/pkg/chezmoi/sourcestate.go
index 45a75c02179..a03395818cb 100644
--- a/pkg/chezmoi/sourcestate.go
+++ b/pkg/chezmoi/sourcestate.go
@@ -54,6 +54,7 @@ var (
type TemplateOptions struct {
LeftDelimiter string
RightDelimiter string
+ Options []string
}
// An External is an external source.
@@ -670,9 +671,10 @@ type ExecuteTemplateDataOptions struct {
// ExecuteTemplateData returns the result of executing template data.
func (s *SourceState) ExecuteTemplateData(options ExecuteTemplateDataOptions) ([]byte, error) {
templateOptions := options.TemplateOptions
+ templateOptions.Options = append([]string(nil), s.templateOptions...)
data := templateOptions.parseDirectives(options.Data)
tmpl, err := template.New(options.Name).
- Option(s.templateOptions...).
+ Option(templateOptions.Options...).
Funcs(s.templateFuncs).
Delims(templateOptions.LeftDelimiter, templateOptions.RightDelimiter).
Parse(string(data))
@@ -2179,7 +2181,7 @@ func (e *External) OriginString() string {
// parseDirectives updates o by parsing all template directives in data and
// returns data with the lines containing directives removed. The lines are
-// removed so that the specified delimiters do not break template parsing.
+// removed so that any delimiters do not break template parsing.
func (o *TemplateOptions) parseDirectives(data []byte) []byte {
matches := templateDirectiveRx.FindAllSubmatchIndex(data, -1)
if matches == nil {
@@ -2197,6 +2199,8 @@ func (o *TemplateOptions) parseDirectives(data []byte) []byte {
o.LeftDelimiter = value
case "right-delimiter":
o.RightDelimiter = value
+ case "missing-key":
+ o.Options = append(o.Options, "missingkey="+value)
}
}
}
diff --git a/pkg/chezmoi/sourcestate_test.go b/pkg/chezmoi/sourcestate_test.go
index 7983fbfd7d7..f9ab8cc078e 100644
--- a/pkg/chezmoi/sourcestate_test.go
+++ b/pkg/chezmoi/sourcestate_test.go
@@ -1742,6 +1742,13 @@ func TestTemplateOptionsParseDirectives(t *testing.T) {
LeftDelimiter: "[[",
},
},
+ {
+ name: "missing_key",
+ dataStr: "chezmoi:template:missing-key=zero",
+ expected: TemplateOptions{
+ Options: []string{"missingkey=zero"},
+ },
+ },
} {
t.Run(tc.name, func(t *testing.T) {
var actual TemplateOptions
diff --git a/pkg/cmd/testdata/scripts/templatedelimiters.txtar b/pkg/cmd/testdata/scripts/templatedirectives.txtar
similarity index 86%
rename from pkg/cmd/testdata/scripts/templatedelimiters.txtar
rename to pkg/cmd/testdata/scripts/templatedirectives.txtar
index a869d07db0f..7a85a333398 100644
--- a/pkg/cmd/testdata/scripts/templatedelimiters.txtar
+++ b/pkg/cmd/testdata/scripts/templatedirectives.txtar
@@ -7,7 +7,8 @@ exec chezmoi cat $HOME${/}template
cmp stdout golden/template
-- golden/template --
-ok
+<no value>
-- home/user/.local/share/chezmoi/template.tmpl --
# chezmoi:template:left-delimiter=[[ right-delimiter=]]
-[[ "ok" ]]
+# chezmoi:template:missing-key=default
+[[ .MissingKey ]]
|
feat
|
Allow missing key behavior to be set by template directive
|
e4eb8f8badad3aead73d657ed6283cc223c3d59b
|
2023-06-20 04:21:05
|
Tom Payne
|
chore: Version findtypos linter
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index c524c606d5e..b68d6496cad 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -15,6 +15,7 @@ env:
GOFUMPT_VERSION: 0.4.0
GOLANGCI_LINT_VERSION: 1.53.3
GOVERSIONINFO_VERSION: 1.4.0
+ FINDTYPOS_VERSION: 0.0.1
jobs:
changes:
runs-on: ubuntu-20.04
@@ -357,7 +358,7 @@ jobs:
find . -name '*.txtar' -print0 | xargs -0 go run ./internal/cmds/lint-txtar
- name: findtypos
run: |
- go install github.com/twpayne/[email protected]
+ go install "github.com/twpayne/findtypos@v${FINDTYPOS_VERSION}"
findtypos -format=github-actions chezmoi .
lint:
needs: changes
diff --git a/.gitignore b/.gitignore
index e512fc5ed87..edb41a01edd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
/COMMIT
/bin/actionlint
/bin/chezmoi
+/bin/findtypos
/bin/gofumpt
/bin/golines
/bin/golangci-lint
diff --git a/Makefile b/Makefile
index 51b7751b328..8367f8beada 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
GO?=go
ACTIONLINT_VERSION=$(shell awk '/ACTIONLINT_VERSION:/ { print $$2 }' .github/workflows/main.yml)
+FINDTYPOS_VERSION=$(shell awk '/FINDTYPOS_VERSION:/ { print $$2 }' .github/workflows/main.yml)
GOFUMPT_VERSION=$(shell awk '/GOFUMPT_VERSION:/ { print $$2 }' .github/workflows/main.yml)
GOLANGCI_LINT_VERSION=$(shell awk '/GOLANGCI_LINT_VERSION:/ { print $$2 }' .github/workflows/main.yml)
GOVERSIONINFO_VERSION=$(shell awk '/GOVERSIONINFO_VERSION:/ { print $$2 }' .github/workflows/main.yml)
@@ -108,11 +109,12 @@ generate:
${GO} generate
.PHONY: lint
-lint: ensure-actionlint ensure-golangci-lint
+lint: ensure-actionlint ensure-findtypos ensure-golangci-lint
./bin/actionlint
./bin/golangci-lint run
${GO} run ./internal/cmds/lint-whitespace
find . -name \*.txtar | xargs ${GO} run ./internal/cmds/lint-txtar
+ ./bin/findtypos chezmoi .
.PHONY: format
format: ensure-gofumpt ensure-golines
@@ -129,7 +131,7 @@ create-syso: ensure-goversioninfo
./bin/goversioninfo -platform-specific
.PHONY: ensure-tools
-ensure-tools: ensure-actionlint ensure-gofumpt ensure-golangci-lint ensure-goversioninfo
+ensure-tools: ensure-actionlint ensure-findtypos ensure-gofumpt ensure-golangci-lint ensure-goversioninfo
.PHONY: ensure-actionlint
ensure-actionlint:
@@ -138,6 +140,13 @@ ensure-actionlint:
GOBIN=$(shell pwd)/bin ${GO} install "github.com/rhysd/actionlint/cmd/actionlint@v${ACTIONLINT_VERSION}" ; \
fi
+.PHONY: ensure-findtypos
+ensure-findtypos:
+ if [ ! -x bin/findtypos ] ; then \
+ mkdir -p bin ; \
+ GOBIN=$(shell pwd)/bin ${GO} install "github.com/twpayne/findtypos@v${FINDTYPOS_VERSION}" ; \
+ fi
+
.PHONY: ensure-gofumpt
ensure-gofumpt:
if [ ! -x bin/gofumpt ] || ( ./bin/gofumpt --version | grep -Fqv "v${GOFUMPT_VERSION}" ) ; then \
|
chore
|
Version findtypos linter
|
2e04dcf85bbb7748d2f5a9d91f478d302fcc91aa
|
2024-04-25 03:48:44
|
Tom Payne
|
feat: Add --tree flag to unmanaged command
| false
|
diff --git a/internal/cmd/testdata/scripts/unmanagedtree.txtar b/internal/cmd/testdata/scripts/unmanagedtree.txtar
new file mode 100644
index 00000000000..b678de8a62b
--- /dev/null
+++ b/internal/cmd/testdata/scripts/unmanagedtree.txtar
@@ -0,0 +1,12 @@
+# test that chezmoi unmanaged --tree produces tree-like output
+exec chezmoi unmanaged --tree
+cmp stdout golden/stdout
+
+-- golden/stdout --
+.dir
+ file
+ subdir
+.local
+-- home/user/.dir/file --
+-- home/user/.dir/subdir/file --
+-- home/user/.local/share/chezmoi/dot_dir/.keep --
diff --git a/internal/cmd/unmanagedcmd.go b/internal/cmd/unmanagedcmd.go
index b28cc1ba156..d65262c19aa 100644
--- a/internal/cmd/unmanagedcmd.go
+++ b/internal/cmd/unmanagedcmd.go
@@ -1,10 +1,8 @@
package cmd
import (
- "fmt"
"io/fs"
"sort"
- "strings"
"github.com/spf13/cobra"
@@ -14,6 +12,7 @@ import (
type unmanagedCmdConfig struct {
pathStyle chezmoi.PathStyle
+ tree bool
}
func (c *Config) newUnmanagedCmd() *cobra.Command {
@@ -28,6 +27,7 @@ func (c *Config) newUnmanagedCmd() *cobra.Command {
}
unmanagedCmd.Flags().VarP(&c.unmanaged.pathStyle, "path-style", "p", "Path style")
+ unmanagedCmd.Flags().BoolVarP(&c.unmanaged.tree, "tree", "t", c.unmanaged.tree, "Print paths as a tree")
return unmanagedCmd
}
@@ -93,16 +93,18 @@ func (c *Config) runUnmanagedCmd(cmd *cobra.Command, args []string, sourceState
}
}
- builder := strings.Builder{}
- sortedRelPaths := chezmoi.RelPaths(unmanagedRelPaths.Elements())
- sort.Sort(sortedRelPaths)
- for _, relPath := range sortedRelPaths {
- switch c.unmanaged.pathStyle {
- case chezmoi.PathStyleAbsolute:
- fmt.Fprintln(&builder, c.DestDirAbsPath.Join(relPath))
- case chezmoi.PathStyleRelative:
- fmt.Fprintln(&builder, relPath)
+ paths := make([]string, 0, len(unmanagedRelPaths.Elements()))
+ for relPath := range unmanagedRelPaths {
+ var path string
+ if c.unmanaged.pathStyle == chezmoi.PathStyleAbsolute {
+ path = c.DestDirAbsPath.Join(relPath).String()
+ } else {
+ path = relPath.String()
}
+ paths = append(paths, path)
}
- return c.writeOutputString(builder.String())
+
+ return c.writePaths(paths, writePathsOptions{
+ tree: c.unmanaged.tree,
+ })
}
|
feat
|
Add --tree flag to unmanaged command
|
7d11c382beb07278a1cd6fef5f23948ac875fa03
|
2023-06-13 05:53:26
|
Oleksandr Redko
|
chore: Simplify code by using strings.EqualFold, time.Before
| false
|
diff --git a/pkg/cmd/autobool.go b/pkg/cmd/autobool.go
index 2862748e88a..82d948f980c 100644
--- a/pkg/cmd/autobool.go
+++ b/pkg/cmd/autobool.go
@@ -46,7 +46,7 @@ func (b autoBool) MarshalYAML() (any, error) {
// Set implements github.com/spf13/pflag.Value.Set.
func (b *autoBool) Set(s string) error {
- if strings.ToLower(s) == "auto" {
+ if strings.EqualFold(s, "auto") {
b.auto = true
return nil
}
diff --git a/pkg/cmd/config_test.go b/pkg/cmd/config_test.go
index dd885811e52..681e3ba6fd8 100644
--- a/pkg/cmd/config_test.go
+++ b/pkg/cmd/config_test.go
@@ -243,7 +243,7 @@ func withTestUser(t *testing.T, username string) configOption {
var err error
config.homeDirAbsPath, err = chezmoi.NormalizePath(config.homeDir)
if err != nil {
- panic(err)
+ t.Fatal(err)
}
config.CacheDirAbsPath = config.homeDirAbsPath.JoinString(".cache", "chezmoi")
config.SourceDirAbsPath = config.homeDirAbsPath.JoinString(".local", "share", "chezmoi")
diff --git a/pkg/cmd/githubtemplatefuncs.go b/pkg/cmd/githubtemplatefuncs.go
index 4f97f0e6f24..975b731dea6 100644
--- a/pkg/cmd/githubtemplatefuncs.go
+++ b/pkg/cmd/githubtemplatefuncs.go
@@ -56,7 +56,7 @@ func (c *Config) gitHubKeysTemplateFunc(user string) []*github.Key {
switch ok, err := chezmoi.PersistentStateGet(c.persistentState, gitHubKeysStateBucket, gitHubKeysKey, &gitHubKeysValue); { //nolint:lll
case err != nil:
panic(err)
- case ok && !now.After(gitHubKeysValue.RequestedAt.Add(c.GitHub.RefreshPeriod)):
+ case ok && now.Before(gitHubKeysValue.RequestedAt.Add(c.GitHub.RefreshPeriod)):
return gitHubKeysValue.Keys
}
}
@@ -117,7 +117,7 @@ func (c *Config) gitHubLatestReleaseTemplateFunc(ownerRepo string) *github.Repos
switch ok, err := chezmoi.PersistentStateGet(c.persistentState, gitHubLatestReleaseStateBucket, gitHubLatestReleaseKey, &gitHubLatestReleaseStateValue); { //nolint:lll
case err != nil:
panic(err)
- case ok && !now.After(gitHubLatestReleaseStateValue.RequestedAt.Add(c.GitHub.RefreshPeriod)):
+ case ok && now.Before(gitHubLatestReleaseStateValue.RequestedAt.Add(c.GitHub.RefreshPeriod)):
return gitHubLatestReleaseStateValue.Release
}
}
@@ -170,7 +170,7 @@ func (c *Config) gitHubLatestTagTemplateFunc(userRepo string) *github.Repository
switch ok, err := chezmoi.PersistentStateGet(c.persistentState, gitHubLatestTagStateBucket, gitHubLatestTagKey, &gitHubLatestTagValue); { //nolint:lll
case err != nil:
panic(err)
- case ok && !now.After(gitHubLatestTagValue.RequestedAt.Add(c.GitHub.RefreshPeriod)):
+ case ok && now.Before(gitHubLatestTagValue.RequestedAt.Add(c.GitHub.RefreshPeriod)):
return gitHubLatestTagValue.Tag
}
}
|
chore
|
Simplify code by using strings.EqualFold, time.Before
|
564414154a8b1951bed5974313c84673a2385460
|
2024-09-16 23:52:49
|
Tom Payne
|
fix: Improve phonetic pronunciation of chezmoi
| false
|
diff --git a/assets/chezmoi.io/docs/index.md.tmpl b/assets/chezmoi.io/docs/index.md.tmpl
index a4f928a2b75..ec16cfa4e4c 100644
--- a/assets/chezmoi.io/docs/index.md.tmpl
+++ b/assets/chezmoi.io/docs/index.md.tmpl
@@ -21,7 +21,7 @@ including:
* full file encryption (using gpg or age)
* running scripts (to handle everything else)
-With chezmoi, pronounced /ʃeɪ mwa/ (shay-moi), you can install chezmoi and your
+With chezmoi, pronounced /ʃeɪ mwa/ (shay-mwa), you can install chezmoi and your
dotfiles from your GitHub dotfiles repo on a new, empty machine with a single
command:
diff --git a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/design.md b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/design.md
index b7cc56da465..26852dc19b7 100644
--- a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/design.md
+++ b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/design.md
@@ -362,7 +362,7 @@ grow beyond that, switch to a whole system configuration management tool.
## Where does the name "chezmoi" come from?
-"chezmoi" splits to "chez moi" and pronounced /ʃeɪ mwa/ (shay-moi) meaning "at
+"chezmoi" splits to "chez moi" and pronounced /ʃeɪ mwa/ (shay-mwa) meaning "at
my house" in French. It's seven letters long, which is an appropriate length for
a command that is only run occasionally. If you prefer a shorter command, add an
alias to your shell configuration, for example:
|
fix
|
Improve phonetic pronunciation of chezmoi
|
bddbf7f0f0ca295af2140938143b40a2af9b7690
|
2024-12-12 04:55:20
|
Tom Payne
|
feat: Add initial policy on LLM-generated contributions
| false
|
diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md
index 4f84d10fe14..7439290f325 100644
--- a/.github/CODE_OF_CONDUCT.md
+++ b/.github/CODE_OF_CONDUCT.md
@@ -1,3 +1,21 @@
# Code of Conduct
-[Contributor Covenant Code Of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
+chezmoi follows the [Contributor Covenant Code Of
+Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/) with
+the following additions for LLM (Large Language Model)-generated contributions:
+
+* You may use any tools you wish to generate content for chezmoi.
+
+* You must review the content for correctness and legal obligations before
+ contributing it.
+
+* If you contribute un-reviewed LLM-generated content with the admission that
+ you do not understand the content then you will receive a warning. If you post
+ any un-reviewed LLM-generated content after the warning then you will be
+ banned without recourse.
+
+* If you contribute un-reviewed LLM-generated content without any admission that
+ you used an LLM then you will immediately be banned without recourse.
+
+Example LLMs include, but are not limited to, ChatGPT, Claude, Gemini, GitHub
+Copilot, and Llama.
diff --git a/assets/chezmoi.io/docs/developer-guide/index.md b/assets/chezmoi.io/docs/developer-guide/index.md
index d2660dac557..4cce1f1e8b3 100644
--- a/assets/chezmoi.io/docs/developer-guide/index.md
+++ b/assets/chezmoi.io/docs/developer-guide/index.md
@@ -1,5 +1,13 @@
# Developer guide
+!!! warning
+
+ If you use an LLM (Large Language Model, like ChatGPT, Claude, Gemini, GitHub Copilot,
+ or Llama) to make a contribution then you must say so in your contribution and
+ you must carefully review your contribution for correctness before sharing it.
+ If you share un-reviewed LLM-generated content then you will be immediately
+ banned. See `CODE_OF_CONDUCT.md` for more information.
+
chezmoi is written in [Go](https://golang.org) and development happens on
[GitHub](https://github.com). chezmoi is a standard Go project, using standard
Go tooling. chezmoi requires Go 1.22 or later.
|
feat
|
Add initial policy on LLM-generated contributions
|
3e7ec27e6c2735799f74c3f2d229ceb917e2427f
|
2024-12-21 18:46:19
|
Tom Payne
|
chore: Replace chezmoimaps package with standard library
| false
|
diff --git a/internal/archivetest/tar.go b/internal/archivetest/tar.go
index c27e44217c3..3f7ea983efa 100644
--- a/internal/archivetest/tar.go
+++ b/internal/archivetest/tar.go
@@ -5,15 +5,15 @@ import (
"bytes"
"fmt"
"io/fs"
-
- "github.com/twpayne/chezmoi/v2/internal/chezmoimaps"
+ "maps"
+ "slices"
)
// NewTar returns the bytes of a new tar archive containing root.
func NewTar(root map[string]any) ([]byte, error) {
buffer := &bytes.Buffer{}
tarWriter := tar.NewWriter(buffer)
- for _, key := range chezmoimaps.SortedKeys(root) {
+ for _, key := range slices.Sorted(maps.Keys(root)) {
if err := tarAddEntry(tarWriter, key, root[key]); err != nil {
return nil, err
}
@@ -47,7 +47,7 @@ func tarAddEntry(w *tar.Writer, name string, entry any) error {
}); err != nil {
return err
}
- for _, key := range chezmoimaps.SortedKeys(entry) {
+ for _, key := range slices.Sorted(maps.Keys(entry)) {
if err := tarAddEntry(w, name+"/"+key, entry[key]); err != nil {
return err
}
@@ -74,7 +74,7 @@ func tarAddEntry(w *tar.Writer, name string, entry any) error {
}); err != nil {
return err
}
- for _, key := range chezmoimaps.SortedKeys(entry.Entries) {
+ for _, key := range slices.Sorted(maps.Keys(entry.Entries)) {
if err := tarAddEntry(w, name+"/"+key, entry.Entries[key]); err != nil {
return err
}
diff --git a/internal/archivetest/zip.go b/internal/archivetest/zip.go
index c5f9f5cbeb7..eaf306b7af5 100644
--- a/internal/archivetest/zip.go
+++ b/internal/archivetest/zip.go
@@ -4,16 +4,16 @@ import (
"bytes"
"fmt"
"io/fs"
+ "maps"
+ "slices"
"github.com/klauspost/compress/zip"
-
- "github.com/twpayne/chezmoi/v2/internal/chezmoimaps"
)
func NewZip(root map[string]any) ([]byte, error) {
buffer := &bytes.Buffer{}
zipWriter := zip.NewWriter(buffer)
- for _, key := range chezmoimaps.SortedKeys(root) {
+ for _, key := range slices.Sorted(maps.Keys(root)) {
if err := zipAddEntry(zipWriter, key, root[key]); err != nil {
return nil, err
}
@@ -51,7 +51,7 @@ func zipAddEntryDir(w *zip.Writer, name string, perm fs.FileMode, entries map[st
if _, err := w.CreateHeader(&fileHeader); err != nil {
return err
}
- for _, key := range chezmoimaps.SortedKeys(entries) {
+ for _, key := range slices.Sorted(maps.Keys(entries)) {
if err := zipAddEntry(w, name+"/"+key, entries[key]); err != nil {
return err
}
diff --git a/internal/chezmoi/entrystate_test.go b/internal/chezmoi/entrystate_test.go
index 3dcadd155b5..728a7f8ddfb 100644
--- a/internal/chezmoi/entrystate_test.go
+++ b/internal/chezmoi/entrystate_test.go
@@ -3,13 +3,13 @@ package chezmoi
import (
"fmt"
"io/fs"
+ "maps"
"runtime"
+ "slices"
"testing"
"github.com/alecthomas/assert/v2"
"github.com/muesli/combinator"
-
- "github.com/twpayne/chezmoi/v2/internal/chezmoimaps"
)
func TestEntryStateEquivalent(t *testing.T) {
@@ -78,7 +78,7 @@ func TestEntryStateEquivalent(t *testing.T) {
"symlink_symlink_copy": true,
}
- entryStateKeys := chezmoimaps.SortedKeys(entryStates)
+ entryStateKeys := slices.Sorted(maps.Keys(entryStates))
testData := struct {
EntryState1Key []string
diff --git a/internal/chezmoi/entrytypeset.go b/internal/chezmoi/entrytypeset.go
index 4ec13fff050..9923df4d3fc 100644
--- a/internal/chezmoi/entrytypeset.go
+++ b/internal/chezmoi/entrytypeset.go
@@ -3,13 +3,13 @@ package chezmoi
import (
"fmt"
"io/fs"
+ "maps"
"reflect"
+ "slices"
"strings"
"github.com/mitchellh/mapstructure"
"github.com/spf13/cobra"
-
- "github.com/twpayne/chezmoi/v2/internal/chezmoimaps"
)
// An EntryTypeSet is a set of entry types. It parses and prints as a
@@ -64,7 +64,7 @@ var (
"templates": EntryTypeTemplates,
}
- entryTypeStrings = chezmoimaps.SortedKeys(entryTypeBits)
+ entryTypeStrings = slices.Sorted(maps.Keys(entryTypeBits))
entryTypeCompletions = []string{
"all",
diff --git a/internal/chezmoi/format.go b/internal/chezmoi/format.go
index 9c28d1ee442..0baa4768826 100644
--- a/internal/chezmoi/format.go
+++ b/internal/chezmoi/format.go
@@ -6,13 +6,13 @@ import (
"errors"
"fmt"
"io"
+ "maps"
+ "slices"
"strings"
"github.com/pelletier/go-toml/v2"
"github.com/tailscale/hujson"
"gopkg.in/yaml.v3"
-
- "github.com/twpayne/chezmoi/v2/internal/chezmoimaps"
)
// Formats.
@@ -61,7 +61,7 @@ var (
"yaml": FormatYAML,
"yml": FormatYAML,
}
- FormatExtensions = chezmoimaps.SortedKeys(FormatsByExtension)
+ FormatExtensions = slices.Sorted(maps.Keys(FormatsByExtension))
)
// Marshal implements Format.Marshal.
diff --git a/internal/chezmoi/refreshexternals.go b/internal/chezmoi/refreshexternals.go
index 7696c697380..2ceec593d67 100644
--- a/internal/chezmoi/refreshexternals.go
+++ b/internal/chezmoi/refreshexternals.go
@@ -2,9 +2,9 @@ package chezmoi
import (
"fmt"
+ "maps"
+ "slices"
"strings"
-
- "github.com/twpayne/chezmoi/v2/internal/chezmoimaps"
)
type RefreshExternals int
@@ -22,7 +22,7 @@ var (
"never": RefreshExternalsNever,
}
- RefreshExternalsFlagCompletionFunc = FlagCompletionFunc(chezmoimaps.SortedKeys(refreshExternalsWellKnownStrings))
+ RefreshExternalsFlagCompletionFunc = FlagCompletionFunc(slices.Sorted(maps.Keys(refreshExternalsWellKnownStrings)))
)
func (re *RefreshExternals) Set(s string) error {
diff --git a/internal/chezmoi/sourcestate.go b/internal/chezmoi/sourcestate.go
index ff56423cd6f..a06f74c193a 100644
--- a/internal/chezmoi/sourcestate.go
+++ b/internal/chezmoi/sourcestate.go
@@ -14,6 +14,7 @@ import (
"io"
"io/fs"
"log/slog"
+ "maps"
"net/http"
"net/url"
"os"
@@ -35,7 +36,6 @@ import (
"github.com/twpayne/chezmoi/v2/internal/chezmoierrors"
"github.com/twpayne/chezmoi/v2/internal/chezmoilog"
- "github.com/twpayne/chezmoi/v2/internal/chezmoimaps"
"github.com/twpayne/chezmoi/v2/internal/chezmoiset"
)
@@ -366,7 +366,7 @@ func (s *SourceState) Add(
options *AddOptions,
) error {
// Filter out excluded and ignored paths.
- destAbsPaths := AbsPaths(chezmoimaps.Keys(destAbsPathInfos))
+ destAbsPaths := AbsPaths(slices.Sorted(maps.Keys(destAbsPathInfos)))
sort.Sort(destAbsPaths)
n := 0
for _, destAbsPath := range destAbsPaths {
diff --git a/internal/chezmoi/sourcestatetreenode.go b/internal/chezmoi/sourcestatetreenode.go
index f3714b510b8..02ebe31912f 100644
--- a/internal/chezmoi/sourcestatetreenode.go
+++ b/internal/chezmoi/sourcestatetreenode.go
@@ -4,9 +4,9 @@ import (
"errors"
"fmt"
"io/fs"
+ "maps"
+ "slices"
"sort"
-
- "github.com/twpayne/chezmoi/v2/internal/chezmoimaps"
)
// A sourceStateEntryTreeNode is a node in a tree of SourceStateEntries.
@@ -67,7 +67,7 @@ func (n *sourceStateEntryTreeNode) forEachNode(targetRelPath RelPath, f func(Rel
return err
}
- childrenByRelPath := RelPaths(chezmoimaps.Keys(n.children))
+ childrenByRelPath := RelPaths(slices.Collect(maps.Keys(n.children)))
sort.Sort(childrenByRelPath)
for _, childRelPath := range childrenByRelPath {
child := n.children[childRelPath]
diff --git a/internal/chezmoi/targetstateentry_test.go b/internal/chezmoi/targetstateentry_test.go
index 7d40fbeae04..aaf65ceef8f 100644
--- a/internal/chezmoi/targetstateentry_test.go
+++ b/internal/chezmoi/targetstateentry_test.go
@@ -4,6 +4,8 @@ import (
"crypto/sha256"
"fmt"
"io/fs"
+ "maps"
+ "slices"
"testing"
"github.com/alecthomas/assert/v2"
@@ -11,7 +13,6 @@ import (
vfs "github.com/twpayne/go-vfs/v5"
"github.com/twpayne/go-vfs/v5/vfst"
- "github.com/twpayne/chezmoi/v2/internal/chezmoimaps"
"github.com/twpayne/chezmoi/v2/internal/chezmoitest"
)
@@ -76,8 +77,8 @@ func TestTargetStateEntryApply(t *testing.T) {
TargetStateKey []string
ActualDestDirStateKey []string
}{
- TargetStateKey: chezmoimaps.SortedKeys(targetStates),
- ActualDestDirStateKey: chezmoimaps.SortedKeys(actualStates),
+ TargetStateKey: slices.Sorted(maps.Keys(targetStates)),
+ ActualDestDirStateKey: slices.Sorted(maps.Keys(actualStates)),
}
var testCases []struct {
TargetStateKey string
diff --git a/internal/chezmoimaps/chezmoimaps.go b/internal/chezmoimaps/chezmoimaps.go
deleted file mode 100644
index 70eef78f6e3..00000000000
--- a/internal/chezmoimaps/chezmoimaps.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Package chezmoimaps implements common map functions.
-package chezmoimaps
-
-import (
- "cmp"
- "slices"
-)
-
-// Keys returns the keys of the map m.
-func Keys[M ~map[K]V, K comparable, V any](m M) []K {
- keys := make([]K, 0, len(m))
- for key := range m {
- keys = append(keys, key)
- }
- return keys
-}
-
-// SortedKeys returns the keys of the map m in order.
-func SortedKeys[M ~map[K]V, K cmp.Ordered, V any](m M) []K {
- keys := Keys(m)
- slices.Sort(keys)
- return keys
-}
diff --git a/internal/cmd/choiceflag.go b/internal/cmd/choiceflag.go
index f55fa5b0506..410767ff967 100644
--- a/internal/cmd/choiceflag.go
+++ b/internal/cmd/choiceflag.go
@@ -4,7 +4,9 @@ import (
"encoding/json"
"errors"
"fmt"
+ "maps"
"reflect"
+ "slices"
"strconv"
"strings"
@@ -12,7 +14,6 @@ import (
"github.com/spf13/cobra"
"github.com/twpayne/chezmoi/v2/internal/chezmoi"
- "github.com/twpayne/chezmoi/v2/internal/chezmoimaps"
"github.com/twpayne/chezmoi/v2/internal/chezmoiset"
)
@@ -45,7 +46,7 @@ func newChoiceFlag(value string, allowedValues []string) *choiceFlag {
// FlagCompletionFunc returns f's flag completion function.
func (f *choiceFlag) FlagCompletionFunc() func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
- return chezmoi.FlagCompletionFunc(chezmoimaps.SortedKeys(f.allowedValues))
+ return chezmoi.FlagCompletionFunc(slices.Sorted(maps.Keys(f.allowedValues)))
}
// MarshalJSON implements encoding/json.Marshaler.MarshalJSON.
@@ -84,7 +85,7 @@ func (f *choiceFlag) String() string {
// Type implements github.com/spf13/pflag.Value.Type.
func (f *choiceFlag) Type() string {
- sortedKeys := chezmoimaps.SortedKeys(f.allowedValues)
+ sortedKeys := slices.Sorted(maps.Keys(f.allowedValues))
if len(sortedKeys) > 0 && sortedKeys[0] == "" {
sortedKeys[0] = "<none>"
}
diff --git a/internal/cmd/pathlist.go b/internal/cmd/pathlist.go
index 4b77f187c21..6351ea58af3 100644
--- a/internal/cmd/pathlist.go
+++ b/internal/cmd/pathlist.go
@@ -1,9 +1,9 @@
package cmd
import (
+ "maps"
+ "slices"
"strings"
-
- "github.com/twpayne/chezmoi/v2/internal/chezmoimaps"
)
type pathListTreeNode struct {
@@ -42,7 +42,7 @@ func (n *pathListTreeNode) write(sb *strings.Builder, prefix, indent string) {
}
func (n *pathListTreeNode) writeChildren(sb *strings.Builder, prefix, indent string) {
- for _, key := range chezmoimaps.SortedKeys(n.children) {
+ for _, key := range slices.Sorted(maps.Keys(n.children)) {
child := n.children[key]
child.write(sb, prefix, indent)
}
diff --git a/internal/cmd/templatefuncs.go b/internal/cmd/templatefuncs.go
index be4c5656667..1e838a588e7 100644
--- a/internal/cmd/templatefuncs.go
+++ b/internal/cmd/templatefuncs.go
@@ -7,6 +7,7 @@ import (
"fmt"
"io"
"io/fs"
+ "maps"
"os"
"os/exec"
"path/filepath"
@@ -23,7 +24,6 @@ import (
"github.com/twpayne/chezmoi/v2/internal/chezmoi"
"github.com/twpayne/chezmoi/v2/internal/chezmoilog"
- "github.com/twpayne/chezmoi/v2/internal/chezmoimaps"
)
type ioregData struct {
@@ -646,7 +646,7 @@ func writeIniMap(w io.Writer, data map[string]any, sectionPrefix string) error {
value map[string]any
}
var subsections []subsection
- for _, key := range chezmoimaps.SortedKeys(data) {
+ for _, key := range slices.Sorted(maps.Keys(data)) {
switch value := data[key].(type) {
case bool:
fmt.Fprintf(w, "%s = %t\n", key, value)
|
chore
|
Replace chezmoimaps package with standard library
|
c79707f1649b7cef34139bc308282ba19d33678d
|
2023-03-25 01:53:16
|
Tom Payne
|
chore: Update dependencies
| false
|
diff --git a/go.mod b/go.mod
index 05f2bb7fc00..d3b22be971d 100644
--- a/go.mod
+++ b/go.mod
@@ -6,11 +6,11 @@ require (
filippo.io/age v1.1.1
github.com/Masterminds/sprig/v3 v3.2.3
github.com/Shopify/ejson v1.3.3
- github.com/aws/aws-sdk-go-v2 v1.17.6
- github.com/aws/aws-sdk-go-v2/config v1.18.18
- github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.19.0
+ github.com/aws/aws-sdk-go-v2 v1.17.7
+ github.com/aws/aws-sdk-go-v2/config v1.18.19
+ github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.19.1
github.com/bmatcuk/doublestar/v4 v4.6.0
- github.com/bradenhilton/mozillainstallhash v1.0.0
+ github.com/bradenhilton/mozillainstallhash v1.0.1
github.com/charmbracelet/bubbles v0.15.0
github.com/charmbracelet/bubbletea v0.23.2
github.com/charmbracelet/glamour v0.6.0
@@ -42,7 +42,7 @@ require (
go.etcd.io/bbolt v1.3.7
go.uber.org/multierr v1.10.0
golang.org/x/crypto v0.7.0
- golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0
+ golang.org/x/exp v0.0.0-20230321023759-10a507213a29
golang.org/x/oauth2 v0.6.0
golang.org/x/sync v0.1.0
golang.org/x/sys v0.6.0
@@ -57,20 +57,20 @@ require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
- github.com/ProtonMail/go-crypto v0.0.0-20230316153859-cb82d937a5d9 // indirect
+ github.com/ProtonMail/go-crypto v0.0.0-20230321155629-9a39f2531310 // indirect
github.com/acomagu/bufpipe v1.0.4 // indirect
github.com/alecthomas/chroma v0.10.0 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/atotto/clipboard v0.1.4 // indirect
- github.com/aws/aws-sdk-go-v2/credentials v1.13.17 // indirect
- github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.0 // indirect
- github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.30 // indirect
- github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.24 // indirect
- github.com/aws/aws-sdk-go-v2/internal/ini v1.3.31 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.24 // indirect
- github.com/aws/aws-sdk-go-v2/service/sso v1.12.5 // indirect
- github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.5 // indirect
- github.com/aws/aws-sdk-go-v2/service/sts v1.18.6 // indirect
+ github.com/aws/aws-sdk-go-v2/credentials v1.13.18 // indirect
+ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.1 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.31 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.25 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/ini v1.3.32 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.25 // indirect
+ github.com/aws/aws-sdk-go-v2/service/sso v1.12.6 // indirect
+ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.6 // indirect
+ github.com/aws/aws-sdk-go-v2/service/sts v1.18.7 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
@@ -93,14 +93,14 @@ require (
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
- github.com/imdario/mergo v0.3.14 // indirect
+ github.com/imdario/mergo v0.3.15 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/itchyny/timefmt-go v0.1.5 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
- github.com/mattn/go-isatty v0.0.17 // indirect
+ github.com/mattn/go-isatty v0.0.18 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/microcosm-cc/bluemonday v1.0.23 // indirect
@@ -119,7 +119,6 @@ require (
github.com/shopspring/decimal v1.3.1 // indirect
github.com/skeema/knownhosts v1.1.0 // indirect
github.com/spf13/cast v1.5.0 // indirect
- github.com/stretchr/objx v0.5.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/yuin/goldmark v1.5.4 // indirect
github.com/yuin/goldmark-emoji v1.0.1 // indirect
diff --git a/go.sum b/go.sum
index 9b8b10fc70b..2d07112e1be 100644
--- a/go.sum
+++ b/go.sum
@@ -11,14 +11,11 @@ github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBa
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg=
github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE=
-github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4/go.mod h1:UBYPn8k0D56RtnR8RFQMjmh4KrZzWJ5o7Z9SYjossQ8=
-github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA=
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g=
-github.com/ProtonMail/go-crypto v0.0.0-20230316153859-cb82d937a5d9 h1:rndY7RCFW5vUcdVvhfIRsQhYm1MdvwI+dTFbyrWiGHY=
-github.com/ProtonMail/go-crypto v0.0.0-20230316153859-cb82d937a5d9/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g=
+github.com/ProtonMail/go-crypto v0.0.0-20230321155629-9a39f2531310 h1:dGAdTcqheKrQ/TW76sAcmO2IorwXplUw2inPkOzykbw=
+github.com/ProtonMail/go-crypto v0.0.0-20230321155629-9a39f2531310/go.mod h1:8TI4H3IbrackdNgv+92dI+rhpCaLqM0IfpgCgenFvRE=
github.com/Shopify/ejson v1.3.3 h1:dPzgmvFhUPTJIzwdF5DaqbwW1dWaoR8ADKRdSTy6Mss=
github.com/Shopify/ejson v1.3.3/go.mod h1:VZMUtDzvBW/PAXRUF5fzp1ffb1ucT8MztrZXXLYZurw=
-github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ=
github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek=
@@ -31,36 +28,30 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
-github.com/aws/aws-sdk-go-v2 v1.17.6 h1:Y773UK7OBqhzi5VDXMi1zVGsoj+CVHs2eaC2bDsLwi0=
-github.com/aws/aws-sdk-go-v2 v1.17.6/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
-github.com/aws/aws-sdk-go-v2/config v1.18.16 h1:4r7gsCu8Ekwl5iJGE/GmspA2UifqySCCkyyyPFeWs3w=
-github.com/aws/aws-sdk-go-v2/config v1.18.16/go.mod h1:XjM6lVbq7UgELp9NjXBrb1DQY/ownlWsvDhEQksemJc=
-github.com/aws/aws-sdk-go-v2/config v1.18.18 h1:/ePABXvXl3ESlzUGnkkvvNnRFw3Gh13dyqaq0Qo3JcU=
-github.com/aws/aws-sdk-go-v2/config v1.18.18/go.mod h1:Lj3E7XcxJnxMa+AYo89YiL68s1cFJRGduChynYU67VA=
-github.com/aws/aws-sdk-go-v2/credentials v1.13.16 h1:GgToSxaENX/1zXIGNFfiVk4hxryYJ5Vt4Mh8XLAL7Lc=
-github.com/aws/aws-sdk-go-v2/credentials v1.13.16/go.mod h1:KP7aFJhfwPFgx9aoVYL2nYHjya5WBD98CWaadpgmnpY=
-github.com/aws/aws-sdk-go-v2/credentials v1.13.17 h1:IubQO/RNeIVKF5Jy77w/LfUvmmCxTnk2TP1UZZIMiF4=
-github.com/aws/aws-sdk-go-v2/credentials v1.13.17/go.mod h1:K9xeFo1g/YPMguMUD69YpwB4Nyi6W/5wn706xIInJFg=
-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.24 h1:5qyqXASrX2zy5cTnoHHa4N2c3Lc94GH7gjnBP3GwKdU=
-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.24/go.mod h1:neYVaeKr5eT7BzwULuG2YbLhzWZ22lpjKdCybR7AXrQ=
-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.0 h1:/2Cb3SK3xVOQA7Xfr5nCWCo5H3UiNINtsVvVdk8sQqA=
-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.0/go.mod h1:neYVaeKr5eT7BzwULuG2YbLhzWZ22lpjKdCybR7AXrQ=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.30 h1:y+8n9AGDjikyXoMBTRaHHHSaFEB8267ykmvyPodJfys=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.30/go.mod h1:LUBAO3zNXQjoONBKn/kR1y0Q4cj/D02Ts0uHYjcCQLM=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.24 h1:r+Kv+SEJquhAZXaJ7G4u44cIwXV3f8K+N482NNAzJZA=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.24/go.mod h1:gAuCezX/gob6BSMbItsSlMb6WZGV7K2+fWOvk8xBSto=
-github.com/aws/aws-sdk-go-v2/internal/ini v1.3.31 h1:hf+Vhp5WtTdcSdE+yEcUz8L73sAzN0R+0jQv+Z51/mI=
-github.com/aws/aws-sdk-go-v2/internal/ini v1.3.31/go.mod h1:5zUjguZfG5qjhG9/wqmuyHRyUftl2B5Cp6NNxNC6kRA=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.24 h1:c5qGfdbCHav6viBwiyDns3OXqhqAbGjfIB4uVu2ayhk=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.24/go.mod h1:HMA4FZG6fyib+NDo5bpIxX1EhYjrAOveZJY2YR0xrNE=
-github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.19.0 h1:B4LvuBxrxh2WXakqwJL22EPAWgqGGK9/E4YQV/IIkYo=
-github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.19.0/go.mod h1:XF4Gbmcn6V9xIIm6lhwtyX1NXConNJ8x6yizt2Ejx/0=
-github.com/aws/aws-sdk-go-v2/service/sso v1.12.5 h1:bdKIX6SVF3nc3xJFw6Nf0igzS6Ff/louGq8Z6VP/3Hs=
-github.com/aws/aws-sdk-go-v2/service/sso v1.12.5/go.mod h1:vuWiaDB30M/QTC+lI3Wj6S/zb7tpUK2MSYgy3Guh2L0=
-github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.5 h1:xLPZMyuZ4GuqRCIec/zWuIhRFPXh2UOJdLXBSi64ZWQ=
-github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.5/go.mod h1:QjxpHmCwAg0ESGtPQnLIVp7SedTOBMYy+Slr3IfMKeI=
-github.com/aws/aws-sdk-go-v2/service/sts v1.18.6 h1:rIFn5J3yDoeuKCE9sESXqM5POTAhOP1du3bv/qTL+tE=
-github.com/aws/aws-sdk-go-v2/service/sts v1.18.6/go.mod h1:48WJ9l3dwP0GSHWGc5sFGGlCkuA82Mc2xnw+T6Q8aDw=
+github.com/aws/aws-sdk-go-v2 v1.17.7 h1:CLSjnhJSTSogvqUGhIC6LqFKATMRexcxLZ0i/Nzk9Eg=
+github.com/aws/aws-sdk-go-v2 v1.17.7/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
+github.com/aws/aws-sdk-go-v2/config v1.18.19 h1:AqFK6zFNtq4i1EYu+eC7lcKHYnZagMn6SW171la0bGw=
+github.com/aws/aws-sdk-go-v2/config v1.18.19/go.mod h1:XvTmGMY8d52ougvakOv1RpiTLPz9dlG/OQHsKU/cMmY=
+github.com/aws/aws-sdk-go-v2/credentials v1.13.18 h1:EQMdtHwz0ILTW1hoP+EwuWhwCG1hD6l3+RWFQABET4c=
+github.com/aws/aws-sdk-go-v2/credentials v1.13.18/go.mod h1:vnwlwjIe+3XJPBYKu1et30ZPABG3VaXJYr8ryohpIyM=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.1 h1:gt57MN3liKiyGopcqgNzJb2+d9MJaKT/q1OksHNXVE4=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.1/go.mod h1:lfUx8puBRdM5lVVMQlwt2v+ofiG/X6Ms+dy0UkG/kXw=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.31 h1:sJLYcS+eZn5EeNINGHSCRAwUJMFVqklwkH36Vbyai7M=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.31/go.mod h1:QT0BqUvX1Bh2ABdTGnjqEjvjzrCfIniM9Sc8zn9Yndo=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.25 h1:1mnRASEKnkqsntcxHaysxwgVoUUp5dkiB+l3llKnqyg=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.25/go.mod h1:zBHOPwhBc3FlQjQJE/D3IfPWiWaQmT06Vq9aNukDo0k=
+github.com/aws/aws-sdk-go-v2/internal/ini v1.3.32 h1:p5luUImdIqywn6JpQsW3tq5GNOxKmOnEpybzPx+d1lk=
+github.com/aws/aws-sdk-go-v2/internal/ini v1.3.32/go.mod h1:XGhIBZDEgfqmFIugclZ6FU7v75nHhBDtzuB4xB/tEi4=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.25 h1:5LHn8JQ0qvjD9L9JhMtylnkcw7j05GDZqM9Oin6hpr0=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.25/go.mod h1:/95IA+0lMnzW6XzqYJRpjjsAbKEORVeO0anQqjd2CNU=
+github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.19.1 h1:+rANS0SbrDUqF3VJeil1HJHhNK8vdUu1VGqnkr4o6kw=
+github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.19.1/go.mod h1:SUiYnlcBDUvSLD6iUmwSwXni2i6iGa9WHc+eM5061W4=
+github.com/aws/aws-sdk-go-v2/service/sso v1.12.6 h1:5V7DWLBd7wTELVz5bPpwzYy/sikk0gsgZfj40X+l5OI=
+github.com/aws/aws-sdk-go-v2/service/sso v1.12.6/go.mod h1:Y1VOmit/Fn6Tz1uFAeCO6Q7M2fmfXSCLeL5INVYsLuY=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.6 h1:B8cauxOH1W1v7rd8RdI/MWnoR4Ze0wIHWrb90qczxj4=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.6/go.mod h1:Lh/bc9XUf8CfOY6Jp5aIkQtN+j1mc+nExc+KXj9jx2s=
+github.com/aws/aws-sdk-go-v2/service/sts v1.18.7 h1:bWNgNdRko2x6gqa0blfATqAZKZokPIeM1vfmQt2pnvM=
+github.com/aws/aws-sdk-go-v2/service/sts v1.18.7/go.mod h1:JuTnSoeePXmMVe9G8NcjjwgOKEfZ4cOjMuT2IBT/2eI=
github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8=
github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/aymanbagabas/go-osc52 v1.0.3/go.mod h1:zT8H+Rk4VSabYN90pWyugflM3ZhpTZNC7cASDfUCdT4=
@@ -74,8 +65,8 @@ github.com/bmatcuk/doublestar/v4 v4.6.0 h1:HTuxyug8GyFbRkrffIpzNCSK4luc0TY3wzXvz
github.com/bmatcuk/doublestar/v4 v4.6.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
github.com/bradenhilton/cityhash v1.0.0 h1:1QauDCwfxwIGwO2jBTJdEBqXgfCusAgQOSgdl4RsTMI=
github.com/bradenhilton/cityhash v1.0.0/go.mod h1:Wmb8yW1egA9ulrsRX4mxfYx5zq4nBWOCZ+j63oK6uz8=
-github.com/bradenhilton/mozillainstallhash v1.0.0 h1:QL9byVGb4FrVOI7MubnME3uPNj5R78tqYQPlxuBmXMw=
-github.com/bradenhilton/mozillainstallhash v1.0.0/go.mod h1:yVD0OX1izZHYl1lBm2UDojyE/k0xIqKJK78k+tdWV+k=
+github.com/bradenhilton/mozillainstallhash v1.0.1 h1:JVAVsItiWlLoudJX4L+tIuml+hoxjlzCwkhlENi9yS4=
+github.com/bradenhilton/mozillainstallhash v1.0.1/go.mod h1:J6cA36kUZrgaTkDl2bHRqI+4i2UKO1ImDB1P1x1PyOA=
github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
github.com/bwesterb/go-ristretto v1.2.2 h1:S2C0mmSjCLS3H9+zfXoIoKzl+cOncvBvt6pE+zTm5Ms=
github.com/charmbracelet/bubbles v0.15.0 h1:c5vZ3woHV5W2b8YZI1q7v4ZNQaPetfHuoHzx+56Z6TI=
@@ -123,13 +114,10 @@ github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4x
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
-github.com/go-git/go-billy/v5 v5.4.0/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg=
github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4=
github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg=
github.com/go-git/go-git-fixtures/v4 v4.3.1 h1:y5z6dd3qi8Hl+stezc8p3JxDkoTRqMAlKnXHuzrfjTQ=
github.com/go-git/go-git-fixtures/v4 v4.3.1/go.mod h1:8LHG1a3SRW71ettAD/jW13h8c6AqjVSeL11RAdgaqpo=
-github.com/go-git/go-git/v5 v5.6.0 h1:JvBdYfcttd+0kdpuWO7KTu0FYgCf5W0t5VwkWGobaa4=
-github.com/go-git/go-git/v5 v5.6.0/go.mod h1:6nmJ0tJ3N4noMV1Omv7rC5FG3/o8Cm51TB4CJp7mRmE=
github.com/go-git/go-git/v5 v5.6.1 h1:q4ZRqQl4pR/ZJHc1L5CFjGA1a10u76aV1iC+nh+bHsk=
github.com/go-git/go-git/v5 v5.6.1/go.mod h1:mvyoL6Unz0PiTQrGQfSfiLFhBH1c1e84ylC2MDs4ee8=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
@@ -147,8 +135,6 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
-github.com/google/go-github/v50 v50.1.0 h1:hMUpkZjklC5GJ+c3GquSqOP/T4BNsB7XohaPhtMOzRk=
-github.com/google/go-github/v50 v50.1.0/go.mod h1:Ev4Tre8QoKiolvbpOSG3FIi4Mlon3S2Nt9W5JYqKiwA=
github.com/google/go-github/v50 v50.2.0 h1:j2FyongEHlO9nxXLc+LP3wuBSVU9mVxfpdYUexMpIfk=
github.com/google/go-github/v50 v50.2.0/go.mod h1:VBY8FB6yPIjrtKhozXv4FQupxKLS6H4m6xFZlT43q8Q=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
@@ -167,10 +153,9 @@ github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
-github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
-github.com/imdario/mergo v0.3.14 h1:fOqeC1+nCuuk6PKQdg9YmosXX7Y7mHX6R/0ZldI9iHo=
-github.com/imdario/mergo v0.3.14/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
+github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
+github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
@@ -190,8 +175,6 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
-github.com/klauspost/compress v1.16.0 h1:iULayQNOReoYUe+1qtKOqw9CwJv3aNQu8ivo7lw1HU4=
-github.com/klauspost/compress v1.16.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY=
github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
@@ -213,8 +196,9 @@ github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxec
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
-github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
+github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
+github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
@@ -237,8 +221,6 @@ github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx
github.com/mmcloughlin/avo v0.5.0 h1:nAco9/aI9Lg2kiuROBY6BhCI/z0t5jEvJfjWbL8qXLU=
github.com/mmcloughlin/avo v0.5.0/go.mod h1:ChHFdoV7ql95Wi7vuq2YT1bwCJqiWdZrQ1im3VujLYM=
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b/go.mod h1:fQuZ0gauxyBcmsdE3ZT4NasjaRdxmbCS0jRHsrWu3Ho=
-github.com/muesli/ansi v0.0.0-20230307104941-78d3738a59f2 h1:95KWtCWqE5TaDGV9kDxSSvuXGGHIZ0FQsr9jHLllfzM=
-github.com/muesli/ansi v0.0.0-20230307104941-78d3738a59f2/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
@@ -357,12 +339,11 @@ golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
-golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0 h1:LGJsf5LRplCck6jUCH3dBL2dmycNruWNF5xugkSlfXw=
-golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
-golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 h1:pVgRXcIictcr+lBQIFeiwuwtDIs4eL21OuM9nyAADmo=
-golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
+golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
+golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI=
+golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
@@ -431,6 +412,7 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
+golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -440,8 +422,6 @@ google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
-google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM=
-google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
chore
|
Update dependencies
|
e17e2ffca6401b26af55c2115fd5f85acc720eb9
|
2023-06-15 05:21:43
|
Tom Payne
|
chore: Break long lines with segmentio/golines
| false
|
diff --git a/.gitignore b/.gitignore
index 8fe9dc1cd95..d18ad32645d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
/COMMIT
/bin/chezmoi
/bin/gofumpt
+/bin/golines
/bin/golangci-lint
/bin/goversioninfo
/chezmoi
diff --git a/.golangci.yml b/.golangci.yml
index 2198282c276..f0395a6830d 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -40,7 +40,6 @@ linters:
- ineffassign
- interfacebloat
- ireturn
- - lll
- loggercheck
- makezero
- misspell
@@ -87,6 +86,7 @@ linters:
- goheader
- gomnd
- gomoddirectives
+ - lll
- maintidx
- maligned
- nakedret
@@ -164,13 +164,8 @@ issues:
- linters:
- forbidigo
- gosec
- - lll
path: ^internal/cmds/
- linters:
- forcetypeassert
- gosec
- - lll
path: _test\.go$
- - linters:
- - lll
- path: ^pkg/shell/shellcgo\.go$
diff --git a/Makefile b/Makefile
index 2257f51d28f..11e475100c2 100644
--- a/Makefile
+++ b/Makefile
@@ -113,8 +113,8 @@ lint: ensure-golangci-lint
find . -name \*.txtar | xargs ${GO} run ./internal/cmds/lint-txtar
.PHONY: format
-format: ensure-gofumpt
- find . -name \*.go | xargs ./bin/gofumpt -extra -w
+format: ensure-gofumpt ensure-golines
+ find . -name \*.go | xargs ./bin/golines --base-formatter="./bin/gofumpt -extra" -w
find . -name \*.txtar | xargs ${GO} run ./internal/cmds/lint-txtar -w
.PHONY: format-yaml
@@ -136,6 +136,13 @@ ensure-gofumpt:
GOBIN=$(shell pwd)/bin ${GO} install "mvdan.cc/gofumpt@v${GOFUMPT_VERSION}" ; \
fi
+.PHONY: ensure-golines
+ensure-golines:
+ if [ ! -x bin/golines ] ; then \
+ mkdir -p bin ; \
+ GOBIN=$(shell pwd)/bin ${GO} install github.com/segmentio/golines@latest ; \
+ fi
+
.PHONY: ensure-golangci-lint
ensure-golangci-lint:
if [ ! -x bin/golangci-lint ] || ( ./bin/golangci-lint version | grep -Fqv "version ${GOLANGCI_LINT_VERSION}" ) ; then \
diff --git a/go.sum b/go.sum
index bc78d3055fc..26bce4ac4f8 100644
--- a/go.sum
+++ b/go.sum
@@ -1,7 +1,9 @@
cloud.google.com/go/compute/metadata v0.2.0 h1:nBbNSZyDpkNlo3DepaaLKVuO7ClyifSAmNloSCZrHnQ=
+cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k=
filippo.io/age v1.1.1 h1:pIpO7l151hCnQ4BdyBujnGP2YlUo0uj6sAVNHGBvXHg=
filippo.io/age v1.1.1/go.mod h1:l03SrzDUrBkdBx8+IILdnn2KZysqQdbEBUQ4p3sqEQE=
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
+filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
@@ -27,7 +29,9 @@ github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW5
github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0=
github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30=
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
+github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
+github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
github.com/aws/aws-sdk-go-v2 v1.18.0 h1:882kkTpSFhdgYRKVZ/VCgf7sd0ru57p2JCxz4/oN5RY=
@@ -95,6 +99,7 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHH
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
+github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE=
github.com/danieljoos/wincred v1.2.0/go.mod h1:FzQLLMKBFdvu+osBrnFODiv32YGwCfx0SkRa/eYHgec=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -106,17 +111,21 @@ github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cn
github.com/dustin/gojson v0.0.0-20160307161227-2e71ec9dd5ad h1:Qk76DOWdOp+GlyDKBAG3Klr9cn7N+LcYc82AZ2S7+cA=
github.com/dustin/gojson v0.0.0-20160307161227-2e71ec9dd5ad/go.mod h1:mPKfmRa823oBIgl2r20LeMSpTAteW5j7FLkc0vjmzyQ=
github.com/elazarl/goproxy v0.0.0-20221015165544-a0805db90819 h1:RIB4cRk+lBqKK3Oy0r2gRX4ui7tuhiZq2SuTtTCi0/0=
+github.com/elazarl/goproxy v0.0.0-20221015165544-a0805db90819/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM=
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
+github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY=
+github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4=
github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f h1:Pz0DHeFij3XFhoBRGUDPzSJ+w2UcK5/0JvF8DRI58r8=
+github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f/go.mod h1:8LHG1a3SRW71ettAD/jW13h8c6AqjVSeL11RAdgaqpo=
github.com/go-git/go-git/v5 v5.7.0 h1:t9AudWVLmqzlo+4bqdf7GY+46SUuRsx59SboFxkq2aE=
github.com/go-git/go-git/v5 v5.7.0/go.mod h1:coJHKEOk5kUClpsNlXrUvPrDxY3w3gjHvhcZd8Fodw8=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
@@ -125,6 +134,7 @@ github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
+github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
@@ -135,6 +145,7 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
+github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github/v52 v52.0.0 h1:uyGWOY+jMQ8GVGSX8dkSwCzlehU3WfdxQ7GweO/JP7M=
github.com/google/go-github/v52 v52.0.0/go.mod h1:WJV6VEEUPuMo5pXqqa2ZCZEdbQqua4zAk2MZTIo+m+4=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
@@ -145,6 +156,7 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0=
+github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 h1:+ngKgrYPPJrOjhax5N+uePQ0Fh1Z7PheYoUI/0nzkPA=
@@ -167,11 +179,13 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOl
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
+github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
+github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI=
@@ -179,6 +193,7 @@ github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQs
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
+github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
@@ -218,6 +233,7 @@ github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/mmcloughlin/avo v0.5.0 h1:nAco9/aI9Lg2kiuROBY6BhCI/z0t5jEvJfjWbL8qXLU=
+github.com/mmcloughlin/avo v0.5.0/go.mod h1:ChHFdoV7ql95Wi7vuq2YT1bwCJqiWdZrQ1im3VujLYM=
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b/go.mod h1:fQuZ0gauxyBcmsdE3ZT4NasjaRdxmbCS0jRHsrWu3Ho=
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
@@ -244,6 +260,7 @@ github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=
+github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -268,12 +285,16 @@ github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
+github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
+github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/skeema/knownhosts v1.1.1 h1:MTk78x9FPgDFVFkDLTrsnnfCJl7g1C/nnKvePgrIngE=
github.com/skeema/knownhosts v1.1.1/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo=
github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w=
+github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
+github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA=
github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48=
@@ -304,6 +325,7 @@ github.com/twpayne/go-xdg/v6 v6.1.1/go.mod h1:+0KSJ4Dx+xaZeDXWZITF84BcNc1UiHDm0D
github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA=
+github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1 h1:+dBg5k7nuTE38VVdoroRsT0Z88fmvdYrI2EjzJst35I=
github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1/go.mod h1:nmuySobZb4kFgFy6BptpXp/BBw+xFSyvVPP6auoJB4k=
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
@@ -320,7 +342,9 @@ github.com/zalando/go-keyring v0.2.3/go.mod h1:HL4k+OXQfJUWaMnqyuSOc0drfGPX2b51D
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
go.etcd.io/gofail v0.1.0 h1:XItAMIhOojXFQMgrxjnd2EIIHun/d5qL0Pf7FzVTkFg=
+go.etcd.io/gofail v0.1.0/go.mod h1:VZBCXYGZhHAinaBiiqYvuDynvahNsAyLFwB3kEHKz1M=
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
+go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@@ -430,5 +454,6 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM=
howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
mvdan.cc/editorconfig v0.2.0 h1:XL+7ys6ls/RKrkUNFQvEwIvNHh+JKx8Mj1pUV5wQxQE=
+mvdan.cc/editorconfig v0.2.0/go.mod h1:lvnnD3BNdBYkhq+B4uBuFFKatfp02eB6HixDvEz91C0=
mvdan.cc/sh/v3 v3.6.0 h1:gtva4EXJ0dFNvl5bHjcUEvws+KRcDslT8VKheTYkbGU=
mvdan.cc/sh/v3 v3.6.0/go.mod h1:U4mhtBLZ32iWhif5/lD+ygy1zrgaQhUu+XFy7C8+TTA=
diff --git a/internal/cmds/execute-template/main.go b/internal/cmds/execute-template/main.go
index 0591d83c9b5..fed8246ca56 100644
--- a/internal/cmds/execute-template/main.go
+++ b/internal/cmds/execute-template/main.go
@@ -51,7 +51,12 @@ func (c *gitHubClient) gitHubListReleases(ownerRepo string) []*github.Repository
PerPage: 100,
}
for {
- repositoryReleases, resp, err := c.client.Repositories.ListReleases(c.ctx, owner, repo, opts)
+ repositoryReleases, resp, err := c.client.Repositories.ListReleases(
+ c.ctx,
+ owner,
+ repo,
+ opts,
+ )
if err != nil {
panic(err)
}
diff --git a/internal/cmds/generate-install.sh/main.go b/internal/cmds/generate-install.sh/main.go
index aa2e4bf6326..5029760f6f2 100644
--- a/internal/cmds/generate-install.sh/main.go
+++ b/internal/cmds/generate-install.sh/main.go
@@ -116,7 +116,9 @@ func run() error {
})
// Generate install.sh.
- installShTemplate, err := template.ParseFiles("internal/cmds/generate-install.sh/install.sh.tmpl")
+ installShTemplate, err := template.ParseFiles(
+ "internal/cmds/generate-install.sh/install.sh.tmpl",
+ )
if err != nil {
return err
}
diff --git a/internal/cmds/lint-whitespace/main.go b/internal/cmds/lint-whitespace/main.go
index 37946bc302b..049daaa45ff 100644
--- a/internal/cmds/lint-whitespace/main.go
+++ b/internal/cmds/lint-whitespace/main.go
@@ -40,14 +40,27 @@ func lintData(filename string, data []byte) error {
for i, line := range lines {
switch {
case crlfLineEndingRx.Match(line):
- err = multierr.Append(err, fmt.Errorf("::error file=%s,line=%d::CRLF line ending", filename, i+1))
+ err = multierr.Append(
+ err,
+ fmt.Errorf("::error file=%s,line=%d::CRLF line ending", filename, i+1),
+ )
case trailingWhitespaceRx.Match(line):
- err = multierr.Append(err, fmt.Errorf("::error file=%s,line=%d::trailing whitespace", filename, i+1))
+ err = multierr.Append(
+ err,
+ fmt.Errorf("::error file=%s,line=%d::trailing whitespace", filename, i+1),
+ )
}
}
if len(data) > 0 && len(lines[len(lines)-1]) != 0 {
- err = multierr.Append(err, fmt.Errorf("::error file=%s,line=%d::no newline at end of file", filename, len(lines)+1))
+ err = multierr.Append(
+ err,
+ fmt.Errorf(
+ "::error file=%s,line=%d::no newline at end of file",
+ filename,
+ len(lines)+1,
+ ),
+ )
}
return err
diff --git a/pkg/chezmoi/actualstateentry.go b/pkg/chezmoi/actualstateentry.go
index 131e3cb43d6..340f9bfed36 100644
--- a/pkg/chezmoi/actualstateentry.go
+++ b/pkg/chezmoi/actualstateentry.go
@@ -40,7 +40,12 @@ type ActualStateSymlink struct {
// NewActualStateEntry returns a new ActualStateEntry populated with absPath
// from system.
-func NewActualStateEntry(system System, absPath AbsPath, fileInfo fs.FileInfo, err error) (ActualStateEntry, error) {
+func NewActualStateEntry(
+ system System,
+ absPath AbsPath,
+ fileInfo fs.FileInfo,
+ err error,
+) (ActualStateEntry, error) {
if fileInfo == nil {
fileInfo, err = system.Lstat(absPath)
}
diff --git a/pkg/chezmoi/ageencryption.go b/pkg/chezmoi/ageencryption.go
index 486afad24db..c53d3928264 100644
--- a/pkg/chezmoi/ageencryption.go
+++ b/pkg/chezmoi/ageencryption.go
@@ -19,18 +19,18 @@ import (
// An AgeEncryption uses age for encryption and decryption. See
// https://age-encryption.org.
type AgeEncryption struct {
- UseBuiltin bool `json:"useBuiltin" mapstructure:"useBuiltin" yaml:"useBuiltin"`
- Command string `json:"command" mapstructure:"command" yaml:"command"`
- Args []string `json:"args" mapstructure:"args" yaml:"args"`
- Identity AbsPath `json:"identity" mapstructure:"identity" yaml:"identity"`
- Identities []AbsPath `json:"identities" mapstructure:"identities" yaml:"identities"`
- Passphrase bool `json:"passphrase" mapstructure:"passphrase" yaml:"passphrase"`
- Recipient string `json:"recipient" mapstructure:"recipient" yaml:"recipient"`
- Recipients []string `json:"recipients" mapstructure:"recipients" yaml:"recipients"`
- RecipientsFile AbsPath `json:"recipientsFile" mapstructure:"recipientsFile" yaml:"recipientsFile"`
+ UseBuiltin bool `json:"useBuiltin" mapstructure:"useBuiltin" yaml:"useBuiltin"`
+ Command string `json:"command" mapstructure:"command" yaml:"command"`
+ Args []string `json:"args" mapstructure:"args" yaml:"args"`
+ Identity AbsPath `json:"identity" mapstructure:"identity" yaml:"identity"`
+ Identities []AbsPath `json:"identities" mapstructure:"identities" yaml:"identities"`
+ Passphrase bool `json:"passphrase" mapstructure:"passphrase" yaml:"passphrase"`
+ Recipient string `json:"recipient" mapstructure:"recipient" yaml:"recipient"`
+ Recipients []string `json:"recipients" mapstructure:"recipients" yaml:"recipients"`
+ RecipientsFile AbsPath `json:"recipientsFile" mapstructure:"recipientsFile" yaml:"recipientsFile"`
RecipientsFiles []AbsPath `json:"recipientsFiles" mapstructure:"recipientsFiles" yaml:"recipientsFiles"`
- Suffix string `json:"suffix" mapstructure:"suffix" yaml:"suffix"`
- Symmetric bool `json:"symmetric" mapstructure:"symmetric" yaml:"symmetric"`
+ Suffix string `json:"suffix" mapstructure:"suffix" yaml:"suffix"`
+ Symmetric bool `json:"symmetric" mapstructure:"symmetric" yaml:"symmetric"`
}
// Decrypt implements Encryption.Decrypt.
@@ -84,7 +84,9 @@ func (e *AgeEncryption) EncryptFile(plaintextAbsPath AbsPath) ([]byte, error) {
return e.builtinEncrypt(plaintext)
}
- cmd := exec.Command(e.Command, append(append(e.encryptArgs(), e.Args...), plaintextAbsPath.String())...) //nolint:gosec
+ cmd := exec.Command( //nolint:gosec
+ e.Command,
+ append(append(e.encryptArgs(), e.Args...), plaintextAbsPath.String())...)
cmd.Stderr = os.Stderr
return chezmoilog.LogCmdOutput(cmd)
}
diff --git a/pkg/chezmoi/archivereadersystem_test.go b/pkg/chezmoi/archivereadersystem_test.go
index 940a3a53219..245e44484ca 100644
--- a/pkg/chezmoi/archivereadersystem_test.go
+++ b/pkg/chezmoi/archivereadersystem_test.go
@@ -21,10 +21,15 @@ func TestArchiveReaderSystemTar(t *testing.T) {
})
assert.NoError(t, err)
- archiveReaderSystem, err := NewArchiveReaderSystem("archive.tar", data, ArchiveFormatTar, ArchiveReaderSystemOptions{
- RootAbsPath: NewAbsPath("/home/user"),
- StripComponents: 1,
- })
+ archiveReaderSystem, err := NewArchiveReaderSystem(
+ "archive.tar",
+ data,
+ ArchiveFormatTar,
+ ArchiveReaderSystemOptions{
+ RootAbsPath: NewAbsPath("/home/user"),
+ StripComponents: 1,
+ },
+ )
assert.NoError(t, err)
for _, tc := range []struct {
diff --git a/pkg/chezmoi/attr_test.go b/pkg/chezmoi/attr_test.go
index de56aad8240..11c7530becc 100644
--- a/pkg/chezmoi/attr_test.go
+++ b/pkg/chezmoi/attr_test.go
@@ -170,8 +170,12 @@ func TestFileAttr(t *testing.T) {
TargetName []string
Order []ScriptOrder
}{
- Type: SourceFileTypeScript,
- Condition: []ScriptCondition{ScriptConditionAlways, ScriptConditionOnce, ScriptConditionOnChange},
+ Type: SourceFileTypeScript,
+ Condition: []ScriptCondition{
+ ScriptConditionAlways,
+ ScriptConditionOnce,
+ ScriptConditionOnChange,
+ },
TargetName: targetNames,
Order: []ScriptOrder{ScriptOrderBefore, ScriptOrderDuring, ScriptOrderAfter},
}))
diff --git a/pkg/chezmoi/boltpersistentstate.go b/pkg/chezmoi/boltpersistentstate.go
index c2966d269e1..08c00c2f700 100644
--- a/pkg/chezmoi/boltpersistentstate.go
+++ b/pkg/chezmoi/boltpersistentstate.go
@@ -31,7 +31,11 @@ type BoltPersistentState struct {
}
// NewBoltPersistentState returns a new BoltPersistentState.
-func NewBoltPersistentState(system System, path AbsPath, mode BoltPersistentStateMode) (*BoltPersistentState, error) {
+func NewBoltPersistentState(
+ system System,
+ path AbsPath,
+ mode BoltPersistentStateMode,
+) (*BoltPersistentState, error) {
empty := false
switch _, err := system.Stat(path); {
case errors.Is(err, fs.ErrNotExist):
diff --git a/pkg/chezmoi/boltpersistentstate_test.go b/pkg/chezmoi/boltpersistentstate_test.go
index d76e986008d..4833a620fb2 100644
--- a/pkg/chezmoi/boltpersistentstate_test.go
+++ b/pkg/chezmoi/boltpersistentstate_test.go
@@ -140,7 +140,11 @@ func TestBoltPersistentStateGeneric(t *testing.T) {
testPersistentState(t, func() PersistentState {
tempDir, err := os.MkdirTemp("", "chezmoi-test")
assert.NoError(t, err)
- b, err := NewBoltPersistentState(system, NewAbsPath(tempDir).JoinString("chezmoistate.boltdb"), BoltPersistentStateReadWrite)
+ b, err := NewBoltPersistentState(
+ system,
+ NewAbsPath(tempDir).JoinString("chezmoistate.boltdb"),
+ BoltPersistentStateReadWrite,
+ )
assert.NoError(t, err)
return b
})
diff --git a/pkg/chezmoi/chezmoi.go b/pkg/chezmoi/chezmoi.go
index d2c2bba1ca0..be953371872 100644
--- a/pkg/chezmoi/chezmoi.go
+++ b/pkg/chezmoi/chezmoi.go
@@ -147,7 +147,8 @@ func FQDNHostname(fileSystem vfs.FS) (string, error) {
// Otherwise, if we're on OpenBSD, try /etc/myname.
if runtime.GOOS == "openbsd" {
- if fqdnHostname, err := etcMynameFQDNHostname(fileSystem); err == nil && fqdnHostname != "" {
+ if fqdnHostname, err := etcMynameFQDNHostname(fileSystem); err == nil &&
+ fqdnHostname != "" {
return fqdnHostname, nil
}
}
@@ -208,7 +209,9 @@ func SuspiciousSourceDirEntry(base string, fileInfo fs.FileInfo, encryptedSuffix
return true
}
for _, encryptedSuffix := range encryptedSuffixes {
- if fileAttr := parseFileAttr(fileInfo.Name(), encryptedSuffix); knownTargetFiles.contains(fileAttr.TargetName) {
+ if fileAttr := parseFileAttr(fileInfo.Name(), encryptedSuffix); knownTargetFiles.contains(
+ fileAttr.TargetName,
+ ) {
return true
}
}
diff --git a/pkg/chezmoi/debugpersistentstate.go b/pkg/chezmoi/debugpersistentstate.go
index b877e38ed66..41e02478e28 100644
--- a/pkg/chezmoi/debugpersistentstate.go
+++ b/pkg/chezmoi/debugpersistentstate.go
@@ -12,7 +12,10 @@ type DebugPersistentState struct {
// NewDebugPersistentState returns a new debugPersistentState that logs methods
// on persistentState to logger.
-func NewDebugPersistentState(persistentState PersistentState, logger *zerolog.Logger) *DebugPersistentState {
+func NewDebugPersistentState(
+ persistentState PersistentState,
+ logger *zerolog.Logger,
+) *DebugPersistentState {
return &DebugPersistentState{
logger: logger,
persistentState: persistentState,
diff --git a/pkg/chezmoi/debugsystem.go b/pkg/chezmoi/debugsystem.go
index 9cb661aebf1..8d97c6478c2 100644
--- a/pkg/chezmoi/debugsystem.go
+++ b/pkg/chezmoi/debugsystem.go
@@ -159,7 +159,12 @@ func (s *DebugSystem) RunCmd(cmd *exec.Cmd) error {
}
// RunScript implements System.RunScript.
-func (s *DebugSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, options RunScriptOptions) error {
+func (s *DebugSystem) RunScript(
+ scriptname RelPath,
+ dir AbsPath,
+ data []byte,
+ options RunScriptOptions,
+) error {
err := s.system.RunScript(scriptname, dir, data, options)
s.logger.Err(err).
Stringer("scriptname", scriptname).
diff --git a/pkg/chezmoi/dryrunsystem.go b/pkg/chezmoi/dryrunsystem.go
index 51cf6ba36b7..fd0aac4d922 100644
--- a/pkg/chezmoi/dryrunsystem.go
+++ b/pkg/chezmoi/dryrunsystem.go
@@ -107,7 +107,12 @@ func (s *DryRunSystem) RunCmd(cmd *exec.Cmd) error {
}
// RunScript implements System.RunScript.
-func (s *DryRunSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, options RunScriptOptions) error {
+func (s *DryRunSystem) RunScript(
+ scriptname RelPath,
+ dir AbsPath,
+ data []byte,
+ options RunScriptOptions,
+) error {
s.setModified()
return nil
}
diff --git a/pkg/chezmoi/dumpsystem.go b/pkg/chezmoi/dumpsystem.go
index 3e316d6ed3e..44d31491f95 100644
--- a/pkg/chezmoi/dumpsystem.go
+++ b/pkg/chezmoi/dumpsystem.go
@@ -42,25 +42,25 @@ type dirData struct {
// A fileData contains data about a file.
type fileData struct {
- Type dataType `json:"type" yaml:"type"`
- Name AbsPath `json:"name" yaml:"name"`
+ Type dataType `json:"type" yaml:"type"`
+ Name AbsPath `json:"name" yaml:"name"`
Contents string `json:"contents" yaml:"contents"`
- Perm fs.FileMode `json:"perm" yaml:"perm"`
+ Perm fs.FileMode `json:"perm" yaml:"perm"`
}
// A scriptData contains data about a script.
type scriptData struct {
- Type dataType `json:"type" yaml:"type"`
- Name AbsPath `json:"name" yaml:"name"`
- Contents string `json:"contents" yaml:"contents"`
- Condition string `json:"condition" yaml:"condition"`
+ Type dataType `json:"type" yaml:"type"`
+ Name AbsPath `json:"name" yaml:"name"`
+ Contents string `json:"contents" yaml:"contents"`
+ Condition string `json:"condition" yaml:"condition"`
Interpreter *Interpreter `json:"interpreter,omitempty" yaml:"interpreter,omitempty"`
}
// A symlinkData contains data about a symlink.
type symlinkData struct {
- Type dataType `json:"type" yaml:"type"`
- Name AbsPath `json:"name" yaml:"name"`
+ Type dataType `json:"type" yaml:"type"`
+ Name AbsPath `json:"name" yaml:"name"`
Linkname string `json:"linkname" yaml:"linkname"`
}
@@ -98,7 +98,12 @@ func (s *DumpSystem) RunCmd(cmd *exec.Cmd) error {
}
// RunScript implements System.RunScript.
-func (s *DumpSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, options RunScriptOptions) error {
+func (s *DumpSystem) RunScript(
+ scriptname RelPath,
+ dir AbsPath,
+ data []byte,
+ options RunScriptOptions,
+) error {
scriptnameStr := scriptname.String()
scriptData := &scriptData{
Type: dataTypeScript,
diff --git a/pkg/chezmoi/dumpsystem_test.go b/pkg/chezmoi/dumpsystem_test.go
index a35f06488ce..b7fa98b08f1 100644
--- a/pkg/chezmoi/dumpsystem_test.go
+++ b/pkg/chezmoi/dumpsystem_test.go
@@ -49,9 +49,12 @@ func TestDumpSystem(t *testing.T) {
dumpSystem := NewDumpSystem()
persistentState := NewMockPersistentState()
- assert.NoError(t, s.applyAll(dumpSystem, system, persistentState, EmptyAbsPath, ApplyOptions{
- Filter: NewEntryTypeFilter(EntryTypesAll, EntryTypesNone),
- }))
+ assert.NoError(
+ t,
+ s.applyAll(dumpSystem, system, persistentState, EmptyAbsPath, ApplyOptions{
+ Filter: NewEntryTypeFilter(EntryTypesAll, EntryTypesNone),
+ }),
+ )
expectedData := map[string]any{
".dir": &dirData{
Type: dataTypeDir,
diff --git a/pkg/chezmoi/entrystate.go b/pkg/chezmoi/entrystate.go
index 49c46c2e430..9479dc51550 100644
--- a/pkg/chezmoi/entrystate.go
+++ b/pkg/chezmoi/entrystate.go
@@ -25,8 +25,8 @@ const (
// An EntryState represents the state of an entry. A nil EntryState is
// equivalent to EntryStateTypeAbsent.
type EntryState struct {
- Type EntryStateType `json:"type" yaml:"type"`
- Mode fs.FileMode `json:"mode,omitempty" yaml:"mode,omitempty"`
+ Type EntryStateType `json:"type" yaml:"type"`
+ Mode fs.FileMode `json:"mode,omitempty" yaml:"mode,omitempty"`
ContentsSHA256 HexBytes `json:"contentsSHA256,omitempty" yaml:"contentsSHA256,omitempty"` //nolint:tagliatelle
contents []byte
overwrite bool
diff --git a/pkg/chezmoi/entrytypefilter.go b/pkg/chezmoi/entrytypefilter.go
index d63f9d0f92c..a03e8dcd122 100644
--- a/pkg/chezmoi/entrytypefilter.go
+++ b/pkg/chezmoi/entrytypefilter.go
@@ -21,7 +21,8 @@ func NewEntryTypeFilter(includeEntryTypeBits, excludeEntryTypeBits EntryTypeBits
// IncludeEntryTypeBits returns if entryTypeBits is included.
func (f *EntryTypeFilter) IncludeEntryTypeBits(entryTypeBits EntryTypeBits) bool {
- return f.Include.ContainsEntryTypeBits(entryTypeBits) && !f.Exclude.ContainsEntryTypeBits(entryTypeBits)
+ return f.Include.ContainsEntryTypeBits(entryTypeBits) &&
+ !f.Exclude.ContainsEntryTypeBits(entryTypeBits)
}
// IncludeFileInfo returns if fileInfo is included.
@@ -31,10 +32,12 @@ func (f *EntryTypeFilter) IncludeFileInfo(fileInfo fs.FileInfo) bool {
// IncludeSourceStateEntry returns if sourceStateEntry is included.
func (f *EntryTypeFilter) IncludeSourceStateEntry(sourceStateEntry SourceStateEntry) bool {
- return f.Include.ContainsSourceStateEntry(sourceStateEntry) && !f.Exclude.ContainsSourceStateEntry(sourceStateEntry)
+ return f.Include.ContainsSourceStateEntry(sourceStateEntry) &&
+ !f.Exclude.ContainsSourceStateEntry(sourceStateEntry)
}
// IncludeTargetStateEntry returns if targetStateEntry is included.
func (f *EntryTypeFilter) IncludeTargetStateEntry(targetStateEntry TargetStateEntry) bool {
- return f.Include.ContainsTargetStateEntry(targetStateEntry) && !f.Exclude.ContainsTargetStateEntry(targetStateEntry)
+ return f.Include.ContainsTargetStateEntry(targetStateEntry) &&
+ !f.Exclude.ContainsTargetStateEntry(targetStateEntry)
}
diff --git a/pkg/chezmoi/entrytypeset_test.go b/pkg/chezmoi/entrytypeset_test.go
index cb1e6e21ec9..dfb08aace6c 100644
--- a/pkg/chezmoi/entrytypeset_test.go
+++ b/pkg/chezmoi/entrytypeset_test.go
@@ -149,9 +149,17 @@ func TestEntryTypeSetFlagCompletionFunc(t *testing.T) {
},
} {
t.Run(tc.toComplete, func(t *testing.T) {
- completions, shellCompDirective := EntryTypeSetFlagCompletionFunc(nil, nil, tc.toComplete)
+ completions, shellCompDirective := EntryTypeSetFlagCompletionFunc(
+ nil,
+ nil,
+ tc.toComplete,
+ )
assert.Equal(t, tc.expectedCompletions, completions)
- assert.Equal(t, cobra.ShellCompDirectiveNoSpace|cobra.ShellCompDirectiveNoFileComp, shellCompDirective)
+ assert.Equal(
+ t,
+ cobra.ShellCompDirectiveNoSpace|cobra.ShellCompDirectiveNoFileComp,
+ shellCompDirective,
+ )
})
}
}
diff --git a/pkg/chezmoi/erroronwritesystem.go b/pkg/chezmoi/erroronwritesystem.go
index 59ba2cf45ff..94dc3f04271 100644
--- a/pkg/chezmoi/erroronwritesystem.go
+++ b/pkg/chezmoi/erroronwritesystem.go
@@ -95,7 +95,12 @@ func (s *ErrorOnWriteSystem) RunCmd(cmd *exec.Cmd) error {
}
// RunScript implements System.RunScript.
-func (s *ErrorOnWriteSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, options RunScriptOptions) error {
+func (s *ErrorOnWriteSystem) RunScript(
+ scriptname RelPath,
+ dir AbsPath,
+ data []byte,
+ options RunScriptOptions,
+) error {
return s.err
}
diff --git a/pkg/chezmoi/errors.go b/pkg/chezmoi/errors.go
index 1b459d09935..38057ca4879 100644
--- a/pkg/chezmoi/errors.go
+++ b/pkg/chezmoi/errors.go
@@ -24,7 +24,11 @@ type TooOldError struct {
}
func (e *TooOldError) Error() string {
- return fmt.Sprintf("source state requires chezmoi version %s or later, chezmoi is version %s", e.Need, e.Have)
+ return fmt.Sprintf(
+ "source state requires chezmoi version %s or later, chezmoi is version %s",
+ e.Need,
+ e.Have,
+ )
}
type inconsistentStateError struct {
@@ -33,7 +37,11 @@ type inconsistentStateError struct {
}
func (e *inconsistentStateError) Error() string {
- return fmt.Sprintf("%s: inconsistent state (%s)", e.targetRelPath, strings.Join(e.origins, ", "))
+ return fmt.Sprintf(
+ "%s: inconsistent state (%s)",
+ e.targetRelPath,
+ strings.Join(e.origins, ", "),
+ )
}
type NotInAbsDirError struct {
diff --git a/pkg/chezmoi/externaldiffsystem.go b/pkg/chezmoi/externaldiffsystem.go
index b2d53077613..70fc089fdc6 100644
--- a/pkg/chezmoi/externaldiffsystem.go
+++ b/pkg/chezmoi/externaldiffsystem.go
@@ -38,7 +38,11 @@ type ExternalDiffSystemOptions struct {
// NewExternalDiffSystem creates a new ExternalDiffSystem.
func NewExternalDiffSystem(
- system System, command string, args []string, destDirAbsPath AbsPath, options *ExternalDiffSystemOptions,
+ system System,
+ command string,
+ args []string,
+ destDirAbsPath AbsPath,
+ options *ExternalDiffSystemOptions,
) *ExternalDiffSystem {
return &ExternalDiffSystem{
system: system,
@@ -54,7 +58,8 @@ func NewExternalDiffSystem(
// Close frees all resources held by s.
func (s *ExternalDiffSystem) Close() error {
if !s.tempDirAbsPath.Empty() {
- if err := os.RemoveAll(s.tempDirAbsPath.String()); err != nil && !errors.Is(err, fs.ErrNotExist) {
+ if err := os.RemoveAll(s.tempDirAbsPath.String()); err != nil &&
+ !errors.Is(err, fs.ErrNotExist) {
return err
}
s.tempDirAbsPath = EmptyAbsPath
@@ -177,7 +182,12 @@ func (s *ExternalDiffSystem) RunCmd(cmd *exec.Cmd) error {
}
// RunScript implements System.RunScript.
-func (s *ExternalDiffSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, options RunScriptOptions) error {
+func (s *ExternalDiffSystem) RunScript(
+ scriptname RelPath,
+ dir AbsPath,
+ data []byte,
+ options RunScriptOptions,
+) error {
bits := EntryTypeScripts
if options.Condition == ScriptConditionAlways {
bits |= EntryTypeAlways
diff --git a/pkg/chezmoi/gitdiffsystem.go b/pkg/chezmoi/gitdiffsystem.go
index 81e5c68b1e2..6e6bfc7468c 100644
--- a/pkg/chezmoi/gitdiffsystem.go
+++ b/pkg/chezmoi/gitdiffsystem.go
@@ -41,7 +41,12 @@ type GitDiffSystemOptions struct {
// NewGitDiffSystem returns a new GitDiffSystem. Output is written to w, the
// dirAbsPath is stripped from paths, and color controls whether the output
// contains ANSI color escape sequences.
-func NewGitDiffSystem(system System, w io.Writer, dirAbsPath AbsPath, options *GitDiffSystemOptions) *GitDiffSystem {
+func NewGitDiffSystem(
+ system System,
+ w io.Writer,
+ dirAbsPath AbsPath,
+ options *GitDiffSystemOptions,
+) *GitDiffSystem {
unifiedEncoder := diff.NewUnifiedEncoder(w, diff.DefaultContextLines)
if options.Color {
unifiedEncoder.SetColor(diff.NewColorConfig())
@@ -201,7 +206,12 @@ func (s *GitDiffSystem) RunCmd(cmd *exec.Cmd) error {
}
// RunScript implements System.RunScript.
-func (s *GitDiffSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, options RunScriptOptions) error {
+func (s *GitDiffSystem) RunScript(
+ scriptname RelPath,
+ dir AbsPath,
+ data []byte,
+ options RunScriptOptions,
+) error {
bits := EntryTypeScripts
if options.Condition == ScriptConditionAlways {
bits |= EntryTypeAlways
diff --git a/pkg/chezmoi/gpgencryption.go b/pkg/chezmoi/gpgencryption.go
index 874ce03dcbb..5c21c8c4368 100644
--- a/pkg/chezmoi/gpgencryption.go
+++ b/pkg/chezmoi/gpgencryption.go
@@ -12,12 +12,12 @@ import (
// A GPGEncryption uses gpg for encryption and decryption. See https://gnupg.org/.
type GPGEncryption struct {
- Command string `json:"command" mapstructure:"command" yaml:"command"`
- Args []string `json:"args" mapstructure:"args" yaml:"args"`
- Recipient string `json:"recipient" mapstructure:"recipient" yaml:"recipient"`
+ Command string `json:"command" mapstructure:"command" yaml:"command"`
+ Args []string `json:"args" mapstructure:"args" yaml:"args"`
+ Recipient string `json:"recipient" mapstructure:"recipient" yaml:"recipient"`
Recipients []string `json:"recipients" mapstructure:"recipients" yaml:"recipients"`
- Symmetric bool `json:"symmetric" mapstructure:"symmetric" yaml:"symmetric"`
- Suffix string `json:"suffix" mapstructure:"suffix" yaml:"suffix"`
+ Symmetric bool `json:"symmetric" mapstructure:"symmetric" yaml:"symmetric"`
+ Suffix string `json:"suffix" mapstructure:"suffix" yaml:"suffix"`
}
// Decrypt implements Encryption.Decrypt.
diff --git a/pkg/chezmoi/realsystem.go b/pkg/chezmoi/realsystem.go
index b1cc6630251..2ab94789979 100644
--- a/pkg/chezmoi/realsystem.go
+++ b/pkg/chezmoi/realsystem.go
@@ -83,7 +83,12 @@ func (s *RealSystem) RunCmd(cmd *exec.Cmd) error {
}
// RunScript implements System.RunScript.
-func (s *RealSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, options RunScriptOptions) (err error) {
+func (s *RealSystem) RunScript(
+ scriptname RelPath,
+ dir AbsPath,
+ data []byte,
+ options RunScriptOptions,
+) (err error) {
// Create the script temporary directory, if needed.
s.createScriptTempDirOnce.Do(func() {
if !s.scriptTempDir.Empty() {
diff --git a/pkg/chezmoi/realsystem_unix.go b/pkg/chezmoi/realsystem_unix.go
index 375ff019908..bc2c7a7849b 100644
--- a/pkg/chezmoi/realsystem_unix.go
+++ b/pkg/chezmoi/realsystem_unix.go
@@ -116,7 +116,8 @@ func (s *RealSystem) WriteSymlink(oldname string, newname AbsPath) error {
if s.safe && s.fileSystem == vfs.OSFS {
return renameio.Symlink(oldname, newname.String())
}
- if err := s.fileSystem.RemoveAll(newname.String()); err != nil && !errors.Is(err, fs.ErrNotExist) {
+ if err := s.fileSystem.RemoveAll(newname.String()); err != nil &&
+ !errors.Is(err, fs.ErrNotExist) {
return err
}
return s.fileSystem.Symlink(oldname, newname.String())
diff --git a/pkg/chezmoi/realsystem_windows.go b/pkg/chezmoi/realsystem_windows.go
index 57305a68091..901f7c71662 100644
--- a/pkg/chezmoi/realsystem_windows.go
+++ b/pkg/chezmoi/realsystem_windows.go
@@ -62,7 +62,8 @@ func (s *RealSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode)
// WriteSymlink implements System.WriteSymlink.
func (s *RealSystem) WriteSymlink(oldname string, newname AbsPath) error {
- if err := s.fileSystem.RemoveAll(newname.String()); err != nil && !errors.Is(err, fs.ErrNotExist) {
+ if err := s.fileSystem.RemoveAll(newname.String()); err != nil &&
+ !errors.Is(err, fs.ErrNotExist) {
return err
}
return s.fileSystem.Symlink(filepath.FromSlash(oldname), newname.String())
diff --git a/pkg/chezmoi/refreshexternals.go b/pkg/chezmoi/refreshexternals.go
index b23e0393bb6..b78dcd82b7c 100644
--- a/pkg/chezmoi/refreshexternals.go
+++ b/pkg/chezmoi/refreshexternals.go
@@ -22,7 +22,9 @@ var (
"never": RefreshExternalsNever,
}
- RefreshExternalsFlagCompletionFunc = FlagCompletionFunc(maps.Keys(refreshExternalsWellKnownStrings))
+ RefreshExternalsFlagCompletionFunc = FlagCompletionFunc(
+ maps.Keys(refreshExternalsWellKnownStrings),
+ )
)
func (re *RefreshExternals) Set(s string) error {
diff --git a/pkg/chezmoi/sourcestate.go b/pkg/chezmoi/sourcestate.go
index 8b83bfe3113..4c286f16054 100644
--- a/pkg/chezmoi/sourcestate.go
+++ b/pkg/chezmoi/sourcestate.go
@@ -47,18 +47,20 @@ const (
)
var (
- lineEndingRx = regexp.MustCompile(`(?m)(?:\r\n|\r|\n)`)
- modifyTemplateRx = regexp.MustCompile(`(?m)^.*chezmoi:modify-template.*$(?:\r?\n)?`)
+ lineEndingRx = regexp.MustCompile(`(?m)(?:\r\n|\r|\n)`)
+ modifyTemplateRx = regexp.MustCompile(
+ `(?m)^.*chezmoi:modify-template.*$(?:\r?\n)?`,
+ )
templateDirectiveRx = regexp.MustCompile(`(?m)^.*?chezmoi:template:(.*)$(?:\r?\n)?`)
templateDirectiveKeyValuePairRx = regexp.MustCompile(`\s*(\S+)=("(?:[^"]|\\")*"|\S+)`)
)
// An External is an external source.
type External struct {
- Type ExternalType `json:"type" toml:"type" yaml:"type"`
- Encrypted bool `json:"encrypted" toml:"encrypted" yaml:"encrypted"`
- Exact bool `json:"exact" toml:"exact" yaml:"exact"`
- Executable bool `json:"executable" toml:"executable" yaml:"executable"`
+ Type ExternalType `json:"type" toml:"type" yaml:"type"`
+ Encrypted bool `json:"encrypted" toml:"encrypted" yaml:"encrypted"`
+ Exact bool `json:"exact" toml:"exact" yaml:"exact"`
+ Executable bool `json:"executable" toml:"executable" yaml:"executable"`
Checksum struct {
MD5 HexBytes `json:"md5" toml:"md5" yaml:"md5"`
RIPEMD160 HexBytes `json:"ripemd160" toml:"ripemd160" yaml:"ripemd160"`
@@ -67,23 +69,23 @@ type External struct {
SHA384 HexBytes `json:"sha384" toml:"sha384" yaml:"sha384"`
SHA512 HexBytes `json:"sha512" toml:"sha512" yaml:"sha512"`
Size int `json:"size" toml:"size" yaml:"size"`
- } `json:"checksum" toml:"checksum" yaml:"checksum"`
+ } `json:"checksum" toml:"checksum" yaml:"checksum"`
Clone struct {
Args []string `json:"args" toml:"args" yaml:"args"`
- } `json:"clone" toml:"clone" yaml:"clone"`
- Exclude []string `json:"exclude" toml:"exclude" yaml:"exclude"`
+ } `json:"clone" toml:"clone" yaml:"clone"`
+ Exclude []string `json:"exclude" toml:"exclude" yaml:"exclude"`
Filter struct {
Command string `json:"command" toml:"command" yaml:"command"`
Args []string `json:"args" toml:"args" yaml:"args"`
- } `json:"filter" toml:"filter" yaml:"filter"`
- Format ArchiveFormat `json:"format" toml:"format" yaml:"format"`
- Include []string `json:"include" toml:"include" yaml:"include"`
+ } `json:"filter" toml:"filter" yaml:"filter"`
+ Format ArchiveFormat `json:"format" toml:"format" yaml:"format"`
+ Include []string `json:"include" toml:"include" yaml:"include"`
Pull struct {
Args []string `json:"args" toml:"args" yaml:"args"`
- } `json:"pull" toml:"pull" yaml:"pull"`
- RefreshPeriod Duration `json:"refreshPeriod" toml:"refreshPeriod" yaml:"refreshPeriod"`
+ } `json:"pull" toml:"pull" yaml:"pull"`
+ RefreshPeriod Duration `json:"refreshPeriod" toml:"refreshPeriod" yaml:"refreshPeriod"`
StripComponents int `json:"stripComponents" toml:"stripComponents" yaml:"stripComponents"`
- URL string `json:"url" toml:"url" yaml:"url"`
+ URL string `json:"url" toml:"url" yaml:"url"`
sourceAbsPath AbsPath
}
@@ -308,7 +310,10 @@ type AddOptions struct {
// Add adds destAbsPathInfos to s.
func (s *SourceState) Add(
- sourceSystem System, persistentState PersistentState, destSystem System, destAbsPathInfos map[AbsPath]fs.FileInfo,
+ sourceSystem System,
+ persistentState PersistentState,
+ destSystem System,
+ destAbsPathInfos map[AbsPath]fs.FileInfo,
options *AddOptions,
) error {
for destAbsPath := range destAbsPathInfos {
@@ -317,7 +322,11 @@ func (s *SourceState) Add(
continue
}
if strings.HasPrefix(destAbsPath.String(), protectedAbsPath.String()) {
- return fmt.Errorf("%s: cannot add chezmoi file to chezmoi (%s is protected)", destAbsPath, protectedAbsPath)
+ return fmt.Errorf(
+ "%s: cannot add chezmoi file to chezmoi (%s is protected)",
+ destAbsPath,
+ protectedAbsPath,
+ )
}
}
}
@@ -474,28 +483,31 @@ DEST_ABS_PATH:
// all existing source state entries that are in options.RemoveDir and not
// in the new source state.
if options.RemoveDir != EmptyRelPath {
- _ = s.root.ForEach(EmptyRelPath, func(targetRelPath RelPath, sourceStateEntry SourceStateEntry) error {
- if !targetRelPath.HasDirPrefix(options.RemoveDir) {
- return nil
- }
- if _, ok := newSourceStateEntriesByTargetRelPath[targetRelPath]; ok {
+ _ = s.root.ForEach(
+ EmptyRelPath,
+ func(targetRelPath RelPath, sourceStateEntry SourceStateEntry) error {
+ if !targetRelPath.HasDirPrefix(options.RemoveDir) {
+ return nil
+ }
+ if _, ok := newSourceStateEntriesByTargetRelPath[targetRelPath]; ok {
+ return nil
+ }
+ sourceRelPath := sourceStateEntry.SourceRelPath()
+ sourceRoot.Set(sourceRelPath.RelPath(), &SourceStateRemove{
+ sourceRelPath: sourceRelPath,
+ targetRelPath: targetRelPath,
+ })
+ update := sourceUpdate{
+ destAbsPath: s.destDirAbsPath.Join(targetRelPath),
+ entryState: &EntryState{
+ Type: EntryStateTypeRemove,
+ },
+ sourceRelPaths: []SourceRelPath{sourceRelPath},
+ }
+ sourceUpdates = append(sourceUpdates, update)
return nil
- }
- sourceRelPath := sourceStateEntry.SourceRelPath()
- sourceRoot.Set(sourceRelPath.RelPath(), &SourceStateRemove{
- sourceRelPath: sourceRelPath,
- targetRelPath: targetRelPath,
- })
- update := sourceUpdate{
- destAbsPath: s.destDirAbsPath.Join(targetRelPath),
- entryState: &EntryState{
- Type: EntryStateTypeRemove,
- },
- sourceRelPaths: []SourceRelPath{sourceRelPath},
- }
- sourceUpdates = append(sourceUpdates, update)
- return nil
- })
+ },
+ )
}
targetSourceState := &SourceState{
@@ -505,7 +517,11 @@ DEST_ABS_PATH:
for _, sourceUpdate := range sourceUpdates {
for _, sourceRelPath := range sourceUpdate.sourceRelPaths {
err := targetSourceState.Apply(
- sourceSystem, sourceSystem, NullPersistentState{}, s.sourceDirAbsPath, sourceRelPath.RelPath(),
+ sourceSystem,
+ sourceSystem,
+ NullPersistentState{},
+ s.sourceDirAbsPath,
+ sourceRelPath.RelPath(),
ApplyOptions{
Filter: options.Filter,
Umask: s.umask,
@@ -547,7 +563,10 @@ DEST_ABS_PATH:
// AddDestAbsPathInfos adds an fs.FileInfo to destAbsPathInfos for destAbsPath
// and any of its parents which are not already known.
func (s *SourceState) AddDestAbsPathInfos(
- destAbsPathInfos map[AbsPath]fs.FileInfo, system System, destAbsPath AbsPath, fileInfo fs.FileInfo,
+ destAbsPathInfos map[AbsPath]fs.FileInfo,
+ system System,
+ destAbsPath AbsPath,
+ fileInfo fs.FileInfo,
) error {
for {
if _, err := destAbsPath.TrimDirPrefix(s.destDirAbsPath); err != nil {
@@ -595,7 +614,10 @@ type ApplyOptions struct {
// Apply updates targetRelPath in targetDirAbsPath in destSystem to match s.
func (s *SourceState) Apply(
- targetSystem, destSystem System, persistentState PersistentState, targetDirAbsPath AbsPath, targetRelPath RelPath,
+ targetSystem, destSystem System,
+ persistentState PersistentState,
+ targetDirAbsPath AbsPath,
+ targetRelPath RelPath,
options ApplyOptions,
) error {
sourceStateEntry := s.root.Get(targetRelPath)
@@ -636,7 +658,12 @@ func (s *SourceState) Apply(
if options.PreApplyFunc != nil {
var lastWrittenEntryState *EntryState
var entryState EntryState
- ok, err := PersistentStateGet(persistentState, EntryStateBucket, targetAbsPath.Bytes(), &entryState)
+ ok, err := PersistentStateGet(
+ persistentState,
+ EntryStateBucket,
+ targetAbsPath.Bytes(),
+ &entryState,
+ )
if err != nil {
return err
}
@@ -655,15 +682,26 @@ func (s *SourceState) Apply(
// the source and target states: instead of reporting a diff with
// respect to the last written state, we record the effect of the last
// apply as the last written state.
- if targetEntryState.Equivalent(actualEntryState) && !lastWrittenEntryState.Equivalent(actualEntryState) {
- err := PersistentStateSet(persistentState, EntryStateBucket, targetAbsPath.Bytes(), targetEntryState)
+ if targetEntryState.Equivalent(actualEntryState) &&
+ !lastWrittenEntryState.Equivalent(actualEntryState) {
+ err := PersistentStateSet(
+ persistentState,
+ EntryStateBucket,
+ targetAbsPath.Bytes(),
+ targetEntryState,
+ )
if err != nil {
return err
}
lastWrittenEntryState = targetEntryState
}
- err = options.PreApplyFunc(targetRelPath, targetEntryState, lastWrittenEntryState, actualEntryState)
+ err = options.PreApplyFunc(
+ targetRelPath,
+ targetEntryState,
+ lastWrittenEntryState,
+ actualEntryState,
+ )
if err != nil {
return err
}
@@ -675,7 +713,12 @@ func (s *SourceState) Apply(
return nil
}
- return PersistentStateSet(persistentState, EntryStateBucket, targetAbsPath.Bytes(), targetEntryState)
+ return PersistentStateSet(
+ persistentState,
+ EntryStateBucket,
+ targetAbsPath.Bytes(),
+ targetEntryState,
+ )
}
// Encryption returns s's encryption.
@@ -761,7 +804,11 @@ func (s *SourceState) MustEntry(targetRelPath RelPath) SourceStateEntry {
}
// PostApply performs all updates required after s.Apply.
-func (s *SourceState) PostApply(targetSystem System, targetDirAbsPath AbsPath, targetRelPaths RelPaths) error {
+func (s *SourceState) PostApply(
+ targetSystem System,
+ targetDirAbsPath AbsPath,
+ targetRelPaths RelPaths,
+) error {
// Remove empty directories with the remove_ attribute. This assumes that
// targetRelPaths is already sorted and iterates in reverse order so that
// children are removed before their parents.
@@ -824,7 +871,9 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
addSourceStateEntries := func(relPath RelPath, sourceStateEntries ...SourceStateEntry) {
allSourceStateEntriesMu.Lock()
defer allSourceStateEntriesMu.Unlock()
- allSourceStateEntries[relPath] = append(allSourceStateEntries[relPath], sourceStateEntries...)
+ allSourceStateEntries[relPath] = append(
+ allSourceStateEntries[relPath],
+ sourceStateEntries...)
}
walkFunc := func(sourceAbsPath AbsPath, fileInfo fs.FileInfo, err error) error {
if err != nil {
@@ -839,7 +888,8 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
// Some programs (notably emacs) use invalid symlinks as lockfiles.
// To avoid following them and getting an ENOENT error, check first
// if this is an entry that we will ignore anyway.
- if strings.HasPrefix(fileInfo.Name(), ignorePrefix) && !strings.HasPrefix(fileInfo.Name(), Prefix) {
+ if strings.HasPrefix(fileInfo.Name(), ignorePrefix) &&
+ !strings.HasPrefix(fileInfo.Name(), Prefix) {
return nil
}
fileInfo, err = s.system.Stat(sourceAbsPath)
@@ -898,20 +948,28 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
return nil
case fileInfo.IsDir():
da := parseDirAttr(sourceName.String())
- targetRelPath := parentSourceRelPath.Dir().TargetRelPath(s.encryption.EncryptedSuffix()).JoinString(da.TargetName)
+ targetRelPath := parentSourceRelPath.Dir().
+ TargetRelPath(s.encryption.EncryptedSuffix()).
+ JoinString(da.TargetName)
if s.Ignore(targetRelPath) {
return vfs.SkipDir
}
sourceStateDir := s.newSourceStateDir(sourceAbsPath, sourceRelPath, da)
addSourceStateEntries(targetRelPath, sourceStateDir)
if da.External {
- sourceStateEntries, err := s.readExternalDir(sourceAbsPath, sourceRelPath, targetRelPath)
+ sourceStateEntries, err := s.readExternalDir(
+ sourceAbsPath,
+ sourceRelPath,
+ targetRelPath,
+ )
if err != nil {
return err
}
allSourceStateEntriesMu.Lock()
for relPath, entries := range sourceStateEntries {
- allSourceStateEntries[relPath] = append(allSourceStateEntries[relPath], entries...)
+ allSourceStateEntries[relPath] = append(
+ allSourceStateEntries[relPath],
+ entries...)
}
allSourceStateEntriesMu.Unlock()
return fs.SkipDir
@@ -924,12 +982,19 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
return nil
case fileInfo.Mode().IsRegular():
fa := parseFileAttr(sourceName.String(), s.encryption.EncryptedSuffix())
- targetRelPath := parentSourceRelPath.Dir().TargetRelPath(s.encryption.EncryptedSuffix()).JoinString(fa.TargetName)
+ targetRelPath := parentSourceRelPath.Dir().
+ TargetRelPath(s.encryption.EncryptedSuffix()).
+ JoinString(fa.TargetName)
if s.Ignore(targetRelPath) {
return nil
}
var sourceStateEntry SourceStateEntry
- targetRelPath, sourceStateEntry = s.newSourceStateFile(sourceAbsPath, sourceRelPath, fa, targetRelPath)
+ targetRelPath, sourceStateEntry = s.newSourceStateFile(
+ sourceAbsPath,
+ sourceRelPath,
+ fa,
+ targetRelPath,
+ )
addSourceStateEntries(targetRelPath, sourceStateEntry)
return nil
default:
@@ -966,7 +1031,13 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
case parentSourceStateEntry != nil:
parentSourceRelPath = parentSourceStateEntry.SourceRelPath()
}
- externalSourceStateEntries, err := s.readExternal(ctx, externalRelPath, parentSourceRelPath, external, options)
+ externalSourceStateEntries, err := s.readExternal(
+ ctx,
+ externalRelPath,
+ parentSourceRelPath,
+ external,
+ options,
+ )
if err != nil {
return err
}
@@ -974,7 +1045,9 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
if s.Ignore(targetRelPath) {
continue
}
- allSourceStateEntries[targetRelPath] = append(allSourceStateEntries[targetRelPath], sourceStateEntries...)
+ allSourceStateEntries[targetRelPath] = append(
+ allSourceStateEntries[targetRelPath],
+ sourceStateEntries...)
}
}
@@ -986,7 +1059,10 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
}
// Generate SourceStateRemoves for existing targets.
- matches, err := s.remove.glob(s.system.UnderlyingFS(), ensureSuffix(s.destDirAbsPath.String(), "/"))
+ matches, err := s.remove.glob(
+ s.system.UnderlyingFS(),
+ ensureSuffix(s.destDirAbsPath.String(), "/"),
+ )
if err != nil {
return err
}
@@ -1000,7 +1076,10 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
sourceRelPath: NewSourceRelPath(".chezmoiremove"),
targetRelPath: targetRelPath,
}
- allSourceStateEntries[targetRelPath] = append(allSourceStateEntries[targetRelPath], sourceStateEntry)
+ allSourceStateEntries[targetRelPath] = append(
+ allSourceStateEntries[targetRelPath],
+ sourceStateEntry,
+ )
}
// Generate SourceStateRemoves for exact directories.
@@ -1036,7 +1115,10 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
sourceRelPath: sourceStateDir.sourceRelPath,
targetRelPath: destEntryRelPath,
}
- allSourceStateEntries[destEntryRelPath] = append(allSourceStateEntries[destEntryRelPath], sourceStateRemove)
+ allSourceStateEntries[destEntryRelPath] = append(
+ allSourceStateEntries[destEntryRelPath],
+ sourceStateRemove,
+ )
}
case errors.Is(err, fs.ErrNotExist):
// Do nothing.
@@ -1080,7 +1162,10 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
External: true,
},
}
- allSourceStateEntries[externalRelPath] = append(allSourceStateEntries[externalRelPath], sourceStateCommand)
+ allSourceStateEntries[externalRelPath] = append(
+ allSourceStateEntries[externalRelPath],
+ sourceStateCommand,
+ )
case err != nil:
return err
default:
@@ -1101,7 +1186,10 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
External: true,
},
}
- allSourceStateEntries[externalRelPath] = append(allSourceStateEntries[externalRelPath], sourceStateCommand)
+ allSourceStateEntries[externalRelPath] = append(
+ allSourceStateEntries[externalRelPath],
+ sourceStateCommand,
+ )
}
}
@@ -1222,7 +1310,11 @@ func (s *SourceState) addExternal(sourceAbsPath AbsPath) error {
// addPatterns executes the template at sourceAbsPath, interprets the result as
// a list of patterns, and adds all patterns found to patternSet.
-func (s *SourceState) addPatterns(patternSet *patternSet, sourceAbsPath AbsPath, sourceRelPath SourceRelPath) error {
+func (s *SourceState) addPatterns(
+ patternSet *patternSet,
+ sourceAbsPath AbsPath,
+ sourceRelPath SourceRelPath,
+) error {
data, err := s.executeTemplate(sourceAbsPath)
if err != nil {
return err
@@ -1397,7 +1489,8 @@ func (s *SourceState) getExternalDataRaw(
case RefreshExternalsAuto:
// Use the cache, if available and within the refresh period.
if fileInfo, err := s.baseSystem.Stat(cachedDataAbsPath); err == nil {
- if external.RefreshPeriod == 0 || fileInfo.ModTime().Add(time.Duration(external.RefreshPeriod)).After(now) {
+ if external.RefreshPeriod == 0 ||
+ fileInfo.ModTime().Add(time.Duration(external.RefreshPeriod)).After(now) {
if data, err := s.baseSystem.ReadFile(cachedDataAbsPath); err == nil {
return data, nil
}
@@ -1471,7 +1564,10 @@ func (s *SourceState) getExternalData(
}
if external.Checksum.RIPEMD160 != nil {
- if gotRIPEMD160Sum := ripemd160Sum(data); !bytes.Equal(gotRIPEMD160Sum, external.Checksum.RIPEMD160) {
+ if gotRIPEMD160Sum := ripemd160Sum(data); !bytes.Equal(
+ gotRIPEMD160Sum,
+ external.Checksum.RIPEMD160,
+ ) {
err = multierr.Append(err, fmt.Errorf("RIPEMD-160 mismatch: expected %s, got %s",
external.Checksum.RIPEMD160, hex.EncodeToString(gotRIPEMD160Sum)))
}
@@ -1530,7 +1626,11 @@ func (s *SourceState) getExternalData(
}
// newSourceStateDir returns a new SourceStateDir.
-func (s *SourceState) newSourceStateDir(absPath AbsPath, sourceRelPath SourceRelPath, dirAttr DirAttr) *SourceStateDir {
+func (s *SourceState) newSourceStateDir(
+ absPath AbsPath,
+ sourceRelPath SourceRelPath,
+ dirAttr DirAttr,
+) *SourceStateDir {
targetStateDir := &TargetStateDir{
perm: dirAttr.perm() &^ s.umask,
}
@@ -1591,14 +1691,18 @@ func (s *SourceState) newFileTargetStateEntryFunc(
sourceRelPath SourceRelPath, fileAttr FileAttr, sourceLazyContents *lazyContents,
) targetStateEntryFunc {
return func(destSystem System, destAbsPath AbsPath) (TargetStateEntry, error) {
- if s.mode == ModeSymlink && !fileAttr.Encrypted && !fileAttr.Executable && !fileAttr.Private && !fileAttr.Template {
+ if s.mode == ModeSymlink && !fileAttr.Encrypted && !fileAttr.Executable &&
+ !fileAttr.Private &&
+ !fileAttr.Template {
switch contents, err := sourceLazyContents.Contents(); {
case err != nil:
return nil, err
case isEmpty(contents) && !fileAttr.Empty:
return &TargetStateRemove{}, nil
default:
- linkname := normalizeLinkname(s.sourceDirAbsPath.Join(sourceRelPath.RelPath()).String())
+ linkname := normalizeLinkname(
+ s.sourceDirAbsPath.Join(sourceRelPath.RelPath()).String(),
+ )
return &TargetStateSymlink{
lazyLinkname: newLazyLinkname(linkname),
sourceAttr: SourceAttr{
@@ -1638,7 +1742,10 @@ func (s *SourceState) newFileTargetStateEntryFunc(
// newModifyTargetStateEntryFunc returns a targetStateEntryFunc that returns a
// file with the contents modified by running the sourceLazyContents script.
func (s *SourceState) newModifyTargetStateEntryFunc(
- sourceRelPath SourceRelPath, fileAttr FileAttr, sourceLazyContents *lazyContents, interpreter *Interpreter,
+ sourceRelPath SourceRelPath,
+ fileAttr FileAttr,
+ sourceLazyContents *lazyContents,
+ interpreter *Interpreter,
) targetStateEntryFunc {
return func(destSystem System, destAbsPath AbsPath) (TargetStateEntry, error) {
contentsFunc := func() (contents []byte, err error) {
@@ -1677,9 +1784,14 @@ func (s *SourceState) newModifyTargetStateEntryFunc(
sourceFile := sourceRelPath.String()
templateContents := removeMatches(modifierContents, matches)
var tmpl *Template
- tmpl, err = ParseTemplate(sourceFile, templateContents, s.templateFuncs, TemplateOptions{
- Options: append([]string(nil), s.templateOptions...),
- })
+ tmpl, err = ParseTemplate(
+ sourceFile,
+ templateContents,
+ s.templateFuncs,
+ TemplateOptions{
+ Options: append([]string(nil), s.templateOptions...),
+ },
+ )
if err != nil {
return
}
@@ -1748,7 +1860,10 @@ func (s *SourceState) newRemoveTargetStateEntryFunc(
// newScriptTargetStateEntryFunc returns a targetStateEntryFunc that returns a
// script with sourceLazyContents.
func (s *SourceState) newScriptTargetStateEntryFunc(
- sourceRelPath SourceRelPath, fileAttr FileAttr, targetRelPath RelPath, sourceLazyContents *lazyContents,
+ sourceRelPath SourceRelPath,
+ fileAttr FileAttr,
+ targetRelPath RelPath,
+ sourceLazyContents *lazyContents,
interpreter *Interpreter,
) targetStateEntryFunc {
return func(destSystem System, destAbsPath AbsPath) (TargetStateEntry, error) {
@@ -1831,9 +1946,17 @@ func (s *SourceState) newSourceStateFile(
var targetStateEntryFunc targetStateEntryFunc
switch fileAttr.Type {
case SourceFileTypeCreate:
- targetStateEntryFunc = s.newCreateTargetStateEntryFunc(sourceRelPath, fileAttr, sourceLazyContents)
+ targetStateEntryFunc = s.newCreateTargetStateEntryFunc(
+ sourceRelPath,
+ fileAttr,
+ sourceLazyContents,
+ )
case SourceFileTypeFile:
- targetStateEntryFunc = s.newFileTargetStateEntryFunc(sourceRelPath, fileAttr, sourceLazyContents)
+ targetStateEntryFunc = s.newFileTargetStateEntryFunc(
+ sourceRelPath,
+ fileAttr,
+ sourceLazyContents,
+ )
case SourceFileTypeModify:
// If the target has an extension, determine if it indicates an
// interpreter to use.
@@ -1844,7 +1967,12 @@ func (s *SourceState) newSourceStateFile(
// of the target name, so remove it.
targetRelPath = targetRelPath.Slice(0, targetRelPath.Len()-len(extension)-1)
}
- targetStateEntryFunc = s.newModifyTargetStateEntryFunc(sourceRelPath, fileAttr, sourceLazyContents, interpreter)
+ targetStateEntryFunc = s.newModifyTargetStateEntryFunc(
+ sourceRelPath,
+ fileAttr,
+ sourceLazyContents,
+ interpreter,
+ )
case SourceFileTypeRemove:
targetStateEntryFunc = s.newRemoveTargetStateEntryFunc(sourceRelPath, fileAttr)
case SourceFileTypeScript:
@@ -1856,7 +1984,11 @@ func (s *SourceState) newSourceStateFile(
sourceRelPath, fileAttr, targetRelPath, sourceLazyContents, interpreter,
)
case SourceFileTypeSymlink:
- targetStateEntryFunc = s.newSymlinkTargetStateEntryFunc(sourceRelPath, fileAttr, sourceLazyContents)
+ targetStateEntryFunc = s.newSymlinkTargetStateEntryFunc(
+ sourceRelPath,
+ fileAttr,
+ sourceLazyContents,
+ )
default:
panic(fmt.Sprintf("%d: unsupported type", fileAttr.Type))
}
@@ -1872,7 +2004,10 @@ func (s *SourceState) newSourceStateFile(
// newSourceStateDirEntry returns a SourceStateEntry constructed from a directory in s.
func (s *SourceState) newSourceStateDirEntry(
- actualStateDir *ActualStateDir, fileInfo fs.FileInfo, parentSourceRelPath SourceRelPath, options *AddOptions,
+ actualStateDir *ActualStateDir,
+ fileInfo fs.FileInfo,
+ parentSourceRelPath SourceRelPath,
+ options *AddOptions,
) *SourceStateDir {
dirAttr := DirAttr{
TargetName: fileInfo.Name(),
@@ -1894,7 +2029,10 @@ func (s *SourceState) newSourceStateDirEntry(
// newSourceStateFileEntryFromFile returns a SourceStateEntry constructed from a
// file in s.
func (s *SourceState) newSourceStateFileEntryFromFile(
- actualStateFile *ActualStateFile, fileInfo fs.FileInfo, parentSourceRelPath SourceRelPath, options *AddOptions,
+ actualStateFile *ActualStateFile,
+ fileInfo fs.FileInfo,
+ parentSourceRelPath SourceRelPath,
+ options *AddOptions,
) (*SourceStateFile, error) {
fileAttr := FileAttr{
TargetName: fileInfo.Name(),
@@ -1923,7 +2061,9 @@ func (s *SourceState) newSourceStateFileEntryFromFile(
}
}
lazyContents := newLazyContents(contents)
- sourceRelPath := parentSourceRelPath.Join(NewSourceRelPath(fileAttr.SourceName(s.encryption.EncryptedSuffix())))
+ sourceRelPath := parentSourceRelPath.Join(
+ NewSourceRelPath(fileAttr.SourceName(s.encryption.EncryptedSuffix())),
+ )
return &SourceStateFile{
Attr: fileAttr,
origin: actualStateFile,
@@ -1969,7 +2109,9 @@ func (s *SourceState) newSourceStateFileEntryFromSymlink(
Type: SourceFileTypeSymlink,
Template: template,
}
- sourceRelPath := parentSourceRelPath.Join(NewSourceRelPath(fileAttr.SourceName(s.encryption.EncryptedSuffix())))
+ sourceRelPath := parentSourceRelPath.Join(
+ NewSourceRelPath(fileAttr.SourceName(s.encryption.EncryptedSuffix())),
+ )
return &SourceStateFile{
Attr: fileAttr,
sourceRelPath: sourceRelPath,
@@ -1983,7 +2125,10 @@ func (s *SourceState) newSourceStateFileEntryFromSymlink(
// readExternal reads an external and returns its SourceStateEntries.
func (s *SourceState) readExternal(
- ctx context.Context, externalRelPath RelPath, parentSourceRelPath SourceRelPath, external *External,
+ ctx context.Context,
+ externalRelPath RelPath,
+ parentSourceRelPath SourceRelPath,
+ external *External,
options *ReadOptions,
) (map[RelPath][]SourceStateEntry, error) {
switch external.Type {
@@ -2001,7 +2146,10 @@ func (s *SourceState) readExternal(
// readExternalArchive reads an external archive and returns its
// SourceStateEntries.
func (s *SourceState) readExternalArchive(
- ctx context.Context, externalRelPath RelPath, parentSourceRelPath SourceRelPath, external *External,
+ ctx context.Context,
+ externalRelPath RelPath,
+ parentSourceRelPath SourceRelPath,
+ external *External,
options *ReadOptions,
) (map[RelPath][]SourceStateEntry, error) {
data, err := s.getExternalData(ctx, externalRelPath, external, options)
@@ -2252,7 +2400,10 @@ func (s *SourceState) readExternalDir(
},
}
}
- sourceStateEntries[targetRelPath] = append(sourceStateEntries[targetRelPath], sourceStateEntry)
+ sourceStateEntries[targetRelPath] = append(
+ sourceStateEntries[targetRelPath],
+ sourceStateEntry,
+ )
return nil
}
if err := Walk(s.system, rootSourceAbsPath, walkFunc); err != nil {
@@ -2263,7 +2414,10 @@ func (s *SourceState) readExternalDir(
// readExternalFile reads an external file and returns its SourceStateEntries.
func (s *SourceState) readExternalFile(
- ctx context.Context, externalRelPath RelPath, parentSourceRelPath SourceRelPath, external *External,
+ ctx context.Context,
+ externalRelPath RelPath,
+ parentSourceRelPath SourceRelPath,
+ external *External,
options *ReadOptions,
) (map[RelPath][]SourceStateEntry, error) {
lazyContents := newLazyContentsFunc(func() ([]byte, error) {
@@ -2282,8 +2436,10 @@ func (s *SourceState) readExternalFile(
},
}
sourceStateEntry := &SourceStateFile{
- origin: external,
- sourceRelPath: parentSourceRelPath.Join(NewSourceRelPath(fileAttr.SourceName(s.encryption.EncryptedSuffix()))),
+ origin: external,
+ sourceRelPath: parentSourceRelPath.Join(
+ NewSourceRelPath(fileAttr.SourceName(s.encryption.EncryptedSuffix())),
+ ),
targetStateEntry: targetStateEntry,
}
return map[RelPath][]SourceStateEntry{
@@ -2315,7 +2471,8 @@ func (s *SourceState) readScriptsDir(
// Some programs (notably emacs) use invalid symlinks as lockfiles.
// To avoid following them and getting an ENOENT error, check first
// if this is an entry that we will ignore anyway.
- if strings.HasPrefix(fileInfo.Name(), ignorePrefix) && !strings.HasPrefix(fileInfo.Name(), Prefix) {
+ if strings.HasPrefix(fileInfo.Name(), ignorePrefix) &&
+ !strings.HasPrefix(fileInfo.Name(), Prefix) {
return nil
}
fileInfo, err = s.system.Stat(sourceAbsPath)
@@ -2347,12 +2504,19 @@ func (s *SourceState) readScriptsDir(
if fa.Type != SourceFileTypeScript {
return fmt.Errorf("%s: not a script", sourceAbsPath)
}
- targetRelPath := parentSourceRelPath.Dir().TargetRelPath(s.encryption.EncryptedSuffix()).JoinString(fa.TargetName)
+ targetRelPath := parentSourceRelPath.Dir().
+ TargetRelPath(s.encryption.EncryptedSuffix()).
+ JoinString(fa.TargetName)
if s.Ignore(targetRelPath) {
return nil
}
var sourceStateEntry SourceStateEntry
- targetRelPath, sourceStateEntry = s.newSourceStateFile(sourceAbsPath, sourceRelPath, fa, targetRelPath)
+ targetRelPath, sourceStateEntry = s.newSourceStateFile(
+ sourceAbsPath,
+ sourceRelPath,
+ fa,
+ targetRelPath,
+ )
addSourceStateEntry(targetRelPath, sourceStateEntry)
return nil
default:
@@ -2391,7 +2555,10 @@ func (s *SourceState) readVersionFile(sourceAbsPath AbsPath) error {
// sourceStateEntry returns a new SourceStateEntry based on actualStateEntry.
func (s *SourceState) sourceStateEntry(
- actualStateEntry ActualStateEntry, destAbsPath AbsPath, fileInfo fs.FileInfo, parentSourceRelPath SourceRelPath,
+ actualStateEntry ActualStateEntry,
+ destAbsPath AbsPath,
+ fileInfo fs.FileInfo,
+ parentSourceRelPath SourceRelPath,
options *AddOptions,
) (SourceStateEntry, error) {
switch actualStateEntry := actualStateEntry.(type) {
diff --git a/pkg/chezmoi/sourcestate_test.go b/pkg/chezmoi/sourcestate_test.go
index b3d25413651..abab2ef7ff9 100644
--- a/pkg/chezmoi/sourcestate_test.go
+++ b/pkg/chezmoi/sourcestate_test.go
@@ -519,9 +519,15 @@ func TestSourceStateAdd(t *testing.T) {
destAbsPathInfos := make(map[AbsPath]fs.FileInfo)
for _, destAbsPath := range tc.destAbsPaths {
- assert.NoError(t, s.AddDestAbsPathInfos(destAbsPathInfos, system, destAbsPath, nil))
+ assert.NoError(
+ t,
+ s.AddDestAbsPathInfos(destAbsPathInfos, system, destAbsPath, nil),
+ )
}
- assert.NoError(t, s.Add(system, persistentState, system, destAbsPathInfos, &tc.addOptions))
+ assert.NoError(
+ t,
+ s.Add(system, persistentState, system, destAbsPathInfos, &tc.addOptions),
+ )
vfst.RunTests(t, fileSystem, "", tc.tests...)
})
@@ -533,7 +539,14 @@ func TestSourceStateAddInExternal(t *testing.T) {
buffer := &bytes.Buffer{}
tarWriterSystem := NewTarWriterSystem(buffer, tar.Header{})
assert.NoError(t, tarWriterSystem.Mkdir(NewAbsPath("dir"), fs.ModePerm))
- assert.NoError(t, tarWriterSystem.WriteFile(NewAbsPath("dir/file"), []byte("# contents of dir/file\n"), 0o666))
+ assert.NoError(
+ t,
+ tarWriterSystem.WriteFile(
+ NewAbsPath("dir/file"),
+ []byte("# contents of dir/file\n"),
+ 0o666,
+ ),
+ )
assert.NoError(t, tarWriterSystem.Close())
archiveData := buffer.Bytes()
@@ -803,10 +816,19 @@ func TestSourceStateApplyAll(t *testing.T) {
s := NewSourceState(sourceStateOptions...)
assert.NoError(t, s.Read(ctx, nil))
requireEvaluateAll(t, s, system)
- assert.NoError(t, s.applyAll(system, system, persistentState, NewAbsPath("/home/user"), ApplyOptions{
- Filter: NewEntryTypeFilter(EntryTypesAll, EntryTypesNone),
- Umask: chezmoitest.Umask,
- }))
+ assert.NoError(
+ t,
+ s.applyAll(
+ system,
+ system,
+ persistentState,
+ NewAbsPath("/home/user"),
+ ApplyOptions{
+ Filter: NewEntryTypeFilter(EntryTypesAll, EntryTypesNone),
+ Umask: chezmoitest.Umask,
+ },
+ ),
+ )
vfst.RunTests(t, fileSystem, "", tc.tests...)
})
@@ -1465,7 +1487,9 @@ func TestSourceStateRead(t *testing.T) {
assert.NoError(t, err)
requireEvaluateAll(t, s, system)
tc.expectedSourceState.destDirAbsPath = NewAbsPath("/home/user")
- tc.expectedSourceState.sourceDirAbsPath = NewAbsPath("/home/user/.local/share/chezmoi")
+ tc.expectedSourceState.sourceDirAbsPath = NewAbsPath(
+ "/home/user/.local/share/chezmoi",
+ )
requireEvaluateAll(t, tc.expectedSourceState, system)
s.baseSystem = nil
s.system = nil
@@ -1604,7 +1628,10 @@ func TestSourceStateReadScriptsConcurrent(t *testing.T) {
func TestSourceStateReadExternalCache(t *testing.T) {
buffer := &bytes.Buffer{}
tarWriterSystem := NewTarWriterSystem(buffer, tar.Header{})
- assert.NoError(t, tarWriterSystem.WriteFile(NewAbsPath("file"), []byte("# contents of file\n"), 0o666))
+ assert.NoError(
+ t,
+ tarWriterSystem.WriteFile(NewAbsPath("file"), []byte("# contents of file\n"), 0o666),
+ )
assert.NoError(t, tarWriterSystem.Close())
archiveData := buffer.Bytes()
@@ -1650,7 +1677,9 @@ func TestSourceStateReadExternalCache(t *testing.T) {
Type: "archive",
URL: httpServer.URL + "/archive.tar",
RefreshPeriod: Duration(1 * time.Minute),
- sourceAbsPath: NewAbsPath("/home/user/.local/share/chezmoi/.chezmoiexternal.yaml"),
+ sourceAbsPath: NewAbsPath(
+ "/home/user/.local/share/chezmoi/.chezmoiexternal.yaml",
+ ),
},
}, s.externals)
}
@@ -1893,7 +1922,10 @@ func TestTemplateOptionsParseDirectives(t *testing.T) {
// applyAll updates targetDirAbsPath in targetSystem to match s.
func (s *SourceState) applyAll(
- targetSystem, destSystem System, persistentState PersistentState, targetDirAbsPath AbsPath, options ApplyOptions,
+ targetSystem, destSystem System,
+ persistentState PersistentState,
+ targetDirAbsPath AbsPath,
+ options ApplyOptions,
) error {
for _, targetRelPath := range s.TargetRelPaths() {
switch err := s.Apply(targetSystem, destSystem, persistentState, targetDirAbsPath, targetRelPath, options); {
@@ -1910,17 +1942,23 @@ func (s *SourceState) applyAll(
// without error.
func requireEvaluateAll(t *testing.T, s *SourceState, destSystem System) {
t.Helper()
- assert.NoError(t, s.root.ForEach(EmptyRelPath, func(targetRelPath RelPath, sourceStateEntry SourceStateEntry) error {
- if err := sourceStateEntry.Evaluate(); err != nil {
- return err
- }
- destAbsPath := s.destDirAbsPath.Join(targetRelPath)
- targetStateEntry, err := sourceStateEntry.TargetStateEntry(destSystem, destAbsPath)
- if err != nil {
- return err
- }
- return targetStateEntry.Evaluate()
- }))
+ assert.NoError(
+ t,
+ s.root.ForEach(
+ EmptyRelPath,
+ func(targetRelPath RelPath, sourceStateEntry SourceStateEntry) error {
+ if err := sourceStateEntry.Evaluate(); err != nil {
+ return err
+ }
+ destAbsPath := s.destDirAbsPath.Join(targetRelPath)
+ targetStateEntry, err := sourceStateEntry.TargetStateEntry(destSystem, destAbsPath)
+ if err != nil {
+ return err
+ }
+ return targetStateEntry.Evaluate()
+ },
+ ),
+ )
}
func withEntries(sourceEntries map[RelPath]SourceStateEntry) SourceStateOption {
diff --git a/pkg/chezmoi/sourcestateentry.go b/pkg/chezmoi/sourcestateentry.go
index 4355570a353..2c589619795 100644
--- a/pkg/chezmoi/sourcestateentry.go
+++ b/pkg/chezmoi/sourcestateentry.go
@@ -107,7 +107,10 @@ func (s *SourceStateCommand) SourceRelPath() SourceRelPath {
}
// TargetStateEntry returns s's target state entry.
-func (s *SourceStateCommand) TargetStateEntry(destSystem System, destDirAbsPath AbsPath) (TargetStateEntry, error) {
+func (s *SourceStateCommand) TargetStateEntry(
+ destSystem System,
+ destDirAbsPath AbsPath,
+) (TargetStateEntry, error) {
return &TargetStateModifyDirWithCmd{
cmd: s.cmd,
forceRefresh: s.forceRefresh,
@@ -144,7 +147,10 @@ func (s *SourceStateDir) SourceRelPath() SourceRelPath {
}
// TargetStateEntry returns s's target state entry.
-func (s *SourceStateDir) TargetStateEntry(destSystem System, destDirAbsPath AbsPath) (TargetStateEntry, error) {
+func (s *SourceStateDir) TargetStateEntry(
+ destSystem System,
+ destDirAbsPath AbsPath,
+) (TargetStateEntry, error) {
return s.targetStateEntry, nil
}
@@ -188,9 +194,15 @@ func (s *SourceStateFile) SourceRelPath() SourceRelPath {
}
// TargetStateEntry returns s's target state entry.
-func (s *SourceStateFile) TargetStateEntry(destSystem System, destDirAbsPath AbsPath) (TargetStateEntry, error) {
+func (s *SourceStateFile) TargetStateEntry(
+ destSystem System,
+ destDirAbsPath AbsPath,
+) (TargetStateEntry, error) {
if s.targetStateEntryFunc != nil {
- s.targetStateEntry, s.targetStateEntryErr = s.targetStateEntryFunc(destSystem, destDirAbsPath)
+ s.targetStateEntry, s.targetStateEntryErr = s.targetStateEntryFunc(
+ destSystem,
+ destDirAbsPath,
+ )
s.targetStateEntryFunc = nil
}
return s.targetStateEntry, s.targetStateEntryErr
@@ -222,7 +234,10 @@ func (s *SourceStateRemove) SourceRelPath() SourceRelPath {
}
// TargetStateEntry returns s's target state entry.
-func (s *SourceStateRemove) TargetStateEntry(destSystem System, destDirAbsPath AbsPath) (TargetStateEntry, error) {
+func (s *SourceStateRemove) TargetStateEntry(
+ destSystem System,
+ destDirAbsPath AbsPath,
+) (TargetStateEntry, error) {
return &TargetStateRemove{}, nil
}
diff --git a/pkg/chezmoi/sourcestatetreenode.go b/pkg/chezmoi/sourcestatetreenode.go
index 4412ea4cc24..a6a672adb06 100644
--- a/pkg/chezmoi/sourcestatetreenode.go
+++ b/pkg/chezmoi/sourcestatetreenode.go
@@ -47,13 +47,19 @@ func (n *sourceStateEntryTreeNode) GetNode(targetRelPath RelPath) *sourceStateEn
}
// ForEach calls f for each SourceStateEntry in the tree.
-func (n *sourceStateEntryTreeNode) ForEach(targetRelPath RelPath, f func(RelPath, SourceStateEntry) error) error {
- return n.ForEachNode(targetRelPath, func(targetRelPath RelPath, node *sourceStateEntryTreeNode) error {
- if node.sourceStateEntry == nil {
- return nil
- }
- return f(targetRelPath, node.sourceStateEntry)
- })
+func (n *sourceStateEntryTreeNode) ForEach(
+ targetRelPath RelPath,
+ f func(RelPath, SourceStateEntry) error,
+) error {
+ return n.ForEachNode(
+ targetRelPath,
+ func(targetRelPath RelPath, node *sourceStateEntryTreeNode) error {
+ if node.sourceStateEntry == nil {
+ return nil
+ }
+ return f(targetRelPath, node.sourceStateEntry)
+ },
+ )
}
// ForEachNode calls f for each node in the tree.
@@ -134,7 +140,10 @@ func (n *sourceStateEntryTreeNode) MkdirAll(
var ok bool
sourceStateDir, ok = node.sourceStateEntry.(*SourceStateDir)
if !ok {
- return nil, fmt.Errorf("%s: not a directory", componentRelPaths[0].Join(componentRelPaths[1:i+1]...))
+ return nil, fmt.Errorf(
+ "%s: not a directory",
+ componentRelPaths[0].Join(componentRelPaths[1:i+1]...),
+ )
}
sourceRelPath = sourceRelPath.Join(NewSourceRelPath(sourceStateDir.Attr.SourceName()))
}
diff --git a/pkg/chezmoi/sourcestatetreenode_test.go b/pkg/chezmoi/sourcestatetreenode_test.go
index 7d0d630b720..4de7d700c5e 100644
--- a/pkg/chezmoi/sourcestatetreenode_test.go
+++ b/pkg/chezmoi/sourcestatetreenode_test.go
@@ -21,11 +21,17 @@ func TestSourceStateEntryTreeNodeSingle(t *testing.T) {
sourceStateFile := &SourceStateFile{}
n.Set(NewRelPath("file"), sourceStateFile)
assert.Equal(t, sourceStateFile, n.Get(NewRelPath("file")).(*SourceStateFile))
- assert.NoError(t, n.ForEach(EmptyRelPath, func(targetRelPath RelPath, sourceStateEntry SourceStateEntry) error {
- assert.Equal(t, NewRelPath("file"), targetRelPath)
- assert.Equal(t, sourceStateFile, sourceStateEntry.(*SourceStateFile))
- return nil
- }))
+ assert.NoError(
+ t,
+ n.ForEach(
+ EmptyRelPath,
+ func(targetRelPath RelPath, sourceStateEntry SourceStateEntry) error {
+ assert.Equal(t, NewRelPath("file"), targetRelPath)
+ assert.Equal(t, sourceStateFile, sourceStateEntry.(*SourceStateFile))
+ return nil
+ },
+ ),
+ )
}
func TestSourceStateEntryTreeNodeMultiple(t *testing.T) {
@@ -43,11 +49,17 @@ func TestSourceStateEntryTreeNodeMultiple(t *testing.T) {
}
var targetRelPaths []RelPath
- assert.NoError(t, n.ForEach(EmptyRelPath, func(targetRelPath RelPath, sourceStateEntry SourceStateEntry) error {
- assert.Equal(t, entries[targetRelPath], sourceStateEntry)
- targetRelPaths = append(targetRelPaths, targetRelPath)
- return nil
- }))
+ assert.NoError(
+ t,
+ n.ForEach(
+ EmptyRelPath,
+ func(targetRelPath RelPath, sourceStateEntry SourceStateEntry) error {
+ assert.Equal(t, entries[targetRelPath], sourceStateEntry)
+ targetRelPaths = append(targetRelPaths, targetRelPath)
+ return nil
+ },
+ ),
+ )
assert.Equal(t, []RelPath{
NewRelPath("a_file"),
NewRelPath("b_file"),
diff --git a/pkg/chezmoi/system.go b/pkg/chezmoi/system.go
index 08f43ae1ee2..2e69713b097 100644
--- a/pkg/chezmoi/system.go
+++ b/pkg/chezmoi/system.go
@@ -90,7 +90,12 @@ func (noUpdateSystemMixin) RunCmd(cmd *exec.Cmd) error {
panic("update to no update system")
}
-func (noUpdateSystemMixin) RunScript(scriptname RelPath, dir AbsPath, data []byte, options RunScriptOptions) error {
+func (noUpdateSystemMixin) RunScript(
+ scriptname RelPath,
+ dir AbsPath,
+ data []byte,
+ options RunScriptOptions,
+) error {
panic("update to no update system")
}
diff --git a/pkg/chezmoi/system_test.go b/pkg/chezmoi/system_test.go
index 89e728e936b..52e776b00d9 100644
--- a/pkg/chezmoi/system_test.go
+++ b/pkg/chezmoi/system_test.go
@@ -78,13 +78,20 @@ func TestWalkSourceDir(t *testing.T) {
var actualSourceDirAbsPaths []AbsPath
chezmoitest.WithTestFS(t, root, func(fileSystem vfs.FS) {
system := NewRealSystem(fileSystem)
- assert.NoError(t, WalkSourceDir(system, sourceDirAbsPath, func(absPath AbsPath, fileInfo fs.FileInfo, err error) error {
- if err != nil {
- return err
- }
- actualSourceDirAbsPaths = append(actualSourceDirAbsPaths, absPath)
- return nil
- }))
+ assert.NoError(
+ t,
+ WalkSourceDir(
+ system,
+ sourceDirAbsPath,
+ func(absPath AbsPath, fileInfo fs.FileInfo, err error) error {
+ if err != nil {
+ return err
+ }
+ actualSourceDirAbsPaths = append(actualSourceDirAbsPaths, absPath)
+ return nil
+ },
+ ),
+ )
})
assert.Equal(t, expectedSourceDirAbsPaths, actualSourceDirAbsPaths)
}
diff --git a/pkg/chezmoi/targetstateentry.go b/pkg/chezmoi/targetstateentry.go
index 089381afc9c..845f6ff32ce 100644
--- a/pkg/chezmoi/targetstateentry.go
+++ b/pkg/chezmoi/targetstateentry.go
@@ -12,7 +12,11 @@ import (
// A TargetStateEntry represents the state of an entry in the target state.
type TargetStateEntry interface {
- Apply(system System, persistentState PersistentState, actualStateEntry ActualStateEntry) (bool, error)
+ Apply(
+ system System,
+ persistentState PersistentState,
+ actualStateEntry ActualStateEntry,
+ ) (bool, error)
EntryState(umask fs.FileMode) (*EntryState, error)
Evaluate() error
SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error)
@@ -64,13 +68,13 @@ type TargetStateSymlink struct {
// A modifyDirWithCmdState records the state of a directory modified by a
// command.
type modifyDirWithCmdState struct {
- Name AbsPath `json:"name" yaml:"name"`
+ Name AbsPath `json:"name" yaml:"name"`
RunAt time.Time `json:"runAt" yaml:"runAt"`
}
// A scriptState records the state of a script that has been run.
type scriptState struct {
- Name RelPath `json:"name" yaml:"name"`
+ Name RelPath `json:"name" yaml:"name"`
RunAt time.Time `json:"runAt" yaml:"runAt"`
}
@@ -115,7 +119,10 @@ func (t *TargetStateModifyDirWithCmd) Evaluate() error {
}
// SkipApply implements TargetStateEntry.SkipApply.
-func (t *TargetStateModifyDirWithCmd) SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error) {
+func (t *TargetStateModifyDirWithCmd) SkipApply(
+ persistentState PersistentState,
+ targetAbsPath AbsPath,
+) (bool, error) {
if t.forceRefresh {
return false, nil
}
@@ -172,7 +179,10 @@ func (t *TargetStateDir) Evaluate() error {
}
// SkipApply implements TargetState.SkipApply.
-func (t *TargetStateDir) SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error) {
+func (t *TargetStateDir) SkipApply(
+ persistentState PersistentState,
+ targetAbsPath AbsPath,
+) (bool, error) {
return false, nil
}
@@ -255,7 +265,10 @@ func (t *TargetStateFile) Perm(umask fs.FileMode) fs.FileMode {
}
// SkipApply implements TargetStateEntry.SkipApply.
-func (t *TargetStateFile) SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error) {
+func (t *TargetStateFile) SkipApply(
+ persistentState PersistentState,
+ targetAbsPath AbsPath,
+) (bool, error) {
return false, nil
}
@@ -287,7 +300,10 @@ func (t *TargetStateRemove) Evaluate() error {
}
// SkipApply implements TargetStateEntry.SkipApply.
-func (t *TargetStateRemove) SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error) {
+func (t *TargetStateRemove) SkipApply(
+ persistentState PersistentState,
+ targetAbsPath AbsPath,
+) (bool, error) {
return false, nil
}
@@ -365,7 +381,10 @@ func (t *TargetStateScript) Evaluate() error {
}
// SkipApply implements TargetStateEntry.SkipApply.
-func (t *TargetStateScript) SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error) {
+func (t *TargetStateScript) SkipApply(
+ persistentState PersistentState,
+ targetAbsPath AbsPath,
+) (bool, error) {
switch contents, err := t.Contents(); {
case err != nil:
return false, err
diff --git a/pkg/chezmoi/targetstateentry_test.go b/pkg/chezmoi/targetstateentry_test.go
index 9aefc8f2621..1a5c9654835 100644
--- a/pkg/chezmoi/targetstateentry_test.go
+++ b/pkg/chezmoi/targetstateentry_test.go
@@ -80,26 +80,39 @@ func TestTargetStateEntryApply(t *testing.T) {
assert.NoError(t, combinator.Generate(&testCases, testData))
for _, tc := range testCases {
- t.Run(fmt.Sprintf("target_%s_actual_%s", tc.TargetStateKey, tc.ActualDestDirStateKey), func(t *testing.T) {
- targetState := targetStates[tc.TargetStateKey]
- actualState := actualStates[tc.ActualDestDirStateKey]
+ t.Run(
+ fmt.Sprintf("target_%s_actual_%s", tc.TargetStateKey, tc.ActualDestDirStateKey),
+ func(t *testing.T) {
+ targetState := targetStates[tc.TargetStateKey]
+ actualState := actualStates[tc.ActualDestDirStateKey]
- chezmoitest.WithTestFS(t, actualState, func(fileSystem vfs.FS) {
- system := NewRealSystem(fileSystem)
+ chezmoitest.WithTestFS(t, actualState, func(fileSystem vfs.FS) {
+ system := NewRealSystem(fileSystem)
- // Read the initial destination state entry from fileSystem.
- actualStateEntry, err := NewActualStateEntry(system, NewAbsPath("/home/user/target"), nil, nil)
- assert.NoError(t, err)
+ // Read the initial destination state entry from fileSystem.
+ actualStateEntry, err := NewActualStateEntry(
+ system,
+ NewAbsPath("/home/user/target"),
+ nil,
+ nil,
+ )
+ assert.NoError(t, err)
- // Apply the target state entry.
- _, err = targetState.Apply(system, nil, actualStateEntry)
- assert.NoError(t, err)
+ // Apply the target state entry.
+ _, err = targetState.Apply(system, nil, actualStateEntry)
+ assert.NoError(t, err)
- // Verify that the actual state entry matches the desired
- // state.
- vfst.RunTests(t, fileSystem, "", vfst.TestPath("/home/user/target", targetStateTest(t, targetState)...))
- })
- })
+ // Verify that the actual state entry matches the desired
+ // state.
+ vfst.RunTests(
+ t,
+ fileSystem,
+ "",
+ vfst.TestPath("/home/user/target", targetStateTest(t, targetState)...),
+ )
+ })
+ },
+ )
}
}
diff --git a/pkg/chezmoi/tarwritersystem.go b/pkg/chezmoi/tarwritersystem.go
index daf14ac9bdb..97fcfd81f74 100644
--- a/pkg/chezmoi/tarwritersystem.go
+++ b/pkg/chezmoi/tarwritersystem.go
@@ -43,7 +43,12 @@ func (s *TarWriterSystem) RunCmd(cmd *exec.Cmd) error {
}
// RunScript implements System.RunScript.
-func (s *TarWriterSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, options RunScriptOptions) error {
+func (s *TarWriterSystem) RunScript(
+ scriptname RelPath,
+ dir AbsPath,
+ data []byte,
+ options RunScriptOptions,
+) error {
return s.WriteFile(NewAbsPath(scriptname.String()), data, 0o700)
}
diff --git a/pkg/chezmoi/tarwritersystem_test.go b/pkg/chezmoi/tarwritersystem_test.go
index eb9f363608b..e896255c526 100644
--- a/pkg/chezmoi/tarwritersystem_test.go
+++ b/pkg/chezmoi/tarwritersystem_test.go
@@ -53,9 +53,12 @@ func TestTarWriterSystem(t *testing.T) {
b := &bytes.Buffer{}
tarWriterSystem := NewTarWriterSystem(b, tar.Header{})
persistentState := NewMockPersistentState()
- assert.NoError(t, s.applyAll(tarWriterSystem, system, persistentState, EmptyAbsPath, ApplyOptions{
- Filter: NewEntryTypeFilter(EntryTypesAll, EntryTypesNone),
- }))
+ assert.NoError(
+ t,
+ s.applyAll(tarWriterSystem, system, persistentState, EmptyAbsPath, ApplyOptions{
+ Filter: NewEntryTypeFilter(EntryTypesAll, EntryTypesNone),
+ }),
+ )
assert.NoError(t, tarWriterSystem.Close())
r := tar.NewReader(b)
diff --git a/pkg/chezmoi/template.go b/pkg/chezmoi/template.go
index a5ae1ac0475..10b9eb32ca8 100644
--- a/pkg/chezmoi/template.go
+++ b/pkg/chezmoi/template.go
@@ -23,7 +23,12 @@ type TemplateOptions struct {
// ParseTemplate parses a template named name from data with the given funcs and
// templateOptions.
-func ParseTemplate(name string, data []byte, funcs template.FuncMap, options TemplateOptions) (*Template, error) {
+func ParseTemplate(
+ name string,
+ data []byte,
+ funcs template.FuncMap,
+ options TemplateOptions,
+) (*Template, error) {
contents := options.parseAndRemoveDirectives(data)
template, err := template.New(name).
Option(options.Options...).
@@ -67,7 +72,10 @@ func (o *TemplateOptions) parseAndRemoveDirectives(data []byte) []byte {
// Parse options from directives.
for _, directiveMatch := range directiveMatches {
- keyValuePairMatches := templateDirectiveKeyValuePairRx.FindAllSubmatch(data[directiveMatch[2]:directiveMatch[3]], -1)
+ keyValuePairMatches := templateDirectiveKeyValuePairRx.FindAllSubmatch(
+ data[directiveMatch[2]:directiveMatch[3]],
+ -1,
+ )
for _, keyValuePairMatch := range keyValuePairMatches {
key := string(keyValuePairMatch[1])
value := maybeUnquote(string(keyValuePairMatch[2]))
diff --git a/pkg/chezmoi/zipwritersystem.go b/pkg/chezmoi/zipwritersystem.go
index 789f78fa9be..766819460b3 100644
--- a/pkg/chezmoi/zipwritersystem.go
+++ b/pkg/chezmoi/zipwritersystem.go
@@ -48,7 +48,12 @@ func (s *ZIPWriterSystem) RunCmd(cmd *exec.Cmd) error {
}
// RunScript implements System.RunScript.
-func (s *ZIPWriterSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, options RunScriptOptions) error {
+func (s *ZIPWriterSystem) RunScript(
+ scriptname RelPath,
+ dir AbsPath,
+ data []byte,
+ options RunScriptOptions,
+) error {
return s.WriteFile(NewAbsPath(scriptname.String()), data, 0o700)
}
diff --git a/pkg/chezmoi/zipwritersystem_test.go b/pkg/chezmoi/zipwritersystem_test.go
index 5a1111fd3ee..784c1a47805 100644
--- a/pkg/chezmoi/zipwritersystem_test.go
+++ b/pkg/chezmoi/zipwritersystem_test.go
@@ -54,9 +54,12 @@ func TestZIPWriterSystem(t *testing.T) {
b := &bytes.Buffer{}
zipWriterSystem := NewZIPWriterSystem(b, time.Now().UTC())
persistentState := NewMockPersistentState()
- assert.NoError(t, s.applyAll(zipWriterSystem, system, persistentState, EmptyAbsPath, ApplyOptions{
- Filter: NewEntryTypeFilter(EntryTypesAll, EntryTypesNone),
- }))
+ assert.NoError(
+ t,
+ s.applyAll(zipWriterSystem, system, persistentState, EmptyAbsPath, ApplyOptions{
+ Filter: NewEntryTypeFilter(EntryTypesAll, EntryTypesNone),
+ }),
+ )
assert.NoError(t, zipWriterSystem.Close())
r, err := zip.NewReader(bytes.NewReader(b.Bytes()), int64(b.Len()))
diff --git a/pkg/chezmoibubbles/boolinputmodel_test.go b/pkg/chezmoibubbles/boolinputmodel_test.go
index 33051fa2582..2098f94752f 100644
--- a/pkg/chezmoibubbles/boolinputmodel_test.go
+++ b/pkg/chezmoibubbles/boolinputmodel_test.go
@@ -62,7 +62,11 @@ func TestBoolInputModel(t *testing.T) {
},
} {
t.Run(tc.name, func(t *testing.T) {
- actualModel := testRunModelWithInput(t, NewBoolInputModel("prompt", tc.defaultValue), tc.input)
+ actualModel := testRunModelWithInput(
+ t,
+ NewBoolInputModel("prompt", tc.defaultValue),
+ tc.input,
+ )
assert.Equal(t, tc.expectedCanceled, actualModel.Canceled())
assert.Equal(t, tc.expectedValue, actualModel.Value())
})
diff --git a/pkg/chezmoibubbles/chezmoibubbles_test.go b/pkg/chezmoibubbles/chezmoibubbles_test.go
index ecf2b5fdfa8..51c5c1f0e73 100644
--- a/pkg/chezmoibubbles/chezmoibubbles_test.go
+++ b/pkg/chezmoibubbles/chezmoibubbles_test.go
@@ -34,7 +34,11 @@ func makeKeyMsgs(s string) []tea.Msg { //nolint:ireturn,nolintlint
return msgs
}
-func testRunModelWithInput[M tea.Model](t *testing.T, model M, input string) M { //nolint:ireturn,nolintlint
+func testRunModelWithInput[M tea.Model]( //nolint:ireturn,nolintlint
+ t *testing.T,
+ model M,
+ input string,
+) M {
t.Helper()
for _, msg := range makeKeyMsgs(input) {
m, _ := model.Update(msg)
diff --git a/pkg/chezmoibubbles/choiceinputmodel_test.go b/pkg/chezmoibubbles/choiceinputmodel_test.go
index 6fcd658073a..4ffadeaa441 100644
--- a/pkg/chezmoibubbles/choiceinputmodel_test.go
+++ b/pkg/chezmoibubbles/choiceinputmodel_test.go
@@ -70,7 +70,11 @@ func TestChoiceInputModel(t *testing.T) {
},
} {
t.Run(tc.name, func(t *testing.T) {
- actualModel := testRunModelWithInput(t, NewChoiceInputModel("prompt", tc.choices, tc.defaultValue), tc.input)
+ actualModel := testRunModelWithInput(
+ t,
+ NewChoiceInputModel("prompt", tc.choices, tc.defaultValue),
+ tc.input,
+ )
assert.Equal(t, tc.expectedCanceled, actualModel.Canceled())
assert.Equal(t, tc.expectedValue, actualModel.Value())
})
diff --git a/pkg/chezmoibubbles/intinputmodel_test.go b/pkg/chezmoibubbles/intinputmodel_test.go
index 285573e3a85..fd6c3f418f2 100644
--- a/pkg/chezmoibubbles/intinputmodel_test.go
+++ b/pkg/chezmoibubbles/intinputmodel_test.go
@@ -52,7 +52,11 @@ func TestIntInputModel(t *testing.T) {
},
} {
t.Run(tc.name, func(t *testing.T) {
- actualModel := testRunModelWithInput(t, NewIntInputModel("prompt", tc.defaultValue), tc.input)
+ actualModel := testRunModelWithInput(
+ t,
+ NewIntInputModel("prompt", tc.defaultValue),
+ tc.input,
+ )
assert.Equal(t, tc.expectedCanceled, actualModel.Canceled())
assert.Equal(t, tc.expectedValue, actualModel.Value())
})
diff --git a/pkg/chezmoibubbles/stringinputmodel_test.go b/pkg/chezmoibubbles/stringinputmodel_test.go
index fce1f15874f..590a3de3e4a 100644
--- a/pkg/chezmoibubbles/stringinputmodel_test.go
+++ b/pkg/chezmoibubbles/stringinputmodel_test.go
@@ -47,7 +47,11 @@ func TestStringInputModel(t *testing.T) {
},
} {
t.Run(tc.name, func(t *testing.T) {
- actualModel := testRunModelWithInput(t, NewStringInputModel("prompt", tc.defaultValue), tc.input)
+ actualModel := testRunModelWithInput(
+ t,
+ NewStringInputModel("prompt", tc.defaultValue),
+ tc.input,
+ )
assert.Equal(t, tc.expectedCanceled, actualModel.Canceled())
assert.Equal(t, tc.expectedValue, actualModel.Value())
})
diff --git a/pkg/chezmoilog/chezmoilog.go b/pkg/chezmoilog/chezmoilog.go
index 9bb59a744d5..055e6edb3ac 100644
--- a/pkg/chezmoilog/chezmoilog.go
+++ b/pkg/chezmoilog/chezmoilog.go
@@ -101,7 +101,11 @@ func FirstFewBytes(data []byte) []byte {
// LogHTTPRequest calls httpClient.Do, logs the result to logger, and returns
// the result.
-func LogHTTPRequest(logger *zerolog.Logger, client *http.Client, req *http.Request) (*http.Response, error) {
+func LogHTTPRequest(
+ logger *zerolog.Logger,
+ client *http.Client,
+ req *http.Request,
+) (*http.Response, error) {
start := time.Now()
resp, err := client.Do(req)
if resp != nil {
diff --git a/pkg/cmd/addcmd.go b/pkg/cmd/addcmd.go
index a8fcbcbafe6..20e7a1eea35 100644
--- a/pkg/cmd/addcmd.go
+++ b/pkg/cmd/addcmd.go
@@ -39,17 +39,39 @@ func (c *Config) newAddCmd() *cobra.Command {
}
flags := addCmd.Flags()
- flags.BoolVar(&c.Add.create, "create", c.Add.create, "Add files that should exist, irrespective of their contents")
+ flags.BoolVar(
+ &c.Add.create,
+ "create",
+ c.Add.create,
+ "Add files that should exist, irrespective of their contents",
+ )
flags.BoolVar(&c.Add.encrypt, "encrypt", c.Add.encrypt, "Encrypt files")
flags.BoolVar(&c.Add.exact, "exact", c.Add.exact, "Add directories exactly")
flags.VarP(c.Add.filter.Exclude, "exclude", "x", "Exclude entry types")
- flags.BoolVarP(&c.Add.follow, "follow", "f", c.Add.follow, "Add symlink targets instead of symlinks")
+ flags.BoolVarP(
+ &c.Add.follow,
+ "follow",
+ "f",
+ c.Add.follow,
+ "Add symlink targets instead of symlinks",
+ )
flags.VarP(c.Add.filter.Include, "include", "i", "Include entry types")
flags.BoolVarP(&c.Add.prompt, "prompt", "p", c.Add.prompt, "Prompt before adding each entry")
flags.BoolVarP(&c.Add.quiet, "quiet", "q", c.Add.quiet, "Suppress warnings")
- flags.BoolVarP(&c.Add.recursive, "recursive", "r", c.Add.recursive, "Recurse into subdirectories")
+ flags.BoolVarP(
+ &c.Add.recursive,
+ "recursive",
+ "r",
+ c.Add.recursive,
+ "Recurse into subdirectories",
+ )
flags.BoolVarP(&c.Add.template, "template", "T", c.Add.template, "Add files as templates")
- flags.BoolVar(&c.Add.TemplateSymlinks, "template-symlinks", c.Add.TemplateSymlinks, "Add symlinks with target in source or home dirs as templates") //nolint:lll
+ flags.BoolVar(
+ &c.Add.TemplateSymlinks,
+ "template-symlinks",
+ c.Add.TemplateSymlinks,
+ "Add symlinks with target in source or home dirs as templates",
+ )
registerExcludeIncludeFlagCompletionFuncs(addCmd)
@@ -90,7 +112,8 @@ func (c *Config) defaultPreAddFunc(targetRelPath chezmoi.RelPath) error {
// defaultReplaceFunc prompts the user for confirmation if the adding the entry
// would remove any of the encrypted, private, or template attributes.
func (c *Config) defaultReplaceFunc(
- targetRelPath chezmoi.RelPath, newSourceStateEntry, oldSourceStateEntry chezmoi.SourceStateEntry,
+ targetRelPath chezmoi.RelPath,
+ newSourceStateEntry, oldSourceStateEntry chezmoi.SourceStateEntry,
) error {
if c.force {
return nil
@@ -116,7 +139,11 @@ func (c *Config) defaultReplaceFunc(
return nil
}
removedAttributesStr := englishListWithNoun(removedAttributes, "attribute", "")
- prompt := fmt.Sprintf("adding %s would remove %s, continue", targetRelPath, removedAttributesStr)
+ prompt := fmt.Sprintf(
+ "adding %s would remove %s, continue",
+ targetRelPath,
+ removedAttributesStr,
+ )
for {
switch choice, err := c.promptChoice(prompt, choicesYesNoAllQuit); {
@@ -137,7 +164,11 @@ func (c *Config) defaultReplaceFunc(
}
}
-func (c *Config) runAddCmd(cmd *cobra.Command, args []string, sourceState *chezmoi.SourceState) error {
+func (c *Config) runAddCmd(
+ cmd *cobra.Command,
+ args []string,
+ sourceState *chezmoi.SourceState,
+) error {
destAbsPathInfos, err := c.destAbsPathInfos(sourceState, args, destAbsPathInfosOptions{
follow: c.Mode == chezmoi.ModeSymlink || c.Add.follow,
recursive: c.Add.recursive,
@@ -151,23 +182,29 @@ func (c *Config) runAddCmd(cmd *cobra.Command, args []string, sourceState *chezm
return err
}
- return sourceState.Add(c.sourceSystem, c.persistentState, c.destSystem, destAbsPathInfos, &chezmoi.AddOptions{
- Create: c.Add.create,
- Encrypt: c.Add.encrypt,
- EncryptedSuffix: c.encryption.EncryptedSuffix(),
- Exact: c.Add.exact,
- Filter: c.Add.filter,
- OnIgnoreFunc: c.defaultOnIgnoreFunc,
- PreAddFunc: c.defaultPreAddFunc,
- ProtectedAbsPaths: []chezmoi.AbsPath{
- c.CacheDirAbsPath,
- c.WorkingTreeAbsPath,
- c.configFileAbsPath,
- persistentStateFileAbsPath,
- c.sourceDirAbsPath,
+ return sourceState.Add(
+ c.sourceSystem,
+ c.persistentState,
+ c.destSystem,
+ destAbsPathInfos,
+ &chezmoi.AddOptions{
+ Create: c.Add.create,
+ Encrypt: c.Add.encrypt,
+ EncryptedSuffix: c.encryption.EncryptedSuffix(),
+ Exact: c.Add.exact,
+ Filter: c.Add.filter,
+ OnIgnoreFunc: c.defaultOnIgnoreFunc,
+ PreAddFunc: c.defaultPreAddFunc,
+ ProtectedAbsPaths: []chezmoi.AbsPath{
+ c.CacheDirAbsPath,
+ c.WorkingTreeAbsPath,
+ c.configFileAbsPath,
+ persistentStateFileAbsPath,
+ c.sourceDirAbsPath,
+ },
+ ReplaceFunc: c.defaultReplaceFunc,
+ Template: c.Add.template,
+ TemplateSymlinks: c.Add.TemplateSymlinks,
},
- ReplaceFunc: c.defaultReplaceFunc,
- Template: c.Add.template,
- TemplateSymlinks: c.Add.TemplateSymlinks,
- })
+ )
}
diff --git a/pkg/cmd/addcmd_test.go b/pkg/cmd/addcmd_test.go
index 09f4856893e..e77deda571d 100644
--- a/pkg/cmd/addcmd_test.go
+++ b/pkg/cmd/addcmd_test.go
@@ -241,7 +241,10 @@ func TestAddCmd(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
chezmoitest.SkipUnlessGOOS(t, tc.name)
chezmoitest.WithTestFS(t, tc.root, func(fileSystem vfs.FS) {
- assert.NoError(t, newTestConfig(t, fileSystem).execute(append([]string{"add"}, tc.args...)))
+ assert.NoError(
+ t,
+ newTestConfig(t, fileSystem).execute(append([]string{"add"}, tc.args...)),
+ )
vfst.RunTests(t, fileSystem, "", tc.tests...)
})
})
@@ -260,6 +263,9 @@ func TestAddCmdChmod(t *testing.T) {
}, func(fileSystem vfs.FS) {
assert.NoError(t, newTestConfig(t, fileSystem).execute([]string{"add", "/home/user/.dir"}))
assert.NoError(t, fileSystem.Chmod("/home/user/.dir/subdir", 0o700))
- assert.NoError(t, newTestConfig(t, fileSystem).execute([]string{"add", "--force", "/home/user/.dir"}))
+ assert.NoError(
+ t,
+ newTestConfig(t, fileSystem).execute([]string{"add", "--force", "/home/user/.dir"}),
+ )
})
}
diff --git a/pkg/cmd/applycmd.go b/pkg/cmd/applycmd.go
index 49bb9ec60a3..4ed719eecf2 100644
--- a/pkg/cmd/applycmd.go
+++ b/pkg/cmd/applycmd.go
@@ -31,7 +31,13 @@ func (c *Config) newApplyCmd() *cobra.Command {
flags.VarP(c.apply.filter.Exclude, "exclude", "x", "Exclude entry types")
flags.VarP(c.apply.filter.Include, "include", "i", "Include entry types")
flags.BoolVar(&c.apply.init, "init", c.apply.init, "Recreate config file from template")
- flags.BoolVarP(&c.apply.recursive, "recursive", "r", c.apply.recursive, "Recurse into subdirectories")
+ flags.BoolVarP(
+ &c.apply.recursive,
+ "recursive",
+ "r",
+ c.apply.recursive,
+ "Recurse into subdirectories",
+ )
registerExcludeIncludeFlagCompletionFuncs(applyCmd)
diff --git a/pkg/cmd/applycmd_test.go b/pkg/cmd/applycmd_test.go
index 7c6e0dc33e0..bbb44f23d4a 100644
--- a/pkg/cmd/applycmd_test.go
+++ b/pkg/cmd/applycmd_test.go
@@ -205,7 +205,10 @@ func TestApplyCmd(t *testing.T) {
if tc.extraRoot != nil {
assert.NoError(t, vfst.NewBuilder().Build(fileSystem, tc.extraRoot))
}
- assert.NoError(t, newTestConfig(t, fileSystem).execute(append([]string{"apply"}, tc.args...)))
+ assert.NoError(
+ t,
+ newTestConfig(t, fileSystem).execute(append([]string{"apply"}, tc.args...)),
+ )
vfst.RunTests(t, fileSystem, "", tc.tests)
})
})
diff --git a/pkg/cmd/archivecmd.go b/pkg/cmd/archivecmd.go
index dca222a5291..d9c6ee8db2e 100644
--- a/pkg/cmd/archivecmd.go
+++ b/pkg/cmd/archivecmd.go
@@ -41,7 +41,13 @@ func (c *Config) newArchiveCmd() *cobra.Command {
flags.BoolVarP(&c.archive.gzip, "gzip", "z", c.archive.gzip, "Compress output with gzip")
flags.VarP(c.archive.filter.Exclude, "include", "i", "Include entry types")
flags.BoolVar(&c.archive.init, "init", c.archive.init, "Recreate config file from template")
- flags.BoolVarP(&c.archive.recursive, "recursive", "r", c.archive.recursive, "Recurse into subdirectories")
+ flags.BoolVarP(
+ &c.archive.recursive,
+ "recursive",
+ "r",
+ c.archive.recursive,
+ "Recurse into subdirectories",
+ )
registerExcludeIncludeFlagCompletionFuncs(archiveCmd)
diff --git a/pkg/cmd/awssecretsmanagertemplatefuncs.go b/pkg/cmd/awssecretsmanagertemplatefuncs.go
index 1bd2c061179..082f06f4361 100644
--- a/pkg/cmd/awssecretsmanagertemplatefuncs.go
+++ b/pkg/cmd/awssecretsmanagertemplatefuncs.go
@@ -11,7 +11,7 @@ import (
)
type awsSecretsManagerConfig struct {
- Region string `json:"region" mapstructure:"region" yaml:"region"`
+ Region string `json:"region" mapstructure:"region" yaml:"region"`
Profile string `json:"profile" mapstructure:"profile" yaml:"profile"`
svc *secretsmanager.Client
cache map[string]string
@@ -42,9 +42,12 @@ func (c *Config) awsSecretsManagerRawTemplateFunc(arn string) string {
c.AWSSecretsManager.svc = secretsmanager.NewFromConfig(cfg)
}
- result, err := c.AWSSecretsManager.svc.GetSecretValue(context.Background(), &secretsmanager.GetSecretValueInput{
- SecretId: aws.String(arn),
- })
+ result, err := c.AWSSecretsManager.svc.GetSecretValue(
+ context.Background(),
+ &secretsmanager.GetSecretValueInput{
+ SecretId: aws.String(arn),
+ },
+ )
if err != nil {
panic(err)
}
diff --git a/pkg/cmd/bitwardentemplatefuncs.go b/pkg/cmd/bitwardentemplatefuncs.go
index e555268defe..cdd5ae1ebe2 100644
--- a/pkg/cmd/bitwardentemplatefuncs.go
+++ b/pkg/cmd/bitwardentemplatefuncs.go
@@ -15,7 +15,9 @@ type bitwardenConfig struct {
}
func (c *Config) bitwardenAttachmentTemplateFunc(name, itemID string) string {
- output, err := c.bitwardenOutput([]string{"get", "attachment", name, "--itemid", itemID, "--raw"})
+ output, err := c.bitwardenOutput(
+ []string{"get", "attachment", name, "--itemid", itemID, "--raw"},
+ )
if err != nil {
panic(err)
}
diff --git a/pkg/cmd/catcmd.go b/pkg/cmd/catcmd.go
index fcedbdb70bd..d9377b5a626 100644
--- a/pkg/cmd/catcmd.go
+++ b/pkg/cmd/catcmd.go
@@ -26,7 +26,11 @@ func (c *Config) newCatCmd() *cobra.Command {
return catCmd
}
-func (c *Config) runCatCmd(cmd *cobra.Command, args []string, sourceState *chezmoi.SourceState) error {
+func (c *Config) runCatCmd(
+ cmd *cobra.Command,
+ args []string,
+ sourceState *chezmoi.SourceState,
+) error {
targetRelPaths, err := c.targetRelPaths(sourceState, args, targetRelPathsOptions{
mustBeManaged: true,
})
@@ -37,7 +41,10 @@ func (c *Config) runCatCmd(cmd *cobra.Command, args []string, sourceState *chezm
builder := strings.Builder{}
for _, targetRelPath := range targetRelPaths {
sourceStateEntry := sourceState.MustEntry(targetRelPath)
- targetStateEntry, err := sourceStateEntry.TargetStateEntry(c.destSystem, c.DestDirAbsPath.Join(targetRelPath))
+ targetStateEntry, err := sourceStateEntry.TargetStateEntry(
+ c.destSystem,
+ c.DestDirAbsPath.Join(targetRelPath),
+ )
if err != nil {
return fmt.Errorf("%s: %w", targetRelPath, err)
}
diff --git a/pkg/cmd/cdcmd.go b/pkg/cmd/cdcmd.go
index 57d268bd349..27301e1a7fa 100644
--- a/pkg/cmd/cdcmd.go
+++ b/pkg/cmd/cdcmd.go
@@ -12,7 +12,7 @@ import (
type cdCmdConfig struct {
Command string `json:"command" mapstructure:"command" yaml:"command"`
- Args []string `json:"args" mapstructure:"args" yaml:"args"`
+ Args []string `json:"args" mapstructure:"args" yaml:"args"`
}
func (c *Config) newCDCmd() *cobra.Command {
diff --git a/pkg/cmd/chattrcmd.go b/pkg/cmd/chattrcmd.go
index b72da2fe7ef..eb708d07217 100644
--- a/pkg/cmd/chattrcmd.go
+++ b/pkg/cmd/chattrcmd.go
@@ -97,7 +97,13 @@ func (c *Config) newChattrCmd() *cobra.Command {
}
flags := chattrCmd.Flags()
- flags.BoolVarP(&c.chattr.recursive, "recursive", "r", c.chattr.recursive, "Recurse into subdirectories")
+ flags.BoolVarP(
+ &c.chattr.recursive,
+ "recursive",
+ "r",
+ c.chattr.recursive,
+ "Recurse into subdirectories",
+ )
return chattrCmd
}
@@ -153,7 +159,11 @@ func (c *Config) chattrCmdValidArgs(
}
}
-func (c *Config) runChattrCmd(cmd *cobra.Command, args []string, sourceState *chezmoi.SourceState) error {
+func (c *Config) runChattrCmd(
+ cmd *cobra.Command,
+ args []string,
+ sourceState *chezmoi.SourceState,
+) error {
// LATER should the core functionality of chattr move to chezmoi.SourceState?
m, err := parseModifier(args[0])
@@ -299,7 +309,9 @@ func (m orderModifier) modify(order chezmoi.ScriptOrder) chezmoi.ScriptOrder {
}
// modify returns the modified value of type.
-func (m sourceDirTypeModifier) modify(sourceDirType chezmoi.SourceDirTargetType) chezmoi.SourceDirTargetType {
+func (m sourceDirTypeModifier) modify(
+ sourceDirType chezmoi.SourceDirTargetType,
+) chezmoi.SourceDirTargetType {
switch m {
case sourceDirTypeModifierLeaveUnchanged:
return sourceDirType
@@ -316,7 +328,9 @@ func (m sourceDirTypeModifier) modify(sourceDirType chezmoi.SourceDirTargetType)
}
// modify returns the modified value of type.
-func (m sourceFileTypeModifier) modify(sourceFileType chezmoi.SourceFileTargetType) chezmoi.SourceFileTargetType {
+func (m sourceFileTypeModifier) modify(
+ sourceFileType chezmoi.SourceFileTargetType,
+) chezmoi.SourceFileTargetType {
switch m {
case sourceFileTypeModifierLeaveUnchanged:
return sourceFileType
diff --git a/pkg/cmd/chattrcmd_test.go b/pkg/cmd/chattrcmd_test.go
index f0eba2babf4..4639911193c 100644
--- a/pkg/cmd/chattrcmd_test.go
+++ b/pkg/cmd/chattrcmd_test.go
@@ -49,7 +49,11 @@ func TestChattrCmdValidArgs(t *testing.T) {
name := fmt.Sprintf("chattrValidArgs(_, %+v, %q)", tc.args, tc.toComplete)
t.Run(name, func(t *testing.T) {
c := &Config{}
- actualCompletions, actualShellCompDirective := c.chattrCmdValidArgs(&cobra.Command{}, tc.args, tc.toComplete)
+ actualCompletions, actualShellCompDirective := c.chattrCmdValidArgs(
+ &cobra.Command{},
+ tc.args,
+ tc.toComplete,
+ )
assert.Equal(t, tc.expectedCompletions, actualCompletions)
assert.Equal(t, tc.expectedShellCompDirective, actualShellCompDirective)
})
diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go
index 924e6677cc6..fee108e4551 100644
--- a/pkg/cmd/cmd.go
+++ b/pkg/cmd/cmd.go
@@ -287,7 +287,9 @@ func runMain(versionInfo VersionInfo, args []string) (err error) {
// Translate bbolt timeout errors into a friendlier message. As the
// persistent state is opened lazily, this error could occur at any
// time, so it's easiest to intercept it here.
- err = errors.New("timeout obtaining persistent state lock, is another instance of chezmoi running?")
+ err = errors.New(
+ "timeout obtaining persistent state lock, is another instance of chezmoi running?",
+ )
}
return
}
diff --git a/pkg/cmd/config.go b/pkg/cmd/config.go
index da3ed10612c..9adb7a17ba8 100644
--- a/pkg/cmd/config.go
+++ b/pkg/cmd/config.go
@@ -72,11 +72,11 @@ type doPurgeOptions struct {
type commandConfig struct {
Command string `json:"command" mapstructure:"command" yaml:"command"`
- Args []string `json:"args" mapstructure:"args" yaml:"args"`
+ Args []string `json:"args" mapstructure:"args" yaml:"args"`
}
type hookConfig struct {
- Pre commandConfig `json:"pre" mapstructure:"pre" yaml:"pre"`
+ Pre commandConfig `json:"pre" mapstructure:"pre" yaml:"pre"`
Post commandConfig `json:"post" mapstructure:"post" yaml:"post"`
}
@@ -85,69 +85,69 @@ type templateConfig struct {
}
type warningsConfig struct {
- ConfigFileTemplateHasChanged bool `json:"configFileTemplateHasChanged" mapstructure:"configFileTemplateHasChanged" yaml:"configFileTemplateHasChanged"` //nolint:lll
+ ConfigFileTemplateHasChanged bool `json:"configFileTemplateHasChanged" mapstructure:"configFileTemplateHasChanged" yaml:"configFileTemplateHasChanged"`
}
// ConfigFile contains all data settable in the config file.
type ConfigFile struct {
// Global configuration.
- CacheDirAbsPath chezmoi.AbsPath `json:"cacheDir" mapstructure:"cacheDir" yaml:"cacheDir"`
- Color autoBool `json:"color" mapstructure:"color" yaml:"color"`
- Data map[string]any `json:"data" mapstructure:"data" yaml:"data"`
- Format writeDataFormat `json:"format" mapstructure:"format" yaml:"format"`
- DestDirAbsPath chezmoi.AbsPath `json:"destDir" mapstructure:"destDir" yaml:"destDir"`
- GitHub gitHubConfig `json:"gitHub" mapstructure:"gitHub" yaml:"gitHub"`
- Hooks map[string]hookConfig `json:"hooks" mapstructure:"hooks" yaml:"hooks"`
- Interpreters map[string]*chezmoi.Interpreter `json:"interpreters" mapstructure:"interpreters" yaml:"interpreters"` //nolint:lll
- Mode chezmoi.Mode `json:"mode" mapstructure:"mode" yaml:"mode"`
- Pager string `json:"pager" mapstructure:"pager" yaml:"pager"`
- PINEntry pinEntryConfig `json:"pinentry" mapstructure:"pinentry" yaml:"pinentry"`
- Progress autoBool `json:"progress" mapstructure:"progress" yaml:"progress"`
- Safe bool `json:"safe" mapstructure:"safe" yaml:"safe"`
- ScriptEnv map[string]string `json:"scriptEnv" mapstructure:"scriptEnv" yaml:"scriptEnv"`
- ScriptTempDir chezmoi.AbsPath `json:"scriptTempDir" mapstructure:"scriptTempDir" yaml:"scriptTempDir"` //nolint:lll
- SourceDirAbsPath chezmoi.AbsPath `json:"sourceDir" mapstructure:"sourceDir" yaml:"sourceDir"`
- Template templateConfig `json:"template" mapstructure:"template" yaml:"template"`
- TextConv textConv `json:"textConv" mapstructure:"textConv" yaml:"textConv"`
- Umask fs.FileMode `json:"umask" mapstructure:"umask" yaml:"umask"`
- UseBuiltinAge autoBool `json:"useBuiltinAge" mapstructure:"useBuiltinAge" yaml:"useBuiltinAge"` //nolint:lll
- UseBuiltinGit autoBool `json:"useBuiltinGit" mapstructure:"useBuiltinGit" yaml:"useBuiltinGit"` //nolint:lll
- Verbose bool `json:"verbose" mapstructure:"verbose" yaml:"verbose"`
- Warnings warningsConfig `json:"warnings" mapstructure:"warnings" yaml:"warnings"`
- WorkingTreeAbsPath chezmoi.AbsPath `json:"workingTree" mapstructure:"workingTree" yaml:"workingTree"`
+ CacheDirAbsPath chezmoi.AbsPath `json:"cacheDir" mapstructure:"cacheDir" yaml:"cacheDir"`
+ Color autoBool `json:"color" mapstructure:"color" yaml:"color"`
+ Data map[string]any `json:"data" mapstructure:"data" yaml:"data"`
+ Format writeDataFormat `json:"format" mapstructure:"format" yaml:"format"`
+ DestDirAbsPath chezmoi.AbsPath `json:"destDir" mapstructure:"destDir" yaml:"destDir"`
+ GitHub gitHubConfig `json:"gitHub" mapstructure:"gitHub" yaml:"gitHub"`
+ Hooks map[string]hookConfig `json:"hooks" mapstructure:"hooks" yaml:"hooks"`
+ Interpreters map[string]*chezmoi.Interpreter `json:"interpreters" mapstructure:"interpreters" yaml:"interpreters"`
+ Mode chezmoi.Mode `json:"mode" mapstructure:"mode" yaml:"mode"`
+ Pager string `json:"pager" mapstructure:"pager" yaml:"pager"`
+ PINEntry pinEntryConfig `json:"pinentry" mapstructure:"pinentry" yaml:"pinentry"`
+ Progress autoBool `json:"progress" mapstructure:"progress" yaml:"progress"`
+ Safe bool `json:"safe" mapstructure:"safe" yaml:"safe"`
+ ScriptEnv map[string]string `json:"scriptEnv" mapstructure:"scriptEnv" yaml:"scriptEnv"`
+ ScriptTempDir chezmoi.AbsPath `json:"scriptTempDir" mapstructure:"scriptTempDir" yaml:"scriptTempDir"`
+ SourceDirAbsPath chezmoi.AbsPath `json:"sourceDir" mapstructure:"sourceDir" yaml:"sourceDir"`
+ Template templateConfig `json:"template" mapstructure:"template" yaml:"template"`
+ TextConv textConv `json:"textConv" mapstructure:"textConv" yaml:"textConv"`
+ Umask fs.FileMode `json:"umask" mapstructure:"umask" yaml:"umask"`
+ UseBuiltinAge autoBool `json:"useBuiltinAge" mapstructure:"useBuiltinAge" yaml:"useBuiltinAge"`
+ UseBuiltinGit autoBool `json:"useBuiltinGit" mapstructure:"useBuiltinGit" yaml:"useBuiltinGit"`
+ Verbose bool `json:"verbose" mapstructure:"verbose" yaml:"verbose"`
+ Warnings warningsConfig `json:"warnings" mapstructure:"warnings" yaml:"warnings"`
+ WorkingTreeAbsPath chezmoi.AbsPath `json:"workingTree" mapstructure:"workingTree" yaml:"workingTree"`
// Password manager configurations.
- AWSSecretsManager awsSecretsManagerConfig `json:"awsSecretsManager" mapstructure:"awsSecretsManager" yaml:"awsSecretsManager"` //nolint:lll
- Bitwarden bitwardenConfig `json:"bitwarden" mapstructure:"bitwarden" yaml:"bitwarden"`
- Dashlane dashlaneConfig `json:"dashlane" mapstructure:"dashlane" yaml:"dashlane"`
- Ejson ejsonConfig `json:"ejson" mapstructure:"ejson" yaml:"ejson"`
- Gopass gopassConfig `json:"gopass" mapstructure:"gopass" yaml:"gopass"`
- Keepassxc keepassxcConfig `json:"keepassxc" mapstructure:"keepassxc" yaml:"keepassxc"`
- Keeper keeperConfig `json:"keeper" mapstructure:"keeper" yaml:"keeper"`
- Lastpass lastpassConfig `json:"lastpass" mapstructure:"lastpass" yaml:"lastpass"`
- Onepassword onepasswordConfig `json:"onepassword" mapstructure:"onepassword" yaml:"onepassword"`
- Pass passConfig `json:"pass" mapstructure:"pass" yaml:"pass"`
- Passhole passholeConfig `json:"passhole" mapstructure:"passhole" yaml:"passhole"`
- RBW rbwConfig `json:"rbw" mapstructure:"rbw" yaml:"rbw"`
- Secret secretConfig `json:"secret" mapstructure:"secret" yaml:"secret"`
- Vault vaultConfig `json:"vault" mapstructure:"vault" yaml:"vault"`
+ AWSSecretsManager awsSecretsManagerConfig `json:"awsSecretsManager" mapstructure:"awsSecretsManager" yaml:"awsSecretsManager"`
+ Bitwarden bitwardenConfig `json:"bitwarden" mapstructure:"bitwarden" yaml:"bitwarden"`
+ Dashlane dashlaneConfig `json:"dashlane" mapstructure:"dashlane" yaml:"dashlane"`
+ Ejson ejsonConfig `json:"ejson" mapstructure:"ejson" yaml:"ejson"`
+ Gopass gopassConfig `json:"gopass" mapstructure:"gopass" yaml:"gopass"`
+ Keepassxc keepassxcConfig `json:"keepassxc" mapstructure:"keepassxc" yaml:"keepassxc"`
+ Keeper keeperConfig `json:"keeper" mapstructure:"keeper" yaml:"keeper"`
+ Lastpass lastpassConfig `json:"lastpass" mapstructure:"lastpass" yaml:"lastpass"`
+ Onepassword onepasswordConfig `json:"onepassword" mapstructure:"onepassword" yaml:"onepassword"`
+ Pass passConfig `json:"pass" mapstructure:"pass" yaml:"pass"`
+ Passhole passholeConfig `json:"passhole" mapstructure:"passhole" yaml:"passhole"`
+ RBW rbwConfig `json:"rbw" mapstructure:"rbw" yaml:"rbw"`
+ Secret secretConfig `json:"secret" mapstructure:"secret" yaml:"secret"`
+ Vault vaultConfig `json:"vault" mapstructure:"vault" yaml:"vault"`
// Encryption configurations.
Encryption string `json:"encryption" mapstructure:"encryption" yaml:"encryption"`
- Age chezmoi.AgeEncryption `json:"age" mapstructure:"age" yaml:"age"`
- GPG chezmoi.GPGEncryption `json:"gpg" mapstructure:"gpg" yaml:"gpg"`
+ Age chezmoi.AgeEncryption `json:"age" mapstructure:"age" yaml:"age"`
+ GPG chezmoi.GPGEncryption `json:"gpg" mapstructure:"gpg" yaml:"gpg"`
// Command configurations.
- Add addCmdConfig `json:"add" mapstructure:"add" yaml:"add"`
- CD cdCmdConfig `json:"cd" mapstructure:"cd" yaml:"cd"`
+ Add addCmdConfig `json:"add" mapstructure:"add" yaml:"add"`
+ CD cdCmdConfig `json:"cd" mapstructure:"cd" yaml:"cd"`
Completion completionCmdConfig `json:"completion" mapstructure:"completion" yaml:"completion"`
- Diff diffCmdConfig `json:"diff" mapstructure:"diff" yaml:"diff"`
- Edit editCmdConfig `json:"edit" mapstructure:"edit" yaml:"edit"`
- Git gitCmdConfig `json:"git" mapstructure:"git" yaml:"git"`
- Merge mergeCmdConfig `json:"merge" mapstructure:"merge" yaml:"merge"`
- Status statusCmdConfig `json:"status" mapstructure:"status" yaml:"status"`
- Update updateCmdConfig `json:"update" mapstructure:"update" yaml:"update"`
- Verify verifyCmdConfig `json:"verify" mapstructure:"verify" yaml:"verify"`
+ Diff diffCmdConfig `json:"diff" mapstructure:"diff" yaml:"diff"`
+ Edit editCmdConfig `json:"edit" mapstructure:"edit" yaml:"edit"`
+ Git gitCmdConfig `json:"git" mapstructure:"git" yaml:"git"`
+ Merge mergeCmdConfig `json:"merge" mapstructure:"merge" yaml:"merge"`
+ Status statusCmdConfig `json:"status" mapstructure:"status" yaml:"status"`
+ Update updateCmdConfig `json:"update" mapstructure:"update" yaml:"update"`
+ Verify verifyCmdConfig `json:"verify" mapstructure:"verify" yaml:"verify"`
}
// A Config represents a configuration.
@@ -263,7 +263,7 @@ type templateData struct {
type configOption func(*Config) error
type configState struct {
- ConfigTemplateContentsSHA256 chezmoi.HexBytes `json:"configTemplateContentsSHA256" yaml:"configTemplateContentsSHA256"` //nolint:lll,tagliatelle
+ ConfigTemplateContentsSHA256 chezmoi.HexBytes `json:"configTemplateContentsSHA256" yaml:"configTemplateContentsSHA256"` //nolint:tagliatelle
}
var (
@@ -329,8 +329,11 @@ func newConfig(options ...configOption) (*Config, error) {
filter: chezmoi.NewEntryTypeFilter(chezmoi.EntryTypesAll, chezmoi.EntryTypesNone),
},
init: initCmdConfig{
- data: true,
- filter: chezmoi.NewEntryTypeFilter(chezmoi.EntryTypesAll, chezmoi.EntryTypesNone),
+ data: true,
+ filter: chezmoi.NewEntryTypeFilter(
+ chezmoi.EntryTypesAll,
+ chezmoi.EntryTypesNone,
+ ),
guessRepoURL: true,
recurseSubmodules: true,
},
@@ -504,7 +507,10 @@ type applyArgsOptions struct {
// source state for each target entry in args. If args is empty then the source
// state is applied to all target entries.
func (c *Config) applyArgs(
- ctx context.Context, targetSystem chezmoi.System, targetDirAbsPath chezmoi.AbsPath, args []string,
+ ctx context.Context,
+ targetSystem chezmoi.System,
+ targetDirAbsPath chezmoi.AbsPath,
+ args []string,
options applyArgsOptions,
) error {
if options.init {
@@ -531,7 +537,8 @@ func (c *Config) applyArgs(
}
previousConfigTemplateContentsSHA256 = []byte(configState.ConfigTemplateContentsSHA256)
}
- configTemplatesEmpty := currentConfigTemplateContentsSHA256 == nil && previousConfigTemplateContentsSHA256 == nil
+ configTemplatesEmpty := currentConfigTemplateContentsSHA256 == nil &&
+ previousConfigTemplateContentsSHA256 == nil
configTemplateContentsUnchanged := configTemplatesEmpty ||
bytes.Equal(currentConfigTemplateContentsSHA256, previousConfigTemplateContentsSHA256)
if !configTemplateContentsUnchanged {
@@ -691,7 +698,11 @@ func (c *Config) createAndReloadConfigFile(cmd *cobra.Command) error {
return c.persistentState.Delete(chezmoi.ConfigStateBucket, configStateKey)
}
- configFileContents, err := c.createConfigFile(configTemplate.targetRelPath, configTemplate.contents, cmd)
+ configFileContents, err := c.createConfigFile(
+ configTemplate.targetRelPath,
+ configTemplate.contents,
+ cmd,
+ )
if err != nil {
return err
}
@@ -705,7 +716,8 @@ func (c *Config) createAndReloadConfigFile(cmd *cobra.Command) error {
// Write the config.
configPath := c.init.configPath
if c.init.configPath.Empty() {
- configPath = chezmoi.NewAbsPath(c.bds.ConfigHome).Join(chezmoiRelPath, configTemplate.targetRelPath)
+ configPath = chezmoi.NewAbsPath(c.bds.ConfigHome).
+ Join(chezmoiRelPath, configTemplate.targetRelPath)
}
if err := chezmoi.MkdirAll(c.baseSystem, configPath.Dir(), fs.ModePerm); err != nil {
return err
@@ -733,7 +745,11 @@ func (c *Config) createAndReloadConfigFile(cmd *cobra.Command) error {
// createConfigFile creates a config file using a template and returns its
// contents.
-func (c *Config) createConfigFile(filename chezmoi.RelPath, data []byte, cmd *cobra.Command) ([]byte, error) {
+func (c *Config) createConfigFile(
+ filename chezmoi.RelPath,
+ data []byte,
+ cmd *cobra.Command,
+) ([]byte, error) {
funcMap := make(template.FuncMap)
chezmoi.RecursiveMerge(funcMap, c.templateFuncs)
initTemplateFuncs := map[string]any{
@@ -765,7 +781,10 @@ func (c *Config) createConfigFile(filename chezmoi.RelPath, data []byte, cmd *co
// defaultConfigFile returns the default config file according to the XDG Base
// Directory Specification.
-func (c *Config) defaultConfigFile(fileSystem vfs.FS, bds *xdg.BaseDirectorySpecification) (chezmoi.AbsPath, error) {
+func (c *Config) defaultConfigFile(
+ fileSystem vfs.FS,
+ bds *xdg.BaseDirectorySpecification,
+) (chezmoi.AbsPath, error) {
// Search XDG Base Directory Specification config directories first.
CONFIG_DIR:
for _, configDir := range bds.ConfigDirs {
@@ -819,7 +838,11 @@ CONFIG_DIR:
}
// decodeConfigBytes decodes data in format into configFile.
-func (c *Config) decodeConfigBytes(format chezmoi.Format, data []byte, configFile *ConfigFile) error {
+func (c *Config) decodeConfigBytes(
+ format chezmoi.Format,
+ data []byte,
+ configFile *ConfigFile,
+) error {
var configMap map[string]any
if err := format.Unmarshal(data, &configMap); err != nil {
return err
@@ -875,7 +898,8 @@ func (c *Config) decodeConfigMap(configMap map[string]any, configFile *ConfigFil
// has changed since chezmoi last wrote it then it prompts the user for the
// action to take.
func (c *Config) defaultPreApplyFunc(
- targetRelPath chezmoi.RelPath, targetEntryState, lastWrittenEntryState, actualEntryState *chezmoi.EntryState,
+ targetRelPath chezmoi.RelPath,
+ targetEntryState, lastWrittenEntryState, actualEntryState *chezmoi.EntryState,
) error {
c.logger.Info().
Stringer("targetRelPath", targetRelPath).
@@ -975,7 +999,10 @@ func (c *Config) defaultPreApplyFunc(
// defaultSourceDir returns the default source directory according to the XDG
// Base Directory Specification.
-func (c *Config) defaultSourceDir(fileSystem vfs.Stater, bds *xdg.BaseDirectorySpecification) (chezmoi.AbsPath, error) {
+func (c *Config) defaultSourceDir(
+ fileSystem vfs.Stater,
+ bds *xdg.BaseDirectorySpecification,
+) (chezmoi.AbsPath, error) {
// Check for XDG Base Directory Specification data directories first.
for _, dataDir := range bds.DataDirs {
dataDirAbsPath, err := chezmoi.NewAbsPathFromExtPath(dataDir, c.homeDirAbsPath)
@@ -1031,7 +1058,12 @@ func (c *Config) destAbsPathInfos(
return err
}
}
- return sourceState.AddDestAbsPathInfos(destAbsPathInfos, c.destSystem, destAbsPath, fileInfo)
+ return sourceState.AddDestAbsPathInfos(
+ destAbsPathInfos,
+ c.destSystem,
+ destAbsPath,
+ fileInfo,
+ )
}
if err := chezmoi.Walk(c.destSystem, destAbsPath, walkFunc); err != nil {
return nil, err
@@ -1225,7 +1257,10 @@ func (c *Config) findConfigTemplate() (*configTemplate, error) {
sourceAbsPathStr := configTemplate.sourceAbsPath.String()
sourceAbsPathStrs = append(sourceAbsPathStrs, sourceAbsPathStr)
}
- return nil, fmt.Errorf("multiple config file templates: %s ", englishList(sourceAbsPathStrs))
+ return nil, fmt.Errorf(
+ "multiple config file templates: %s ",
+ englishList(sourceAbsPathStrs),
+ )
}
}
@@ -1270,7 +1305,10 @@ func (c *Config) getSourceDirAbsPath(options *getSourceDirAbsPathOptions) (chezm
return c.sourceDirAbsPath, c.sourceDirAbsPathErr
}
-func (c *Config) getSourceState(ctx context.Context, cmd *cobra.Command) (*chezmoi.SourceState, error) {
+func (c *Config) getSourceState(
+ ctx context.Context,
+ cmd *cobra.Command,
+) (*chezmoi.SourceState, error) {
if c.sourceState != nil || c.sourceStateErr != nil {
return c.sourceState, c.sourceStateErr
}
@@ -1322,7 +1360,11 @@ func (c *Config) gitAutoAdd() (*git.Status, error) {
if err := c.run(c.WorkingTreeAbsPath, c.Git.Command, []string{"add", "."}); err != nil {
return nil, err
}
- output, err := c.cmdOutput(c.WorkingTreeAbsPath, c.Git.Command, []string{"status", "--porcelain=v2"})
+ output, err := c.cmdOutput(
+ c.WorkingTreeAbsPath,
+ c.Git.Command,
+ []string{"status", "--porcelain=v2"},
+ )
if err != nil {
return nil, err
}
@@ -1341,13 +1383,20 @@ func (c *Config) gitAutoCommit(status *git.Status) error {
"promptInt": c.promptIntInteractiveTemplateFunc,
"promptString": c.promptStringInteractiveTemplateFunc,
"targetRelPath": func(source string) string {
- return chezmoi.NewSourceRelPath(source).TargetRelPath(c.encryption.EncryptedSuffix()).String()
+ return chezmoi.NewSourceRelPath(source).
+ TargetRelPath(c.encryption.EncryptedSuffix()).
+ String()
},
})
templateOptions := chezmoi.TemplateOptions{
Options: append([]string(nil), c.Template.Options...),
}
- commitMessageTmpl, err := chezmoi.ParseTemplate("commit_message", []byte(c.Git.CommitMessageTemplate), funcMap, templateOptions) //nolint:lll
+ commitMessageTmpl, err := chezmoi.ParseTemplate(
+ "commit_message",
+ []byte(c.Git.CommitMessageTemplate),
+ funcMap,
+ templateOptions,
+ )
if err != nil {
return err
}
@@ -1355,7 +1404,11 @@ func (c *Config) gitAutoCommit(status *git.Status) error {
if err != nil {
return err
}
- return c.run(c.WorkingTreeAbsPath, c.Git.Command, []string{"commit", "--message", string(commitMessage)})
+ return c.run(
+ c.WorkingTreeAbsPath,
+ c.Git.Command,
+ []string{"commit", "--message", string(commitMessage)},
+ )
}
// gitAutoPush pushes all changes to the remote if status is not empty.
@@ -1420,16 +1473,33 @@ func (c *Config) newRootCmd() (*cobra.Command, error) {
persistentFlags.Var(&c.configFormat, "config-format", "Set config file format")
persistentFlags.Var(&c.cpuProfile, "cpu-profile", "Write a CPU profile to path")
persistentFlags.BoolVar(&c.debug, "debug", c.debug, "Include debug information in output")
- persistentFlags.BoolVarP(&c.dryRun, "dry-run", "n", c.dryRun, "Do not make any modifications to the destination directory") //nolint:lll
+ persistentFlags.BoolVarP(
+ &c.dryRun,
+ "dry-run",
+ "n",
+ c.dryRun,
+ "Do not make any modifications to the destination directory",
+ )
persistentFlags.BoolVar(&c.force, "force", c.force, "Make all changes without prompting")
persistentFlags.BoolVar(&c.interactive, "interactive", c.interactive, "Prompt for all changes")
- persistentFlags.BoolVarP(&c.keepGoing, "keep-going", "k", c.keepGoing, "Keep going as far as possible after an error")
+ persistentFlags.BoolVarP(
+ &c.keepGoing,
+ "keep-going",
+ "k",
+ c.keepGoing,
+ "Keep going as far as possible after an error",
+ )
persistentFlags.BoolVar(&c.noPager, "no-pager", c.noPager, "Do not use the pager")
persistentFlags.BoolVar(&c.noTTY, "no-tty", c.noTTY, "Do not attempt to get a TTY for prompts")
persistentFlags.VarP(&c.outputAbsPath, "output", "o", "Write output to path instead of stdout")
persistentFlags.VarP(&c.refreshExternals, "refresh-externals", "R", "Refresh external cache")
persistentFlags.Lookup("refresh-externals").NoOptDefVal = chezmoi.RefreshExternalsAlways.String()
- persistentFlags.BoolVar(&c.sourcePath, "source-path", c.sourcePath, "Specify targets by source path")
+ persistentFlags.BoolVar(
+ &c.sourcePath,
+ "source-path",
+ c.sourcePath,
+ "Specify targets by source path",
+ )
if err := multierr.Combine(
rootCmd.MarkPersistentFlagFilename("config"),
@@ -1504,11 +1574,18 @@ func (c *Config) newRootCmd() (*cobra.Command, error) {
// newDiffSystem returns a system that logs all changes to s to w using
// diff.command if set or the builtin git diff otherwise.
-func (c *Config) newDiffSystem(s chezmoi.System, w io.Writer, dirAbsPath chezmoi.AbsPath) chezmoi.System {
+func (c *Config) newDiffSystem(
+ s chezmoi.System,
+ w io.Writer,
+ dirAbsPath chezmoi.AbsPath,
+) chezmoi.System {
if c.Diff.useBuiltinDiff || c.Diff.Command == "" {
options := &chezmoi.GitDiffSystemOptions{
- Color: c.Color.Value(c.colorAutoFunc),
- Filter: chezmoi.NewEntryTypeFilter(c.Diff.include.Bits(), c.Diff.Exclude.Bits()),
+ Color: c.Color.Value(c.colorAutoFunc),
+ Filter: chezmoi.NewEntryTypeFilter(
+ c.Diff.include.Bits(),
+ c.Diff.Exclude.Bits(),
+ ),
Reverse: c.Diff.Reverse,
ScriptContents: c.Diff.ScriptContents,
TextConvFunc: c.TextConv.convert,
@@ -1696,7 +1773,9 @@ func (c *Config) persistentPreRunRootE(cmd *cobra.Command, args []string) error
if runtime.GOOS == "windows" {
var err error
- c.restoreWindowsConsole, err = termenv.EnableVirtualTerminalProcessing(termenv.DefaultOutput())
+ c.restoreWindowsConsole, err = termenv.EnableVirtualTerminalProcessing(
+ termenv.DefaultOutput(),
+ )
if err != nil {
return err
}
@@ -1823,8 +1902,13 @@ func (c *Config) persistentPreRunRootE(cmd *cobra.Command, args []string) error
c.persistentState = chezmoi.NullPersistentState{}
}
if c.debug && c.persistentState != nil {
- persistentStateLogger := c.logger.With().Str(logComponentKey, logComponentValuePersistentState).Logger()
- c.persistentState = chezmoi.NewDebugPersistentState(c.persistentState, &persistentStateLogger)
+ persistentStateLogger := c.logger.With().
+ Str(logComponentKey, logComponentValuePersistentState).
+ Logger()
+ c.persistentState = chezmoi.NewDebugPersistentState(
+ c.persistentState,
+ &persistentStateLogger,
+ )
}
// Set up the source and destination systems.
@@ -2172,7 +2256,11 @@ func (c *Config) runEditor(args []string) error {
err = c.run(chezmoi.EmptyAbsPath, editor, editorArgs)
if runtime.GOOS != "windows" && c.Edit.MinDuration != 0 {
if duration := time.Since(start); duration < c.Edit.MinDuration {
- c.errorf("warning: %s: returned in less than %s\n", shellQuoteCommand(editor, editorArgs), c.Edit.MinDuration)
+ c.errorf(
+ "warning: %s: returned in less than %s\n",
+ shellQuoteCommand(editor, editorArgs),
+ c.Edit.MinDuration,
+ )
}
}
return err
@@ -2207,7 +2295,9 @@ func (c *Config) setEncryption() error {
}
if c.debug {
- encryptionLogger := c.logger.With().Str(logComponentKey, logComponentValueEncryption).Logger()
+ encryptionLogger := c.logger.With().
+ Str(logComponentKey, logComponentValueEncryption).
+ Logger()
c.encryption = chezmoi.NewDebugEncryption(c.encryption, &encryptionLogger)
}
@@ -2216,7 +2306,10 @@ func (c *Config) setEncryption() error {
// sourceAbsPaths returns the source absolute paths for each target path in
// args.
-func (c *Config) sourceAbsPaths(sourceState *chezmoi.SourceState, args []string) ([]chezmoi.AbsPath, error) {
+func (c *Config) sourceAbsPaths(
+ sourceState *chezmoi.SourceState,
+ args []string,
+) ([]chezmoi.AbsPath, error) {
targetRelPaths, err := c.targetRelPaths(sourceState, args, targetRelPathsOptions{
mustBeInSourceState: true,
mustBeManaged: true,
@@ -2226,7 +2319,9 @@ func (c *Config) sourceAbsPaths(sourceState *chezmoi.SourceState, args []string)
}
sourceAbsPaths := make([]chezmoi.AbsPath, 0, len(targetRelPaths))
for _, targetRelPath := range targetRelPaths {
- sourceAbsPath := c.SourceDirAbsPath.Join(sourceState.MustEntry(targetRelPath).SourceRelPath().RelPath())
+ sourceAbsPath := c.SourceDirAbsPath.Join(
+ sourceState.MustEntry(targetRelPath).SourceRelPath().RelPath(),
+ )
sourceAbsPaths = append(sourceAbsPaths, sourceAbsPath)
}
return sourceAbsPaths, nil
@@ -2236,7 +2331,11 @@ func (c *Config) targetRelPath(absPath chezmoi.AbsPath) (chezmoi.RelPath, error)
relPath, err := absPath.TrimDirPrefix(c.DestDirAbsPath)
var notInAbsDirError *chezmoi.NotInAbsDirError
if errors.As(err, ¬InAbsDirError) {
- return chezmoi.EmptyRelPath, fmt.Errorf("%s: not in destination directory (%s)", absPath, c.DestDirAbsPath)
+ return chezmoi.EmptyRelPath, fmt.Errorf(
+ "%s: not in destination directory (%s)",
+ absPath,
+ c.DestDirAbsPath,
+ )
}
return relPath, err
}
@@ -2307,11 +2406,13 @@ func (c *Config) targetRelPathsBySourcePath(
) ([]chezmoi.RelPath, error) {
targetRelPaths := make([]chezmoi.RelPath, 0, len(args))
targetRelPathsBySourceRelPath := make(map[chezmoi.RelPath]chezmoi.RelPath)
- _ = sourceState.ForEach(func(targetRelPath chezmoi.RelPath, sourceStateEntry chezmoi.SourceStateEntry) error {
- sourceRelPath := sourceStateEntry.SourceRelPath().RelPath()
- targetRelPathsBySourceRelPath[sourceRelPath] = targetRelPath
- return nil
- })
+ _ = sourceState.ForEach(
+ func(targetRelPath chezmoi.RelPath, sourceStateEntry chezmoi.SourceStateEntry) error {
+ sourceRelPath := sourceStateEntry.SourceRelPath().RelPath()
+ targetRelPathsBySourceRelPath[sourceRelPath] = targetRelPath
+ return nil
+ },
+ )
for _, arg := range args {
argAbsPath, err := chezmoi.NewAbsPathFromExtPath(arg, c.homeDirAbsPath)
if err != nil {
@@ -2546,8 +2647,11 @@ func newConfigFile(bds *xdg.BaseDirectorySpecification) ConfigFile {
Update: updateCmdConfig{
RecurseSubmodules: true,
apply: true,
- filter: chezmoi.NewEntryTypeFilter(chezmoi.EntryTypesAll, chezmoi.EntryTypesNone),
- recursive: true,
+ filter: chezmoi.NewEntryTypeFilter(
+ chezmoi.EntryTypesAll,
+ chezmoi.EntryTypesNone,
+ ),
+ recursive: true,
},
Verify: verifyCmdConfig{
Exclude: chezmoi.NewEntryTypeSet(chezmoi.EntryTypesNone),
diff --git a/pkg/cmd/dashlanetemplatefuncs.go b/pkg/cmd/dashlanetemplatefuncs.go
index 77cfe60d396..3b5c393e747 100644
--- a/pkg/cmd/dashlanetemplatefuncs.go
+++ b/pkg/cmd/dashlanetemplatefuncs.go
@@ -10,7 +10,7 @@ import (
type dashlaneConfig struct {
Command string `json:"command" mapstructure:"command" yaml:"command"`
- Args []string `json:"args" mapstructure:"args" yaml:"args"`
+ Args []string `json:"args" mapstructure:"args" yaml:"args"`
cacheNote map[string]any
cachePassword map[string]any
}
diff --git a/pkg/cmd/diffcmd.go b/pkg/cmd/diffcmd.go
index 03739e16f78..7c5c99bee00 100644
--- a/pkg/cmd/diffcmd.go
+++ b/pkg/cmd/diffcmd.go
@@ -9,11 +9,11 @@ import (
)
type diffCmdConfig struct {
- Command string `json:"command" mapstructure:"command" yaml:"command"`
- Args []string `json:"args" mapstructure:"args" yaml:"args"`
- Exclude *chezmoi.EntryTypeSet `json:"exclude" mapstructure:"exclude" yaml:"exclude"`
- Pager string `json:"pager" mapstructure:"pager" yaml:"pager"`
- Reverse bool `json:"reverse" mapstructure:"reverse" yaml:"reverse"`
+ Command string `json:"command" mapstructure:"command" yaml:"command"`
+ Args []string `json:"args" mapstructure:"args" yaml:"args"`
+ Exclude *chezmoi.EntryTypeSet `json:"exclude" mapstructure:"exclude" yaml:"exclude"`
+ Pager string `json:"pager" mapstructure:"pager" yaml:"pager"`
+ Reverse bool `json:"reverse" mapstructure:"reverse" yaml:"reverse"`
ScriptContents bool `json:"scriptContents" mapstructure:"scriptContents" yaml:"scriptContents"`
include *chezmoi.EntryTypeSet
init bool
@@ -40,10 +40,27 @@ func (c *Config) newDiffCmd() *cobra.Command {
flags.VarP(c.Diff.include, "include", "i", "Include entry types")
flags.BoolVar(&c.Diff.init, "init", c.Diff.init, "Recreate config file from template")
flags.StringVar(&c.Diff.Pager, "pager", c.Diff.Pager, "Set pager")
- flags.BoolVarP(&c.Diff.recursive, "recursive", "r", c.Diff.recursive, "Recurse into subdirectories")
+ flags.BoolVarP(
+ &c.Diff.recursive,
+ "recursive",
+ "r",
+ c.Diff.recursive,
+ "Recurse into subdirectories",
+ )
flags.BoolVar(&c.Diff.Reverse, "reverse", c.Diff.Reverse, "Reverse the direction of the diff")
- flags.BoolVar(&c.Diff.ScriptContents, "script-contents", c.Diff.ScriptContents, "Show script contents")
- flags.BoolVarP(&c.Diff.useBuiltinDiff, "use-builtin-diff", "", c.Diff.useBuiltinDiff, "Use the builtin diff")
+ flags.BoolVar(
+ &c.Diff.ScriptContents,
+ "script-contents",
+ c.Diff.ScriptContents,
+ "Show script contents",
+ )
+ flags.BoolVarP(
+ &c.Diff.useBuiltinDiff,
+ "use-builtin-diff",
+ "",
+ c.Diff.useBuiltinDiff,
+ "Use the builtin diff",
+ )
registerExcludeIncludeFlagCompletionFuncs(diffCmd)
diff --git a/pkg/cmd/diffcmd_test.go b/pkg/cmd/diffcmd_test.go
index 10c3dfcd2f7..59fb1efa58e 100644
--- a/pkg/cmd/diffcmd_test.go
+++ b/pkg/cmd/diffcmd_test.go
@@ -121,13 +121,22 @@ func TestDiffCmd(t *testing.T) {
} {
t.Run(tc.name, func(t *testing.T) {
chezmoitest.WithTestFS(t, map[string]any{
- "/home/user/.local/share/chezmoi": &vfst.Dir{Perm: fs.ModePerm &^ chezmoitest.Umask},
+ "/home/user/.local/share/chezmoi": &vfst.Dir{
+ Perm: fs.ModePerm &^ chezmoitest.Umask,
+ },
}, func(fileSystem vfs.FS) {
if tc.extraRoot != nil {
assert.NoError(t, vfst.NewBuilder().Build(fileSystem, tc.extraRoot))
}
stdout := strings.Builder{}
- assert.NoError(t, newTestConfig(t, fileSystem, withStdout(&stdout)).execute(append([]string{"diff"}, tc.args...)))
+ assert.NoError(
+ t,
+ newTestConfig(
+ t,
+ fileSystem,
+ withStdout(&stdout),
+ ).execute(append([]string{"diff"}, tc.args...)),
+ )
assert.Equal(t, tc.stdoutStr, stdout.String())
})
})
diff --git a/pkg/cmd/doctorcmd.go b/pkg/cmd/doctorcmd.go
index 2b42ff5e084..b3ff431cf1c 100644
--- a/pkg/cmd/doctorcmd.go
+++ b/pkg/cmd/doctorcmd.go
@@ -53,8 +53,11 @@ const (
// A check is an individual check.
type check interface {
- Name() string // Name returns the check's name.
- Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) // Run runs the check.
+ Name() string // Name returns the check's name.
+ Run(
+ system chezmoi.System,
+ homeDirAbsPath chezmoi.AbsPath,
+ ) (checkResult, string) // Run runs the check.
}
var checkResultStr = map[checkResult]string{
@@ -404,7 +407,13 @@ func (c *Config) runDoctorCmd(cmd *cobra.Command, args []string) error {
// output of chezmoi doctor is often posted publicly and would otherwise
// reveal the user's username.
message = strings.ReplaceAll(message, homeDirAbsPath.String(), "~")
- fmt.Fprintf(resultWriter, "%s\t%s\t%s\n", checkResultStr[checkResult], check.Name(), message)
+ fmt.Fprintf(
+ resultWriter,
+ "%s\t%s\t%s\n",
+ checkResultStr[checkResult],
+ check.Name(),
+ message,
+ )
if checkResult > worstResult {
worstResult = checkResult
}
@@ -422,7 +431,10 @@ func (c *argsCheck) Name() string {
return c.name
}
-func (c *argsCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) {
+func (c *argsCheck) Run(
+ system chezmoi.System,
+ homeDirAbsPath chezmoi.AbsPath,
+) (checkResult, string) {
return checkResultOK, shellQuoteCommand(c.command, c.args)
}
@@ -430,7 +442,10 @@ func (c *binaryCheck) Name() string {
return c.name
}
-func (c *binaryCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) {
+func (c *binaryCheck) Run(
+ system chezmoi.System,
+ homeDirAbsPath chezmoi.AbsPath,
+) (checkResult, string) {
if c.binaryname == "" {
return c.ifNotSet, "not set"
}
@@ -462,7 +477,11 @@ func (c *binaryCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath)
if c.versionRx != nil {
match := c.versionRx.FindSubmatch(versionBytes)
if len(match) != 2 {
- s := fmt.Sprintf("found %s, cannot parse version from %s", pathAbsPath, bytes.TrimSpace(versionBytes))
+ s := fmt.Sprintf(
+ "found %s, cannot parse version from %s",
+ pathAbsPath,
+ bytes.TrimSpace(versionBytes),
+ )
return checkResultWarning, s
}
versionBytes = match[1]
@@ -473,7 +492,12 @@ func (c *binaryCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath)
}
if c.minVersion != nil && version.LessThan(*c.minVersion) {
- return checkResultError, fmt.Sprintf("found %s, version %s, need %s", pathAbsPath, version, c.minVersion)
+ return checkResultError, fmt.Sprintf(
+ "found %s, version %s, need %s",
+ pathAbsPath,
+ version,
+ c.minVersion,
+ )
}
return checkResultOK, fmt.Sprintf("found %s, version %s", pathAbsPath, version)
@@ -483,7 +507,10 @@ func (c *configFileCheck) Name() string {
return "config-file"
}
-func (c *configFileCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) {
+func (c *configFileCheck) Run(
+ system chezmoi.System,
+ homeDirAbsPath chezmoi.AbsPath,
+) (checkResult, string) {
filenameAbsPaths := make(map[chezmoi.AbsPath]struct{})
for _, dir := range append([]string{c.bds.ConfigHome}, c.bds.ConfigDirs...) {
configDirAbsPath, err := chezmoi.NewAbsPathFromExtPath(dir, homeDirAbsPath)
@@ -491,7 +518,10 @@ func (c *configFileCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsP
return checkResultFailed, err.Error()
}
for _, extension := range chezmoi.FormatExtensions {
- filenameAbsPath := configDirAbsPath.Join(c.basename, chezmoi.NewRelPath(c.basename.String()+"."+extension))
+ filenameAbsPath := configDirAbsPath.Join(
+ c.basename,
+ chezmoi.NewRelPath(c.basename.String()+"."+extension),
+ )
if _, err := system.Stat(filenameAbsPath); err == nil {
filenameAbsPaths[filenameAbsPath] = struct{}{}
}
@@ -503,7 +533,11 @@ func (c *configFileCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsP
case 1:
filenameAbsPath := anyKey(filenameAbsPaths)
if filenameAbsPath != c.expected {
- return checkResultFailed, fmt.Sprintf("found %s, expected %s", filenameAbsPath, c.expected)
+ return checkResultFailed, fmt.Sprintf(
+ "found %s, expected %s",
+ filenameAbsPath,
+ c.expected,
+ )
}
config, err := newConfig()
if err != nil {
@@ -516,7 +550,11 @@ func (c *configFileCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsP
if err != nil {
return checkResultError, fmt.Sprintf("%s: %v", filenameAbsPath, err)
}
- message := fmt.Sprintf("%s, last modified %s", filenameAbsPath.String(), fileInfo.ModTime().Format(time.RFC3339))
+ message := fmt.Sprintf(
+ "%s, last modified %s",
+ filenameAbsPath.String(),
+ fileInfo.ModTime().Format(time.RFC3339),
+ )
return checkResultOK, message
default:
filenameStrs := make([]string, 0, len(filenameAbsPaths))
@@ -524,7 +562,10 @@ func (c *configFileCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsP
filenameStrs = append(filenameStrs, filenameAbsPath.String())
}
sort.Strings(filenameStrs)
- return checkResultWarning, fmt.Sprintf("%s: multiple config files", englishList(filenameStrs))
+ return checkResultWarning, fmt.Sprintf(
+ "%s: multiple config files",
+ englishList(filenameStrs),
+ )
}
}
@@ -532,7 +573,10 @@ func (c *dirCheck) Name() string {
return c.name
}
-func (c *dirCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) {
+func (c *dirCheck) Run(
+ system chezmoi.System,
+ homeDirAbsPath chezmoi.AbsPath,
+) (checkResult, string) {
dirEntries, err := system.ReadDir(c.dirname)
if err != nil {
return checkResultError, err.Error()
@@ -543,7 +587,13 @@ func (c *dirCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (c
if dirEntry.Name() != ".git" {
continue
}
- cmd := exec.Command("git", "-C", c.dirname.String(), "status", "--porcelain=v2") //nolint:gosec
+ cmd := exec.Command( //nolint:gosec
+ "git",
+ "-C",
+ c.dirname.String(),
+ "status",
+ "--porcelain=v2",
+ )
output, err := cmd.Output()
if err != nil {
gitStatus = gitStatusError
@@ -577,7 +627,10 @@ func (executableCheck) Name() string {
return "executable"
}
-func (executableCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) {
+func (executableCheck) Run(
+ system chezmoi.System,
+ homeDirAbsPath chezmoi.AbsPath,
+) (checkResult, string) {
executable, err := os.Executable()
if err != nil {
return checkResultError, err.Error()
@@ -593,7 +646,10 @@ func (c *fileCheck) Name() string {
return c.name
}
-func (c *fileCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) {
+func (c *fileCheck) Run(
+ system chezmoi.System,
+ homeDirAbsPath chezmoi.AbsPath,
+) (checkResult, string) {
if c.filename.Empty() {
return c.ifNotSet, "not set"
}
@@ -612,7 +668,10 @@ func (goVersionCheck) Name() string {
return "go-version"
}
-func (goVersionCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) {
+func (goVersionCheck) Run(
+ system chezmoi.System,
+ homeDirAbsPath chezmoi.AbsPath,
+) (checkResult, string) {
return checkResultOK, fmt.Sprintf("%s (%s)", runtime.Version(), runtime.Compiler)
}
@@ -620,7 +679,10 @@ func (c *latestVersionCheck) Name() string {
return "latest-version"
}
-func (c *latestVersionCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) {
+func (c *latestVersionCheck) Run(
+ system chezmoi.System,
+ homeDirAbsPath chezmoi.AbsPath,
+) (checkResult, string) {
if c.httpClientErr != nil {
return checkResultFailed, c.httpClientErr.Error()
}
@@ -658,7 +720,10 @@ func (osArchCheck) Name() string {
return "os-arch"
}
-func (osArchCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) {
+func (osArchCheck) Run(
+ system chezmoi.System,
+ homeDirAbsPath chezmoi.AbsPath,
+) (checkResult, string) {
fields := []string{runtime.GOOS + "/" + runtime.GOARCH}
if osRelease, err := chezmoi.OSRelease(system.UnderlyingFS()); err == nil {
if name, ok := osRelease["NAME"].(string); ok {
@@ -676,7 +741,10 @@ func (skippedCheck) Name() string {
return "skipped"
}
-func (skippedCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) {
+func (skippedCheck) Run(
+ system chezmoi.System,
+ homeDirAbsPath chezmoi.AbsPath,
+) (checkResult, string) {
return checkResultSkipped, ""
}
@@ -684,7 +752,10 @@ func (c *suspiciousEntriesCheck) Name() string {
return "suspicious-entries"
}
-func (c *suspiciousEntriesCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) {
+func (c *suspiciousEntriesCheck) Run(
+ system chezmoi.System,
+ homeDirAbsPath chezmoi.AbsPath,
+) (checkResult, string) {
// FIXME include user-defined suffixes from age and gpg configs
encryptedSuffixes := []string{
defaultAgeEncryptionConfig.Suffix,
@@ -717,7 +788,10 @@ func (upgradeMethodCheck) Name() string {
return "upgrade-method"
}
-func (upgradeMethodCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) {
+func (upgradeMethodCheck) Run(
+ system chezmoi.System,
+ homeDirAbsPath chezmoi.AbsPath,
+) (checkResult, string) {
executable, err := os.Executable()
if err != nil {
return checkResultFailed, err.Error()
@@ -736,7 +810,10 @@ func (c *versionCheck) Name() string {
return "version"
}
-func (c *versionCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) {
+func (c *versionCheck) Run(
+ system chezmoi.System,
+ homeDirAbsPath chezmoi.AbsPath,
+) (checkResult, string) {
if c.versionInfo.Version == "" || c.versionInfo.Commit == "" {
return checkResultWarning, c.versionStr
}
diff --git a/pkg/cmd/doctorcmd_windows.go b/pkg/cmd/doctorcmd_windows.go
index 735b97bae6b..6d39c09967d 100644
--- a/pkg/cmd/doctorcmd_windows.go
+++ b/pkg/cmd/doctorcmd_windows.go
@@ -21,7 +21,10 @@ func (systeminfoCheck) Name() string {
return "systeminfo"
}
-func (systeminfoCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) {
+func (systeminfoCheck) Run(
+ system chezmoi.System,
+ homeDirAbsPath chezmoi.AbsPath,
+) (checkResult, string) {
cmd := exec.Command("systeminfo")
data, err := chezmoilog.LogCmdOutput(cmd)
if err != nil {
diff --git a/pkg/cmd/dumpcmd.go b/pkg/cmd/dumpcmd.go
index 416648f4367..4d7624b6e7e 100644
--- a/pkg/cmd/dumpcmd.go
+++ b/pkg/cmd/dumpcmd.go
@@ -31,7 +31,13 @@ func (c *Config) newDumpCmd() *cobra.Command {
flags.VarP(&c.Format, "format", "f", "Output format")
flags.VarP(c.dump.filter.Include, "include", "i", "Include entry types")
flags.BoolVar(&c.dump.init, "init", c.dump.init, "Recreate config file from template")
- flags.BoolVarP(&c.dump.recursive, "recursive", "r", c.dump.recursive, "Recurse into subdirectories")
+ flags.BoolVarP(
+ &c.dump.recursive,
+ "recursive",
+ "r",
+ c.dump.recursive,
+ "Recurse into subdirectories",
+ )
if err := dumpCmd.RegisterFlagCompletionFunc("format", writeDataFormatFlagCompletionFunc); err != nil {
panic(err)
}
diff --git a/pkg/cmd/editcmd.go b/pkg/cmd/editcmd.go
index e1c431cb2fe..d6663a1caa7 100644
--- a/pkg/cmd/editcmd.go
+++ b/pkg/cmd/editcmd.go
@@ -12,12 +12,12 @@ import (
)
type editCmdConfig struct {
- Command string `json:"command" mapstructure:"command" yaml:"command"`
- Args []string `json:"args" mapstructure:"args" yaml:"args"`
- Hardlink bool `json:"hardlink" mapstructure:"hardlink" yaml:"hardlink"`
+ Command string `json:"command" mapstructure:"command" yaml:"command"`
+ Args []string `json:"args" mapstructure:"args" yaml:"args"`
+ Hardlink bool `json:"hardlink" mapstructure:"hardlink" yaml:"hardlink"`
MinDuration time.Duration `json:"minDuration" mapstructure:"minDuration" yaml:"minDuration"`
- Watch bool `json:"watch" mapstructure:"watch" yaml:"watch"`
- Apply bool `json:"apply" mapstructure:"apply" yaml:"apply"`
+ Watch bool `json:"watch" mapstructure:"watch" yaml:"watch"`
+ Apply bool `json:"apply" mapstructure:"apply" yaml:"apply"`
filter *chezmoi.EntryTypeFilter
init bool
}
@@ -42,7 +42,12 @@ func (c *Config) newEditCmd() *cobra.Command {
flags := editCmd.Flags()
flags.BoolVarP(&c.Edit.Apply, "apply", "a", c.Edit.Apply, "Apply after editing")
flags.VarP(c.Edit.filter.Exclude, "exclude", "x", "Exclude entry types")
- flags.BoolVar(&c.Edit.Hardlink, "hardlink", c.Edit.Hardlink, "Invoke editor with a hardlink to the source file")
+ flags.BoolVar(
+ &c.Edit.Hardlink,
+ "hardlink",
+ c.Edit.Hardlink,
+ "Invoke editor with a hardlink to the source file",
+ )
flags.VarP(c.Edit.filter.Include, "include", "i", "Include entry types")
flags.BoolVar(&c.Edit.init, "init", c.Edit.init, "Recreate config file from template")
flags.BoolVar(&c.Edit.Watch, "watch", c.Edit.Watch, "Apply on save")
diff --git a/pkg/cmd/ejsontemplatefuncs.go b/pkg/cmd/ejsontemplatefuncs.go
index 7259a89d943..52aeff96e07 100644
--- a/pkg/cmd/ejsontemplatefuncs.go
+++ b/pkg/cmd/ejsontemplatefuncs.go
@@ -8,7 +8,7 @@ import (
type ejsonConfig struct {
KeyDir string `json:"keyDir" mapstructure:"keyDir" yaml:"keyDir"`
- Key string `json:"key" mapstructure:"key" yaml:"key"`
+ Key string `json:"key" mapstructure:"key" yaml:"key"`
cache map[string]any
}
diff --git a/pkg/cmd/errors.go b/pkg/cmd/errors.go
index 2447db8570e..b11c3bad27b 100644
--- a/pkg/cmd/errors.go
+++ b/pkg/cmd/errors.go
@@ -49,7 +49,12 @@ type parseCmdOutputError struct {
err error
}
-func newParseCmdOutputError(command string, args []string, output []byte, err error) *parseCmdOutputError {
+func newParseCmdOutputError(
+ command string,
+ args []string,
+ output []byte,
+ err error,
+) *parseCmdOutputError {
return &parseCmdOutputError{
command: command,
args: args,
diff --git a/pkg/cmd/executetemplatecmd.go b/pkg/cmd/executetemplatecmd.go
index ff44397b584..fc91d7b731c 100644
--- a/pkg/cmd/executetemplatecmd.go
+++ b/pkg/cmd/executetemplatecmd.go
@@ -34,14 +34,56 @@ func (c *Config) newExecuteTemplateCmd() *cobra.Command {
}
flags := executeTemplateCmd.Flags()
- flags.BoolVarP(&c.executeTemplate.init, "init", "i", c.executeTemplate.init, "Simulate chezmoi init")
- flags.StringToStringVar(&c.executeTemplate.promptBool, "promptBool", c.executeTemplate.promptBool, "Simulate promptBool") //nolint:lll
- flags.StringToIntVar(&c.executeTemplate.promptInt, "promptInt", c.executeTemplate.promptInt, "Simulate promptInt")
- flags.StringToStringVarP(&c.executeTemplate.promptString, "promptString", "p", c.executeTemplate.promptString, "Simulate promptString") //nolint:lll
- flags.BoolVar(&c.executeTemplate.stdinIsATTY, "stdinisatty", c.executeTemplate.stdinIsATTY, "Simulate stdinIsATTY")
- flags.StringVar(&c.executeTemplate.templateOptions.LeftDelimiter, "left-delimiter", c.executeTemplate.templateOptions.LeftDelimiter, "Set left template delimiter") //nolint:lll
- flags.StringVar(&c.executeTemplate.templateOptions.RightDelimiter, "right-delimiter", c.executeTemplate.templateOptions.RightDelimiter, "Set right template delimiter") //nolint:lll
- flags.BoolVar(&c.executeTemplate.withStdin, "with-stdin", c.executeTemplate.withStdin, "Set .chezmoi.stdin to the contents of the standard input") //nolint:lll
+ flags.BoolVarP(
+ &c.executeTemplate.init,
+ "init",
+ "i",
+ c.executeTemplate.init,
+ "Simulate chezmoi init",
+ )
+ flags.StringToStringVar(
+ &c.executeTemplate.promptBool,
+ "promptBool",
+ c.executeTemplate.promptBool,
+ "Simulate promptBool",
+ )
+ flags.StringToIntVar(
+ &c.executeTemplate.promptInt,
+ "promptInt",
+ c.executeTemplate.promptInt,
+ "Simulate promptInt",
+ )
+ flags.StringToStringVarP(
+ &c.executeTemplate.promptString,
+ "promptString",
+ "p",
+ c.executeTemplate.promptString,
+ "Simulate promptString",
+ )
+ flags.BoolVar(
+ &c.executeTemplate.stdinIsATTY,
+ "stdinisatty",
+ c.executeTemplate.stdinIsATTY,
+ "Simulate stdinIsATTY",
+ )
+ flags.StringVar(
+ &c.executeTemplate.templateOptions.LeftDelimiter,
+ "left-delimiter",
+ c.executeTemplate.templateOptions.LeftDelimiter,
+ "Set left template delimiter",
+ )
+ flags.StringVar(
+ &c.executeTemplate.templateOptions.RightDelimiter,
+ "right-delimiter",
+ c.executeTemplate.templateOptions.RightDelimiter,
+ "Set right template delimiter",
+ )
+ flags.BoolVar(
+ &c.executeTemplate.withStdin,
+ "with-stdin",
+ c.executeTemplate.withStdin,
+ "Set .chezmoi.stdin to the contents of the standard input",
+ )
return executeTemplateCmd
}
diff --git a/pkg/cmd/forgetcmd.go b/pkg/cmd/forgetcmd.go
index 824f374c560..386f25372a6 100644
--- a/pkg/cmd/forgetcmd.go
+++ b/pkg/cmd/forgetcmd.go
@@ -27,7 +27,11 @@ func (c *Config) newForgetCmd() *cobra.Command {
return forgetCmd
}
-func (c *Config) runForgetCmd(cmd *cobra.Command, args []string, sourceState *chezmoi.SourceState) error {
+func (c *Config) runForgetCmd(
+ cmd *cobra.Command,
+ args []string,
+ sourceState *chezmoi.SourceState,
+) error {
targetRelPaths, err := c.targetRelPaths(sourceState, args, targetRelPathsOptions{
mustBeManaged: true,
})
diff --git a/pkg/cmd/gitcmd.go b/pkg/cmd/gitcmd.go
index f27b6775549..52af79acc1d 100644
--- a/pkg/cmd/gitcmd.go
+++ b/pkg/cmd/gitcmd.go
@@ -5,11 +5,11 @@ import (
)
type gitCmdConfig struct {
- Command string `json:"command" mapstructure:"command" yaml:"command"`
- AutoAdd bool `json:"autoadd" mapstructure:"autoadd" yaml:"autoadd"`
- AutoCommit bool `json:"autocommit" mapstructure:"autocommit" yaml:"autocommit"`
- AutoPush bool `json:"autopush" mapstructure:"autopush" yaml:"autopush"`
- CommitMessageTemplate string `json:"commitMessageTemplate" mapstructure:"commitMessageTemplate" yaml:"commitMessageTemplate"` //nolint:lll
+ Command string `json:"command" mapstructure:"command" yaml:"command"`
+ AutoAdd bool `json:"autoadd" mapstructure:"autoadd" yaml:"autoadd"`
+ AutoCommit bool `json:"autocommit" mapstructure:"autocommit" yaml:"autocommit"`
+ AutoPush bool `json:"autopush" mapstructure:"autopush" yaml:"autopush"`
+ CommitMessageTemplate string `json:"commitMessageTemplate" mapstructure:"commitMessageTemplate" yaml:"commitMessageTemplate"`
}
func (c *Config) newGitCmd() *cobra.Command {
diff --git a/pkg/cmd/githubtemplatefuncs.go b/pkg/cmd/githubtemplatefuncs.go
index 975b731dea6..54c3e2630cf 100644
--- a/pkg/cmd/githubtemplatefuncs.go
+++ b/pkg/cmd/githubtemplatefuncs.go
@@ -17,17 +17,17 @@ type gitHubConfig struct {
type gitHubKeysState struct {
RequestedAt time.Time `json:"requestedAt" yaml:"requestedAt"`
- Keys []*github.Key `json:"keys" yaml:"keys"`
+ Keys []*github.Key `json:"keys" yaml:"keys"`
}
type gitHubLatestReleaseState struct {
RequestedAt time.Time `json:"requestedAt" yaml:"requestedAt"`
- Release *github.RepositoryRelease `json:"release" yaml:"release"`
+ Release *github.RepositoryRelease `json:"release" yaml:"release"`
}
type gitHubLatestTagState struct {
RequestedAt time.Time `json:"requestedAt" yaml:"requestedAt"`
- Tag *github.RepositoryTag `json:"tag" yaml:"tag"`
+ Tag *github.RepositoryTag `json:"tag" yaml:"tag"`
}
var (
@@ -53,7 +53,7 @@ func (c *Config) gitHubKeysTemplateFunc(user string) []*github.Key {
gitHubKeysKey := []byte(user)
if c.GitHub.RefreshPeriod != 0 {
var gitHubKeysValue gitHubKeysState
- switch ok, err := chezmoi.PersistentStateGet(c.persistentState, gitHubKeysStateBucket, gitHubKeysKey, &gitHubKeysValue); { //nolint:lll
+ switch ok, err := chezmoi.PersistentStateGet(c.persistentState, gitHubKeysStateBucket, gitHubKeysKey, &gitHubKeysValue); {
case err != nil:
panic(err)
case ok && now.Before(gitHubKeysValue.RequestedAt.Add(c.GitHub.RefreshPeriod)):
@@ -114,7 +114,7 @@ func (c *Config) gitHubLatestReleaseTemplateFunc(ownerRepo string) *github.Repos
gitHubLatestReleaseKey := []byte(owner + "/" + repo)
if c.GitHub.RefreshPeriod != 0 {
var gitHubLatestReleaseStateValue gitHubLatestReleaseState
- switch ok, err := chezmoi.PersistentStateGet(c.persistentState, gitHubLatestReleaseStateBucket, gitHubLatestReleaseKey, &gitHubLatestReleaseStateValue); { //nolint:lll
+ switch ok, err := chezmoi.PersistentStateGet(c.persistentState, gitHubLatestReleaseStateBucket, gitHubLatestReleaseKey, &gitHubLatestReleaseStateValue); {
case err != nil:
panic(err)
case ok && now.Before(gitHubLatestReleaseStateValue.RequestedAt.Add(c.GitHub.RefreshPeriod)):
@@ -135,7 +135,7 @@ func (c *Config) gitHubLatestReleaseTemplateFunc(ownerRepo string) *github.Repos
panic(err)
}
- if err := chezmoi.PersistentStateSet(c.persistentState, gitHubLatestReleaseStateBucket, gitHubLatestReleaseKey, &gitHubLatestReleaseState{ //nolint:lll
+ if err := chezmoi.PersistentStateSet(c.persistentState, gitHubLatestReleaseStateBucket, gitHubLatestReleaseKey, &gitHubLatestReleaseState{
RequestedAt: now,
Release: release,
}); err != nil {
@@ -167,7 +167,7 @@ func (c *Config) gitHubLatestTagTemplateFunc(userRepo string) *github.Repository
gitHubLatestTagKey := []byte(owner + "/" + repo)
if c.GitHub.RefreshPeriod != 0 {
var gitHubLatestTagValue gitHubLatestTagState
- switch ok, err := chezmoi.PersistentStateGet(c.persistentState, gitHubLatestTagStateBucket, gitHubLatestTagKey, &gitHubLatestTagValue); { //nolint:lll
+ switch ok, err := chezmoi.PersistentStateGet(c.persistentState, gitHubLatestTagStateBucket, gitHubLatestTagKey, &gitHubLatestTagValue); {
case err != nil:
panic(err)
case ok && now.Before(gitHubLatestTagValue.RequestedAt.Add(c.GitHub.RefreshPeriod)):
@@ -194,7 +194,7 @@ func (c *Config) gitHubLatestTagTemplateFunc(userRepo string) *github.Repository
tag = tags[0]
}
- if err := chezmoi.PersistentStateSet(c.persistentState, gitHubLatestTagStateBucket, gitHubLatestTagKey, &gitHubLatestTagState{ //nolint:lll
+ if err := chezmoi.PersistentStateSet(c.persistentState, gitHubLatestTagStateBucket, gitHubLatestTagKey, &gitHubLatestTagState{
RequestedAt: now,
Tag: tag,
}); err != nil {
diff --git a/pkg/cmd/ignoredcmd.go b/pkg/cmd/ignoredcmd.go
index 20de77906e4..222620dc6e4 100644
--- a/pkg/cmd/ignoredcmd.go
+++ b/pkg/cmd/ignoredcmd.go
@@ -21,7 +21,11 @@ func (c *Config) newIgnoredCmd() *cobra.Command {
return ignoredCmd
}
-func (c *Config) runIgnoredCmd(cmd *cobra.Command, args []string, sourceState *chezmoi.SourceState) error {
+func (c *Config) runIgnoredCmd(
+ cmd *cobra.Command,
+ args []string,
+ sourceState *chezmoi.SourceState,
+) error {
builder := strings.Builder{}
for _, relPath := range sourceState.Ignored() {
if _, err := builder.WriteString(relPath.String()); err != nil {
diff --git a/pkg/cmd/importcmd.go b/pkg/cmd/importcmd.go
index 44f932f0656..14d65122c2c 100644
--- a/pkg/cmd/importcmd.go
+++ b/pkg/cmd/importcmd.go
@@ -33,18 +33,38 @@ func (c *Config) newImportCmd() *cobra.Command {
flags := importCmd.Flags()
flags.VarP(&c._import.destination, "destination", "d", "Set destination prefix")
- flags.BoolVar(&c._import.exact, "exact", c._import.exact, "Set exact_ attribute on imported directories")
+ flags.BoolVar(
+ &c._import.exact,
+ "exact",
+ c._import.exact,
+ "Set exact_ attribute on imported directories",
+ )
flags.VarP(c._import.filter.Exclude, "exclude", "x", "Exclude entry types")
flags.VarP(c._import.filter.Include, "include", "i", "Include entry types")
- flags.BoolVarP(&c._import.removeDestination, "remove-destination", "r", c._import.removeDestination, "Remove destination before import") //nolint:lll
- flags.IntVar(&c._import.stripComponents, "strip-components", c._import.stripComponents, "Strip leading path components") //nolint:lll
+ flags.BoolVarP(
+ &c._import.removeDestination,
+ "remove-destination",
+ "r",
+ c._import.removeDestination,
+ "Remove destination before import",
+ )
+ flags.IntVar(
+ &c._import.stripComponents,
+ "strip-components",
+ c._import.stripComponents,
+ "Strip leading path components",
+ )
registerExcludeIncludeFlagCompletionFuncs(importCmd)
return importCmd
}
-func (c *Config) runImportCmd(cmd *cobra.Command, args []string, sourceState *chezmoi.SourceState) error {
+func (c *Config) runImportCmd(
+ cmd *cobra.Command,
+ args []string,
+ sourceState *chezmoi.SourceState,
+) error {
var (
name string
data []byte
@@ -84,7 +104,11 @@ func (c *Config) runImportCmd(cmd *cobra.Command, args []string, sourceState *ch
}
}
return sourceState.Add(
- c.sourceSystem, c.persistentState, archiveReaderSystem, archiveReaderSystem.FileInfos(), &chezmoi.AddOptions{
+ c.sourceSystem,
+ c.persistentState,
+ archiveReaderSystem,
+ archiveReaderSystem.FileInfos(),
+ &chezmoi.AddOptions{
Exact: c._import.exact,
Filter: c._import.filter,
RemoveDir: removeDir,
diff --git a/pkg/cmd/initcmd.go b/pkg/cmd/initcmd.go
index 1d001a3e129..62e3357af75 100644
--- a/pkg/cmd/initcmd.go
+++ b/pkg/cmd/initcmd.go
@@ -53,17 +53,23 @@ var repoGuesses = []struct {
sshRepoGuessRepl: "git@$1:$2/dotfiles.git",
},
{
- rx: regexp.MustCompile(`\A([-0-9A-Za-z]+)/([-0-9A-Za-z]+)/([-.0-9A-Za-z]+)\z`),
+ rx: regexp.MustCompile(
+ `\A([-0-9A-Za-z]+)/([-0-9A-Za-z]+)/([-.0-9A-Za-z]+)\z`,
+ ),
httpRepoGuessRepl: "https://$1/$2/$3.git",
sshRepoGuessRepl: "git@$1:$2/$3.git",
},
{
- rx: regexp.MustCompile(`\A([-.0-9A-Za-z]+)/([-0-9A-Za-z]+)/([-0-9A-Za-z]+)(\.git)?\z`),
+ rx: regexp.MustCompile(
+ `\A([-.0-9A-Za-z]+)/([-0-9A-Za-z]+)/([-0-9A-Za-z]+)(\.git)?\z`,
+ ),
httpRepoGuessRepl: "https://$1/$2/$3.git",
sshRepoGuessRepl: "git@$1:$2/$3.git",
},
{
- rx: regexp.MustCompile(`\A(https?://)([-.0-9A-Za-z]+)/([-0-9A-Za-z]+)/([-0-9A-Za-z]+)(\.git)?\z`),
+ rx: regexp.MustCompile(
+ `\A(https?://)([-.0-9A-Za-z]+)/([-0-9A-Za-z]+)/([-0-9A-Za-z]+)(\.git)?\z`,
+ ),
httpRepoGuessRepl: "$1$2/$3/$4.git",
sshRepoGuessRepl: "git@$2:$3/$4.git",
},
@@ -108,12 +114,35 @@ func (c *Config) newInitCmd() *cobra.Command {
flags.BoolVar(&c.init.data, "data", c.init.data, "Include existing template data")
flags.IntVarP(&c.init.depth, "depth", "d", c.init.depth, "Create a shallow clone")
flags.VarP(c.init.filter.Exclude, "exclude", "x", "Exclude entry types")
- flags.BoolVarP(&c.init.guessRepoURL, "guess-repo-url", "g", c.init.guessRepoURL, "Guess the repo URL")
+ flags.BoolVarP(
+ &c.init.guessRepoURL,
+ "guess-repo-url",
+ "g",
+ c.init.guessRepoURL,
+ "Guess the repo URL",
+ )
flags.VarP(c.init.filter.Include, "include", "i", "Include entry types")
flags.BoolVar(&c.init.oneShot, "one-shot", c.init.oneShot, "Run in one-shot mode")
- flags.BoolVarP(&c.init.purge, "purge", "p", c.init.purge, "Purge config and source directories after running")
- flags.BoolVarP(&c.init.purgeBinary, "purge-binary", "P", c.init.purgeBinary, "Purge chezmoi binary after running")
- flags.BoolVar(&c.init.recurseSubmodules, "recurse-submodules", c.init.recurseSubmodules, "Checkout submodules recursively") //nolint:lll
+ flags.BoolVarP(
+ &c.init.purge,
+ "purge",
+ "p",
+ c.init.purge,
+ "Purge config and source directories after running",
+ )
+ flags.BoolVarP(
+ &c.init.purgeBinary,
+ "purge-binary",
+ "P",
+ c.init.purgeBinary,
+ "Purge chezmoi binary after running",
+ )
+ flags.BoolVar(
+ &c.init.recurseSubmodules,
+ "recurse-submodules",
+ c.init.recurseSubmodules,
+ "Checkout submodules recursively",
+ )
flags.BoolVar(&c.init.ssh, "ssh", c.init.ssh, "Use ssh instead of https when guessing repo URL")
return initCmd
diff --git a/pkg/cmd/interactivetemplatefuncs.go b/pkg/cmd/interactivetemplatefuncs.go
index 4e59d45f932..cc18f79e3b9 100644
--- a/pkg/cmd/interactivetemplatefuncs.go
+++ b/pkg/cmd/interactivetemplatefuncs.go
@@ -16,10 +16,30 @@ type interactiveTemplateFuncsConfig struct {
}
func (c *Config) addInteractiveTemplateFuncFlags(flags *pflag.FlagSet) {
- flags.BoolVar(&c.interactiveTemplateFuncs.forcePromptOnce, "prompt", c.interactiveTemplateFuncs.forcePromptOnce, "Force prompt*Once template functions to prompt") //nolint:lll
- flags.StringToStringVar(&c.interactiveTemplateFuncs.promptBool, "promptBool", c.interactiveTemplateFuncs.promptBool, "Populate promptBool") //nolint:lll
- flags.StringToIntVar(&c.interactiveTemplateFuncs.promptInt, "promptInt", c.interactiveTemplateFuncs.promptInt, "Populate promptInt") //nolint:lll
- flags.StringToStringVar(&c.interactiveTemplateFuncs.promptString, "promptString", c.interactiveTemplateFuncs.promptString, "Populate promptString") //nolint:lll
+ flags.BoolVar(
+ &c.interactiveTemplateFuncs.forcePromptOnce,
+ "prompt",
+ c.interactiveTemplateFuncs.forcePromptOnce,
+ "Force prompt*Once template functions to prompt",
+ )
+ flags.StringToStringVar(
+ &c.interactiveTemplateFuncs.promptBool,
+ "promptBool",
+ c.interactiveTemplateFuncs.promptBool,
+ "Populate promptBool",
+ )
+ flags.StringToIntVar(
+ &c.interactiveTemplateFuncs.promptInt,
+ "promptInt",
+ c.interactiveTemplateFuncs.promptInt,
+ "Populate promptInt",
+ )
+ flags.StringToStringVar(
+ &c.interactiveTemplateFuncs.promptString,
+ "promptString",
+ c.interactiveTemplateFuncs.promptString,
+ "Populate promptString",
+ )
}
func (c *Config) promptBoolInteractiveTemplateFunc(prompt string, args ...bool) bool {
@@ -43,7 +63,12 @@ func (c *Config) promptBoolInteractiveTemplateFunc(prompt string, args ...bool)
return value
}
-func (c *Config) promptBoolOnceInteractiveTemplateFunc(m map[string]any, path any, prompt string, args ...bool) bool {
+func (c *Config) promptBoolOnceInteractiveTemplateFunc(
+ m map[string]any,
+ path any,
+ prompt string,
+ args ...bool,
+) bool {
if len(args) > 1 {
err := fmt.Errorf("want 2 or 3 arguments, got %d", len(args)+2)
panic(err)
@@ -86,7 +111,12 @@ func (c *Config) promptIntInteractiveTemplateFunc(prompt string, args ...int64)
return value
}
-func (c *Config) promptIntOnceInteractiveTemplateFunc(m map[string]any, path any, prompt string, args ...int64) int64 {
+func (c *Config) promptIntOnceInteractiveTemplateFunc(
+ m map[string]any,
+ path any,
+ prompt string,
+ args ...int64,
+) int64 {
if len(args) > 1 {
err := fmt.Errorf("want 2 or 3 arguments, got %d", len(args)+2)
panic(err)
@@ -124,7 +154,12 @@ func (c *Config) promptStringInteractiveTemplateFunc(prompt string, args ...stri
return value
}
-func (c *Config) promptStringOnceInteractiveTemplateFunc(m map[string]any, path any, prompt string, args ...string) string { //nolint:lll
+func (c *Config) promptStringOnceInteractiveTemplateFunc(
+ m map[string]any,
+ path any,
+ prompt string,
+ args ...string,
+) string {
if len(args) > 1 {
err := fmt.Errorf("want 2 or 3 arguments, got %d", len(args)+2)
panic(err)
diff --git a/pkg/cmd/keepassxctemplatefuncs.go b/pkg/cmd/keepassxctemplatefuncs.go
index b056e5a8d59..1fdee868b74 100644
--- a/pkg/cmd/keepassxctemplatefuncs.go
+++ b/pkg/cmd/keepassxctemplatefuncs.go
@@ -21,10 +21,10 @@ type keepassxcAttributeCacheKey struct {
}
type keepassxcConfig struct {
- Command string `json:"command" mapstructure:"command" yaml:"command"`
+ Command string `json:"command" mapstructure:"command" yaml:"command"`
Database chezmoi.AbsPath `json:"database" mapstructure:"database" yaml:"database"`
- Args []string `json:"args" mapstructure:"args" yaml:"args"`
- Prompt bool `json:"prompt" mapstructure:"prompt" yaml:"prompt"`
+ Args []string `json:"args" mapstructure:"args" yaml:"args"`
+ Prompt bool `json:"prompt" mapstructure:"prompt" yaml:"prompt"`
version *semver.Version
cache map[string]map[string]string
attachmentCache map[string]map[string]string
@@ -44,7 +44,13 @@ func (c *Config) keepassxcAttachmentTemplateFunc(entry, name string) string {
panic(err)
}
if version.Compare(keepassxcHasAttachmentExportVersion) < 0 {
- panic(fmt.Sprintf("keepassxc-cli version %s required, found %s", keepassxcHasAttachmentExportVersion, version))
+ panic(
+ fmt.Sprintf(
+ "keepassxc-cli version %s required, found %s",
+ keepassxcHasAttachmentExportVersion,
+ version,
+ ),
+ )
}
if data, ok := c.Keepassxc.attachmentCache[entry][name]; ok {
@@ -136,7 +142,9 @@ func (c *Config) keepassxcOutput(name string, args []string) ([]byte, error) {
cmd := exec.Command(name, args...)
if c.Keepassxc.password == "" && c.Keepassxc.Prompt {
- password, err := c.readPassword(fmt.Sprintf("Insert password to unlock %s: ", c.Keepassxc.Database))
+ password, err := c.readPassword(
+ fmt.Sprintf("Insert password to unlock %s: ", c.Keepassxc.Database),
+ )
if err != nil {
return nil, err
}
diff --git a/pkg/cmd/keepertemplatefuncs.go b/pkg/cmd/keepertemplatefuncs.go
index 8939061dfca..d60fb76d503 100644
--- a/pkg/cmd/keepertemplatefuncs.go
+++ b/pkg/cmd/keepertemplatefuncs.go
@@ -12,7 +12,7 @@ import (
type keeperConfig struct {
Command string `json:"command" mapstructure:"command" yaml:"command"`
- Args []string `json:"args" mapstructure:"args" yaml:"args"`
+ Args []string `json:"args" mapstructure:"args" yaml:"args"`
outputCache map[string][]byte
}
diff --git a/pkg/cmd/main_test.go b/pkg/cmd/main_test.go
index 8c7cd0085a1..a11503c3b7e 100644
--- a/pkg/cmd/main_test.go
+++ b/pkg/cmd/main_test.go
@@ -151,7 +151,12 @@ func cmdCmpMod(ts *testscript.TestScript, neg bool, args []string) {
ts.Fatalf("%s unexpectedly has mode %03o", args[1], fileInfo.Mode().Perm())
}
if !neg && !equal {
- ts.Fatalf("%s has mode %03o, expected %03o", args[1], fileInfo.Mode().Perm(), fs.FileMode(mode64)&^chezmoitest.Umask)
+ ts.Fatalf(
+ "%s has mode %03o, expected %03o",
+ args[1],
+ fileInfo.Mode().Perm(),
+ fs.FileMode(mode64)&^chezmoitest.Umask,
+ )
}
}
@@ -628,7 +633,10 @@ func goosCondition(cond string) (result, valid bool) {
}
func prependDirToPath(dir, path string) string {
- return strings.Join(append([]string{dir}, filepath.SplitList(path)...), string(os.PathListSeparator))
+ return strings.Join(
+ append([]string{dir}, filepath.SplitList(path)...),
+ string(os.PathListSeparator),
+ )
}
func setup(env *testscript.Env) error {
diff --git a/pkg/cmd/managedcmd.go b/pkg/cmd/managedcmd.go
index 1377edfaba1..29375cf6513 100644
--- a/pkg/cmd/managedcmd.go
+++ b/pkg/cmd/managedcmd.go
@@ -39,7 +39,11 @@ func (c *Config) newManagedCmd() *cobra.Command {
return managedCmd
}
-func (c *Config) runManagedCmd(cmd *cobra.Command, args []string, sourceState *chezmoi.SourceState) error {
+func (c *Config) runManagedCmd(
+ cmd *cobra.Command,
+ args []string,
+ sourceState *chezmoi.SourceState,
+) error {
// Build queued relPaths. When there are no arguments, start from root,
// otherwise start from arguments.
var relPaths chezmoi.RelPaths
@@ -54,47 +58,52 @@ func (c *Config) runManagedCmd(cmd *cobra.Command, args []string, sourceState *c
}
var paths []string
- _ = sourceState.ForEach(func(targetRelPath chezmoi.RelPath, sourceStateEntry chezmoi.SourceStateEntry) error {
- if !c.managed.filter.IncludeSourceStateEntry(sourceStateEntry) {
- return nil
- }
-
- targetStateEntry, err := sourceStateEntry.TargetStateEntry(c.destSystem, c.DestDirAbsPath.Join(targetRelPath))
- if err != nil {
- return err
- }
- if !c.managed.filter.IncludeTargetStateEntry(targetStateEntry) {
- return nil
- }
+ _ = sourceState.ForEach(
+ func(targetRelPath chezmoi.RelPath, sourceStateEntry chezmoi.SourceStateEntry) error {
+ if !c.managed.filter.IncludeSourceStateEntry(sourceStateEntry) {
+ return nil
+ }
- // When arguments are given, only include paths under these arguments.
- if len(relPaths) != 0 {
- included := false
- for _, path := range relPaths {
- if targetRelPath.HasDirPrefix(path) || targetRelPath.String() == path.String() {
- included = true
- break
- }
+ targetStateEntry, err := sourceStateEntry.TargetStateEntry(
+ c.destSystem,
+ c.DestDirAbsPath.Join(targetRelPath),
+ )
+ if err != nil {
+ return err
}
- if !included {
+ if !c.managed.filter.IncludeTargetStateEntry(targetStateEntry) {
return nil
}
- }
- var path string
- switch c.managed.pathStyle {
- case pathStyleAbsolute:
- path = c.DestDirAbsPath.Join(targetRelPath).String()
- case pathStyleRelative:
- path = targetRelPath.String()
- case pathStyleSourceAbsolute:
- path = c.SourceDirAbsPath.Join(sourceStateEntry.SourceRelPath().RelPath()).String()
- case pathStyleSourceRelative:
- path = sourceStateEntry.SourceRelPath().RelPath().String()
- }
- paths = append(paths, path)
- return nil
- })
+ // When arguments are given, only include paths under these arguments.
+ if len(relPaths) != 0 {
+ included := false
+ for _, path := range relPaths {
+ if targetRelPath.HasDirPrefix(path) || targetRelPath.String() == path.String() {
+ included = true
+ break
+ }
+ }
+ if !included {
+ return nil
+ }
+ }
+
+ var path string
+ switch c.managed.pathStyle {
+ case pathStyleAbsolute:
+ path = c.DestDirAbsPath.Join(targetRelPath).String()
+ case pathStyleRelative:
+ path = targetRelPath.String()
+ case pathStyleSourceAbsolute:
+ path = c.SourceDirAbsPath.Join(sourceStateEntry.SourceRelPath().RelPath()).String()
+ case pathStyleSourceRelative:
+ path = sourceStateEntry.SourceRelPath().RelPath().String()
+ }
+ paths = append(paths, path)
+ return nil
+ },
+ )
sort.Strings(paths)
builder := strings.Builder{}
diff --git a/pkg/cmd/managedcmd_test.go b/pkg/cmd/managedcmd_test.go
index d50d9e5bca4..c378e657736 100644
--- a/pkg/cmd/managedcmd_test.go
+++ b/pkg/cmd/managedcmd_test.go
@@ -106,7 +106,14 @@ func TestManagedCmd(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
chezmoitest.WithTestFS(t, tc.root, func(fileSystem vfs.FS) {
stdout := &bytes.Buffer{}
- assert.NoError(t, newTestConfig(t, fileSystem, withStdout(stdout)).execute(append([]string{"managed"}, tc.args...)))
+ assert.NoError(
+ t,
+ newTestConfig(
+ t,
+ fileSystem,
+ withStdout(stdout),
+ ).execute(append([]string{"managed"}, tc.args...)),
+ )
assert.Equal(t, tc.expectedOutput, stdout.String())
})
})
diff --git a/pkg/cmd/mergeallcmd.go b/pkg/cmd/mergeallcmd.go
index bebf0765f8c..02e7a4da01b 100644
--- a/pkg/cmd/mergeallcmd.go
+++ b/pkg/cmd/mergeallcmd.go
@@ -26,7 +26,13 @@ func (c *Config) newMergeAllCmd() *cobra.Command {
flags := mergeAllCmd.Flags()
flags.BoolVar(&c.mergeAll.init, "init", c.mergeAll.init, "Recreate config file from template")
- flags.BoolVarP(&c.mergeAll.recursive, "recursive", "r", c.mergeAll.recursive, "Recurse into subdirectories")
+ flags.BoolVarP(
+ &c.mergeAll.recursive,
+ "recursive",
+ "r",
+ c.mergeAll.recursive,
+ "Recurse into subdirectories",
+ )
return mergeAllCmd
}
@@ -37,7 +43,8 @@ func (c *Config) runMergeAllCmd(cmd *cobra.Command, args []string) error {
preApplyFunc := func(
targetRelPath chezmoi.RelPath, targetEntryState, lastWrittenEntryState, actualEntryState *chezmoi.EntryState,
) error {
- if targetEntryState.Type == chezmoi.EntryStateTypeFile && !targetEntryState.Equivalent(actualEntryState) {
+ if targetEntryState.Type == chezmoi.EntryStateTypeFile &&
+ !targetEntryState.Equivalent(actualEntryState) {
targetRelPaths = append(targetRelPaths, targetRelPath)
}
return chezmoi.Skip
diff --git a/pkg/cmd/mergecmd.go b/pkg/cmd/mergecmd.go
index d6bd1886872..bda4d37df64 100644
--- a/pkg/cmd/mergecmd.go
+++ b/pkg/cmd/mergecmd.go
@@ -15,7 +15,7 @@ import (
type mergeCmdConfig struct {
Command string `json:"command" mapstructure:"command" yaml:"command"`
- Args []string `json:"args" mapstructure:"args" yaml:"args"`
+ Args []string `json:"args" mapstructure:"args" yaml:"args"`
}
func (c *Config) newMergeCmd() *cobra.Command {
@@ -36,7 +36,11 @@ func (c *Config) newMergeCmd() *cobra.Command {
return mergeCmd
}
-func (c *Config) runMergeCmd(cmd *cobra.Command, args []string, sourceState *chezmoi.SourceState) error {
+func (c *Config) runMergeCmd(
+ cmd *cobra.Command,
+ args []string,
+ sourceState *chezmoi.SourceState,
+) error {
targetRelPaths, err := c.targetRelPaths(sourceState, args, targetRelPathsOptions{
mustBeInSourceState: true,
mustBeManaged: false,
@@ -59,7 +63,10 @@ func (c *Config) runMergeCmd(cmd *cobra.Command, args []string, sourceState *che
// doMerge is the core merge functionality. It invokes the merge tool to do a
// three-way merge between the destination, source, and target, including
// transparently decrypting the file in the source state.
-func (c *Config) doMerge(targetRelPath chezmoi.RelPath, sourceStateEntry chezmoi.SourceStateEntry) (err error) {
+func (c *Config) doMerge(
+ targetRelPath chezmoi.RelPath,
+ sourceStateEntry chezmoi.SourceStateEntry,
+) (err error) {
sourceAbsPath := c.SourceDirAbsPath.Join(sourceStateEntry.SourceRelPath().RelPath())
// If the source state entry is an encrypted file, then decrypt it to a
@@ -72,7 +79,9 @@ func (c *Config) doMerge(targetRelPath chezmoi.RelPath, sourceStateEntry chezmoi
if plaintextTempDirAbsPath, err = c.tempDir("chezmoi-merge-plaintext"); err != nil {
return
}
- plaintextAbsPath = plaintextTempDirAbsPath.Join(sourceStateEntry.SourceRelPath().RelPath())
+ plaintextAbsPath = plaintextTempDirAbsPath.Join(
+ sourceStateEntry.SourceRelPath().RelPath(),
+ )
defer func() {
err = multierr.Append(err, os.RemoveAll(plaintextAbsPath.String()))
}()
diff --git a/pkg/cmd/onepasswordtemplatefuncs.go b/pkg/cmd/onepasswordtemplatefuncs.go
index 0e7d57a239e..6765d6f2a79 100644
--- a/pkg/cmd/onepasswordtemplatefuncs.go
+++ b/pkg/cmd/onepasswordtemplatefuncs.go
@@ -32,7 +32,7 @@ type onepasswordAccount struct {
type onepasswordConfig struct {
Command string `json:"command" mapstructure:"command" yaml:"command"`
- Prompt bool `json:"prompt" mapstructure:"prompt" yaml:"prompt"`
+ Prompt bool `json:"prompt" mapstructure:"prompt" yaml:"prompt"`
version *semver.Version
versionErr error
environFunc func() []string
@@ -332,7 +332,10 @@ func (c *Config) onepasswordItemV2(userArgs []string) (*onepasswordItemV2, error
return &item, nil
}
-func (c *Config) onepasswordOutput(args *onepasswordArgs, withSessionToken withSessionTokenType) ([]byte, error) {
+func (c *Config) onepasswordOutput(
+ args *onepasswordArgs,
+ withSessionToken withSessionTokenType,
+) ([]byte, error) {
key := strings.Join(args.args, "\x00")
if output, ok := c.Onepassword.outputCache[key]; ok {
return output, nil
diff --git a/pkg/cmd/passholetemplatefuncs.go b/pkg/cmd/passholetemplatefuncs.go
index 120216acdd7..d6a6c27c974 100644
--- a/pkg/cmd/passholetemplatefuncs.go
+++ b/pkg/cmd/passholetemplatefuncs.go
@@ -18,8 +18,8 @@ type passholeCacheKey struct {
type passholeConfig struct {
Command string `json:"command" mapstructure:"command" yaml:"command"`
- Args []string `json:"args" mapstructure:"args" yaml:"args"`
- Prompt bool `json:"prompt" mapstructure:"prompt" yaml:"prompt"`
+ Args []string `json:"args" mapstructure:"args" yaml:"args"`
+ Prompt bool `json:"prompt" mapstructure:"prompt" yaml:"prompt"`
cache map[passholeCacheKey]string
password string
}
diff --git a/pkg/cmd/pinentry.go b/pkg/cmd/pinentry.go
index 6420ec8211c..eebda07a786 100644
--- a/pkg/cmd/pinentry.go
+++ b/pkg/cmd/pinentry.go
@@ -7,7 +7,7 @@ import (
type pinEntryConfig struct {
Command string `json:"command" mapstructure:"command" yaml:"command"`
- Args []string `json:"args" mapstructure:"args" yaml:"args"`
+ Args []string `json:"args" mapstructure:"args" yaml:"args"`
Options []string `json:"options" mapstructure:"options" yaml:"options"`
}
diff --git a/pkg/cmd/readdcmd.go b/pkg/cmd/readdcmd.go
index 4d412164520..c9fe0d6694a 100644
--- a/pkg/cmd/readdcmd.go
+++ b/pkg/cmd/readdcmd.go
@@ -40,14 +40,20 @@ func (c *Config) newReAddCmd() *cobra.Command {
return reAddCmd
}
-func (c *Config) runReAddCmd(cmd *cobra.Command, args []string, sourceState *chezmoi.SourceState) error {
+func (c *Config) runReAddCmd(
+ cmd *cobra.Command,
+ args []string,
+ sourceState *chezmoi.SourceState,
+) error {
var targetRelPaths chezmoi.RelPaths
sourceStateEntries := make(map[chezmoi.RelPath]chezmoi.SourceStateEntry)
- _ = sourceState.ForEach(func(targetRelPath chezmoi.RelPath, sourceStateEntry chezmoi.SourceStateEntry) error {
- targetRelPaths = append(targetRelPaths, targetRelPath)
- sourceStateEntries[targetRelPath] = sourceStateEntry
- return nil
- })
+ _ = sourceState.ForEach(
+ func(targetRelPath chezmoi.RelPath, sourceStateEntry chezmoi.SourceStateEntry) error {
+ targetRelPaths = append(targetRelPaths, targetRelPath)
+ sourceStateEntries[targetRelPath] = sourceStateEntry
+ return nil
+ },
+ )
sort.Sort(targetRelPaths)
TARGET_REL_PATH:
diff --git a/pkg/cmd/removecmd.go b/pkg/cmd/removecmd.go
index eb613585e50..11157ab415b 100644
--- a/pkg/cmd/removecmd.go
+++ b/pkg/cmd/removecmd.go
@@ -32,12 +32,22 @@ func (c *Config) newRemoveCmd() *cobra.Command {
}
flags := removeCmd.Flags()
- flags.BoolVarP(&c.remove.recursive, "recursive", "r", c.remove.recursive, "Recurse into subdirectories")
+ flags.BoolVarP(
+ &c.remove.recursive,
+ "recursive",
+ "r",
+ c.remove.recursive,
+ "Recurse into subdirectories",
+ )
return removeCmd
}
-func (c *Config) runRemoveCmd(cmd *cobra.Command, args []string, sourceState *chezmoi.SourceState) error {
+func (c *Config) runRemoveCmd(
+ cmd *cobra.Command,
+ args []string,
+ sourceState *chezmoi.SourceState,
+) error {
targetRelPaths, err := c.targetRelPaths(sourceState, args, targetRelPathsOptions{
mustBeManaged: true,
recursive: c.remove.recursive,
@@ -88,11 +98,13 @@ func (c *Config) runRemoveCmd(cmd *cobra.Command, args []string, sourceState *ch
return nil
}
}
- if err := c.destSystem.RemoveAll(destAbsPath); err != nil && !errors.Is(err, fs.ErrNotExist) {
+ if err := c.destSystem.RemoveAll(destAbsPath); err != nil &&
+ !errors.Is(err, fs.ErrNotExist) {
return err
}
if !sourceAbsPath.Empty() {
- if err := c.sourceSystem.RemoveAll(sourceAbsPath); err != nil && !errors.Is(err, fs.ErrNotExist) {
+ if err := c.sourceSystem.RemoveAll(sourceAbsPath); err != nil &&
+ !errors.Is(err, fs.ErrNotExist) {
return err
}
}
diff --git a/pkg/cmd/secretkeyringcmd.go b/pkg/cmd/secretkeyringcmd.go
index d996dc493f7..22583c01a94 100644
--- a/pkg/cmd/secretkeyringcmd.go
+++ b/pkg/cmd/secretkeyringcmd.go
@@ -43,7 +43,12 @@ func (c *Config) newSecretKeyringCmd() *cobra.Command {
RunE: c.runSecretKeyringDeleteCmdE,
}
secretKeyringDeletePersistentFlags := keyringDeleteCmd.PersistentFlags()
- secretKeyringDeletePersistentFlags.StringVar(&c.secret.keyring.delete.service, "service", "", "service")
+ secretKeyringDeletePersistentFlags.StringVar(
+ &c.secret.keyring.delete.service,
+ "service",
+ "",
+ "service",
+ )
secretKeyringDeletePersistentFlags.StringVar(&c.secret.keyring.delete.user, "user", "", "user")
markPersistentFlagsRequired(keyringDeleteCmd, "service", "user")
keyringCmd.AddCommand(keyringDeleteCmd)
@@ -55,7 +60,12 @@ func (c *Config) newSecretKeyringCmd() *cobra.Command {
RunE: c.runSecretKeyringGetCmdE,
}
secretKeyringGetPersistentFlags := keyringGetCmd.PersistentFlags()
- secretKeyringGetPersistentFlags.StringVar(&c.secret.keyring.get.service, "service", "", "service")
+ secretKeyringGetPersistentFlags.StringVar(
+ &c.secret.keyring.get.service,
+ "service",
+ "",
+ "service",
+ )
secretKeyringGetPersistentFlags.StringVar(&c.secret.keyring.get.user, "user", "", "user")
markPersistentFlagsRequired(keyringGetCmd, "service", "user")
keyringCmd.AddCommand(keyringGetCmd)
@@ -67,7 +77,12 @@ func (c *Config) newSecretKeyringCmd() *cobra.Command {
RunE: c.runSecretKeyringSetCmdE,
}
secretKeyringSetPersistentFlags := keyringSetCmd.PersistentFlags()
- secretKeyringSetPersistentFlags.StringVar(&c.secret.keyring.set.service, "service", "", "service")
+ secretKeyringSetPersistentFlags.StringVar(
+ &c.secret.keyring.set.service,
+ "service",
+ "",
+ "service",
+ )
secretKeyringSetPersistentFlags.StringVar(&c.secret.keyring.set.user, "user", "", "user")
secretKeyringSetPersistentFlags.StringVar(&c.secret.keyring.set.value, "value", "", "value")
markPersistentFlagsRequired(keyringSetCmd, "service", "user")
diff --git a/pkg/cmd/secrettemplatefuncs.go b/pkg/cmd/secrettemplatefuncs.go
index a1afcfa7f34..b9b1d994619 100644
--- a/pkg/cmd/secrettemplatefuncs.go
+++ b/pkg/cmd/secrettemplatefuncs.go
@@ -12,7 +12,7 @@ import (
type secretConfig struct {
Command string `json:"command" mapstructure:"command" yaml:"command"`
- Args []string `json:"args" mapstructure:"args" yaml:"args"`
+ Args []string `json:"args" mapstructure:"args" yaml:"args"`
cache map[string][]byte
}
diff --git a/pkg/cmd/statecmd.go b/pkg/cmd/statecmd.go
index 4de8370035a..d3942b49472 100644
--- a/pkg/cmd/statecmd.go
+++ b/pkg/cmd/statecmd.go
@@ -76,7 +76,12 @@ func (c *Config) newStateCmd() *cobra.Command {
),
}
stateDeletePersistentFlags := stateDeleteCmd.PersistentFlags()
- stateDeletePersistentFlags.StringVar(&c.state.delete.bucket, "bucket", c.state.delete.bucket, "Bucket")
+ stateDeletePersistentFlags.StringVar(
+ &c.state.delete.bucket,
+ "bucket",
+ c.state.delete.bucket,
+ "Bucket",
+ )
stateDeletePersistentFlags.StringVar(&c.state.delete.key, "key", c.state.delete.key, "Key")
stateCmd.AddCommand(stateDeleteCmd)
@@ -90,7 +95,12 @@ func (c *Config) newStateCmd() *cobra.Command {
),
}
stateDeleteBucketPersistentFlags := stateDeleteBucketCmd.PersistentFlags()
- stateDeleteBucketPersistentFlags.StringVar(&c.state.deleteBucket.bucket, "bucket", c.state.deleteBucket.bucket, "Bucket") //nolint:lll
+ stateDeleteBucketPersistentFlags.StringVar(
+ &c.state.deleteBucket.bucket,
+ "bucket",
+ c.state.deleteBucket.bucket,
+ "Bucket",
+ )
stateCmd.AddCommand(stateDeleteBucketCmd)
stateDumpCmd := &cobra.Command{
@@ -133,7 +143,12 @@ func (c *Config) newStateCmd() *cobra.Command {
),
}
stateGetBucketPersistentFlags := stateGetBucketCmd.PersistentFlags()
- stateGetBucketPersistentFlags.StringVar(&c.state.getBucket.bucket, "bucket", c.state.getBucket.bucket, "bucket")
+ stateGetBucketPersistentFlags.StringVar(
+ &c.state.getBucket.bucket,
+ "bucket",
+ c.state.getBucket.bucket,
+ "bucket",
+ )
stateGetBucketPersistentFlags.VarP(&c.Format, "format", "f", "Output format")
if err := stateGetBucketCmd.RegisterFlagCompletionFunc("format", writeDataFormatFlagCompletionFunc); err != nil {
panic(err)
@@ -210,7 +225,10 @@ func (c *Config) runStateGetCmd(cmd *cobra.Command, args []string) error {
}
func (c *Config) runStateGetBucketCmd(cmd *cobra.Command, args []string) error {
- data, err := chezmoi.PersistentStateBucketData(c.persistentState, []byte(c.state.getBucket.bucket))
+ data, err := chezmoi.PersistentStateBucketData(
+ c.persistentState,
+ []byte(c.state.getBucket.bucket),
+ )
if err != nil {
return err
}
@@ -243,5 +261,9 @@ func (c *Config) runStateResetCmd(cmd *cobra.Command, args []string) error {
}
func (c *Config) runStateSetCmd(cmd *cobra.Command, args []string) error {
- return c.persistentState.Set([]byte(c.state.set.bucket), []byte(c.state.set.key), []byte(c.state.set.value))
+ return c.persistentState.Set(
+ []byte(c.state.set.bucket),
+ []byte(c.state.set.key),
+ []byte(c.state.set.value),
+ )
}
diff --git a/pkg/cmd/statuscmd.go b/pkg/cmd/statuscmd.go
index 9f0a88932f0..b82b01e8fbd 100644
--- a/pkg/cmd/statuscmd.go
+++ b/pkg/cmd/statuscmd.go
@@ -35,7 +35,13 @@ func (c *Config) newStatusCmd() *cobra.Command {
flags.VarP(c.Status.Exclude, "exclude", "x", "Exclude entry types")
flags.VarP(c.Status.include, "include", "i", "Include entry types")
flags.BoolVar(&c.Status.init, "init", c.Status.init, "Recreate config file from template")
- flags.BoolVarP(&c.Status.recursive, "recursive", "r", c.Status.recursive, "Recurse into subdirectories")
+ flags.BoolVarP(
+ &c.Status.recursive,
+ "recursive",
+ "r",
+ c.Status.recursive,
+ "Recurse into subdirectories",
+ )
registerExcludeIncludeFlagCompletionFuncs(statusCmd)
diff --git a/pkg/cmd/statuscmd_test.go b/pkg/cmd/statuscmd_test.go
index 2736be965a6..1f35c442286 100644
--- a/pkg/cmd/statuscmd_test.go
+++ b/pkg/cmd/statuscmd_test.go
@@ -56,14 +56,31 @@ func TestStatusCmd(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
chezmoitest.WithTestFS(t, tc.root, func(fileSystem vfs.FS) {
stdout := strings.Builder{}
- assert.NoError(t, newTestConfig(t, fileSystem, withStdout(&stdout)).execute(append([]string{"status"}, tc.args...)))
+ assert.NoError(
+ t,
+ newTestConfig(
+ t,
+ fileSystem,
+ withStdout(&stdout),
+ ).execute(append([]string{"status"}, tc.args...)),
+ )
assert.Equal(t, tc.stdoutStr, stdout.String())
- assert.NoError(t, newTestConfig(t, fileSystem).execute(append([]string{"apply"}, tc.args...)))
+ assert.NoError(
+ t,
+ newTestConfig(t, fileSystem).execute(append([]string{"apply"}, tc.args...)),
+ )
vfst.RunTests(t, fileSystem, "", tc.postApplyTests...)
stdout.Reset()
- assert.NoError(t, newTestConfig(t, fileSystem, withStdout(&stdout)).execute(append([]string{"status"}, tc.args...)))
+ assert.NoError(
+ t,
+ newTestConfig(
+ t,
+ fileSystem,
+ withStdout(&stdout),
+ ).execute(append([]string{"status"}, tc.args...)),
+ )
assert.Zero(t, stdout.String())
})
})
diff --git a/pkg/cmd/symlinks_test.go b/pkg/cmd/symlinks_test.go
index a346dfa1fe5..17650af887b 100644
--- a/pkg/cmd/symlinks_test.go
+++ b/pkg/cmd/symlinks_test.go
@@ -77,7 +77,10 @@ func TestSymlinks(t *testing.T) {
if tc.extraRoot != nil {
assert.NoError(t, vfst.NewBuilder().Build(fileSystem, tc.extraRoot))
}
- assert.NoError(t, newTestConfig(t, fileSystem).execute(append([]string{"apply"}, tc.args...)))
+ assert.NoError(
+ t,
+ newTestConfig(t, fileSystem).execute(append([]string{"apply"}, tc.args...)),
+ )
vfst.RunTests(t, fileSystem, "", tc.tests)
assert.NoError(t, newTestConfig(t, fileSystem).execute([]string{"verify"}))
})
diff --git a/pkg/cmd/textconv.go b/pkg/cmd/textconv.go
index 05fdb21bbf9..3f4209117a5 100644
--- a/pkg/cmd/textconv.go
+++ b/pkg/cmd/textconv.go
@@ -13,7 +13,7 @@ import (
type textConvElement struct {
Pattern string `json:"pattern" toml:"pattern" yaml:"pattern"`
Command string `json:"command" toml:"command" yaml:"command"`
- Args []string `json:"args" toml:"args" yaml:"args"`
+ Args []string `json:"args" toml:"args" yaml:"args"`
}
type textConv []*textConvElement
@@ -28,7 +28,8 @@ func (t textConv) convert(path string, data []byte) ([]byte, error) {
if !ok {
continue
}
- if longestPatternElement == nil || len(command.Pattern) > len(longestPatternElement.Pattern) {
+ if longestPatternElement == nil ||
+ len(command.Pattern) > len(longestPatternElement.Pattern) {
longestPatternElement = command
}
}
diff --git a/pkg/cmd/unmanagedcmd.go b/pkg/cmd/unmanagedcmd.go
index 6c42ce591a8..8fa45df76bc 100644
--- a/pkg/cmd/unmanagedcmd.go
+++ b/pkg/cmd/unmanagedcmd.go
@@ -37,7 +37,11 @@ func (c *Config) newUnmanagedCmd() *cobra.Command {
return unmanagedCmd
}
-func (c *Config) runUnmanagedCmd(cmd *cobra.Command, args []string, sourceState *chezmoi.SourceState) error {
+func (c *Config) runUnmanagedCmd(
+ cmd *cobra.Command,
+ args []string,
+ sourceState *chezmoi.SourceState,
+) error {
var absPaths chezmoi.AbsPaths
if len(args) == 0 {
absPaths = append(absPaths, c.DestDirAbsPath)
diff --git a/pkg/cmd/updatecmd.go b/pkg/cmd/updatecmd.go
index 9c0822d2035..88c1bc78c84 100644
--- a/pkg/cmd/updatecmd.go
+++ b/pkg/cmd/updatecmd.go
@@ -10,8 +10,8 @@ import (
)
type updateCmdConfig struct {
- Command string `json:"command" mapstructure:"command" yaml:"command"`
- Args []string `json:"args" mapstructure:"args" yaml:"args"`
+ Command string `json:"command" mapstructure:"command" yaml:"command"`
+ Args []string `json:"args" mapstructure:"args" yaml:"args"`
RecurseSubmodules bool `json:"recurseSubmodules" mapstructure:"recurseSubmodules" yaml:"recurseSubmodules"`
apply bool
filter *chezmoi.EntryTypeFilter
@@ -41,8 +41,19 @@ func (c *Config) newUpdateCmd() *cobra.Command {
flags.VarP(c.Update.filter.Exclude, "exclude", "x", "Exclude entry types")
flags.VarP(c.Update.filter.Include, "include", "i", "Include entry types")
flags.BoolVar(&c.Update.init, "init", c.Update.init, "Recreate config file from template")
- flags.BoolVar(&c.Update.RecurseSubmodules, "recurse-submodules", c.Update.RecurseSubmodules, "Recursively update submodules") //nolint:lll
- flags.BoolVarP(&c.Update.recursive, "recursive", "r", c.Update.recursive, "Recurse into subdirectories")
+ flags.BoolVar(
+ &c.Update.RecurseSubmodules,
+ "recurse-submodules",
+ c.Update.RecurseSubmodules,
+ "Recursively update submodules",
+ )
+ flags.BoolVarP(
+ &c.Update.recursive,
+ "recursive",
+ "r",
+ c.Update.recursive,
+ "Recurse into subdirectories",
+ )
registerExcludeIncludeFlagCompletionFuncs(updateCmd)
diff --git a/pkg/cmd/upgradecmd.go b/pkg/cmd/upgradecmd.go
index 04f825c10f1..e62355d6a2b 100644
--- a/pkg/cmd/upgradecmd.go
+++ b/pkg/cmd/upgradecmd.go
@@ -98,7 +98,12 @@ func (c *Config) newUpgradeCmd() *cobra.Command {
}
flags := upgradeCmd.Flags()
- flags.StringVar(&c.upgrade.executable, "executable", c.upgrade.method, "Set executable to replace")
+ flags.StringVar(
+ &c.upgrade.executable,
+ "executable",
+ c.upgrade.method,
+ "Set executable to replace",
+ )
flags.StringVar(&c.upgrade.method, "method", c.upgrade.method, "Set upgrade method")
flags.StringVar(&c.upgrade.owner, "owner", c.upgrade.owner, "Set owner")
flags.StringVar(&c.upgrade.repo, "repo", c.upgrade.repo, "Set repo")
@@ -112,7 +117,9 @@ func (c *Config) runUpgradeCmd(cmd *cobra.Command, args []string) error {
var zeroVersion semver.Version
if c.version == zeroVersion && !c.force {
- return errors.New("cannot upgrade dev version to latest released version unless --force is set")
+ return errors.New(
+ "cannot upgrade dev version to latest released version unless --force is set",
+ )
}
httpClient, err := c.getHTTPClient()
@@ -154,7 +161,12 @@ func (c *Config) runUpgradeCmd(cmd *cobra.Command, args []string) error {
case err != nil:
return err
case method == "":
- return fmt.Errorf("%s/%s: cannot determine upgrade method for %s", runtime.GOOS, runtime.GOARCH, executableAbsPath)
+ return fmt.Errorf(
+ "%s/%s: cannot determine upgrade method for %s",
+ runtime.GOOS,
+ runtime.GOARCH,
+ executableAbsPath,
+ )
}
}
c.logger.Info().
@@ -212,8 +224,15 @@ func (c *Config) brewUpgrade() error {
return c.run(chezmoi.EmptyAbsPath, "brew", []string{"upgrade", c.upgrade.repo})
}
-func (c *Config) getChecksums(ctx context.Context, rr *github.RepositoryRelease) (map[string][]byte, error) {
- name := fmt.Sprintf("%s_%s_checksums.txt", c.upgrade.repo, strings.TrimPrefix(rr.GetTagName(), "v"))
+func (c *Config) getChecksums(
+ ctx context.Context,
+ rr *github.RepositoryRelease,
+) (map[string][]byte, error) {
+ name := fmt.Sprintf(
+ "%s_%s_checksums.txt",
+ c.upgrade.repo,
+ strings.TrimPrefix(rr.GetTagName(), "v"),
+ )
releaseAsset := getReleaseAssetByName(rr, name)
if releaseAsset == nil {
return nil, fmt.Errorf("%s: cannot find release asset", name)
@@ -285,7 +304,11 @@ func (c *Config) getLibc() (string, error) {
return "", errors.New("unable to determine libc")
}
-func (c *Config) getPackageFilename(packageType string, version *semver.Version, os, arch string) (string, error) {
+func (c *Config) getPackageFilename(
+ packageType string,
+ version *semver.Version,
+ os, arch string,
+) (string, error) {
if archReplacement, ok := archReplacements[packageType][arch]; ok {
arch = archReplacement
}
@@ -310,20 +333,44 @@ func (c *Config) replaceExecutable(
switch {
case runtime.GOOS == "windows":
archiveFormat = chezmoi.ArchiveFormatZip
- archiveName = fmt.Sprintf("%s_%s_%s_%s.zip", c.upgrade.repo, releaseVersion, runtime.GOOS, runtime.GOARCH)
+ archiveName = fmt.Sprintf(
+ "%s_%s_%s_%s.zip",
+ c.upgrade.repo,
+ releaseVersion,
+ runtime.GOOS,
+ runtime.GOARCH,
+ )
case runtime.GOOS == "linux" && runtime.GOARCH == "amd64":
archiveFormat = chezmoi.ArchiveFormatTarGz
var libc string
if libc, err = c.getLibc(); err != nil {
return
}
- archiveName = fmt.Sprintf("%s_%s_%s-%s_%s.tar.gz", c.upgrade.repo, releaseVersion, runtime.GOOS, libc, runtime.GOARCH)
+ archiveName = fmt.Sprintf(
+ "%s_%s_%s-%s_%s.tar.gz",
+ c.upgrade.repo,
+ releaseVersion,
+ runtime.GOOS,
+ libc,
+ runtime.GOARCH,
+ )
case runtime.GOOS == "linux" && runtime.GOARCH == "386":
archiveFormat = chezmoi.ArchiveFormatTarGz
- archiveName = fmt.Sprintf("%s_%s_%s_i386.tar.gz", c.upgrade.repo, releaseVersion, runtime.GOOS)
+ archiveName = fmt.Sprintf(
+ "%s_%s_%s_i386.tar.gz",
+ c.upgrade.repo,
+ releaseVersion,
+ runtime.GOOS,
+ )
default:
archiveFormat = chezmoi.ArchiveFormatTarGz
- archiveName = fmt.Sprintf("%s_%s_%s_%s.tar.gz", c.upgrade.repo, releaseVersion, runtime.GOOS, runtime.GOARCH)
+ archiveName = fmt.Sprintf(
+ "%s_%s_%s_%s.tar.gz",
+ c.upgrade.repo,
+ releaseVersion,
+ runtime.GOOS,
+ runtime.GOARCH,
+ )
}
releaseAsset := getReleaseAssetByName(rr, archiveName)
if releaseAsset == nil {
@@ -402,7 +449,12 @@ func (c *Config) upgradePackage(
}
// Find the release asset.
- packageFilename, err := c.getPackageFilename(packageType, version, runtime.GOOS, runtime.GOARCH)
+ packageFilename, err := c.getPackageFilename(
+ packageType,
+ version,
+ runtime.GOOS,
+ runtime.GOARCH,
+ )
if err != nil {
return err
}
@@ -449,7 +501,12 @@ func (c *Config) upgradePackage(
}
}
-func (c *Config) verifyChecksum(ctx context.Context, rr *github.RepositoryRelease, name string, data []byte) error {
+func (c *Config) verifyChecksum(
+ ctx context.Context,
+ rr *github.RepositoryRelease,
+ name string,
+ data []byte,
+) error {
checksums, err := c.getChecksums(ctx, rr)
if err != nil {
return err
@@ -461,7 +518,10 @@ func (c *Config) verifyChecksum(ctx context.Context, rr *github.RepositoryReleas
checksum := sha256.Sum256(data)
if !bytes.Equal(checksum[:], expectedChecksum) {
return fmt.Errorf(
- "%s: checksum failed (want %s, got %s)", name, hex.EncodeToString(expectedChecksum), hex.EncodeToString(checksum[:]),
+ "%s: checksum failed (want %s, got %s)",
+ name,
+ hex.EncodeToString(expectedChecksum),
+ hex.EncodeToString(checksum[:]),
)
}
return nil
@@ -527,7 +587,10 @@ func getUpgradeMethod(fileSystem vfs.Stater, executableAbsPath chezmoi.AbsPath)
case uid:
return upgradeMethodReplaceExecutable, nil
default:
- return "", fmt.Errorf("%s: cannot upgrade executable owned by non-current non-root user", executableAbsPath)
+ return "", fmt.Errorf(
+ "%s: cannot upgrade executable owned by non-current non-root user",
+ executableAbsPath,
+ )
}
case "openbsd":
return upgradeMethodReplaceExecutable, nil
@@ -554,7 +617,11 @@ func getPackageType(system chezmoi.System) (string, error) {
}
}
}
- err = fmt.Errorf("could not determine package type (ID=%q, ID_LIKE=%q)", osRelease["ID"], osRelease["ID_LIKE"])
+ err = fmt.Errorf(
+ "could not determine package type (ID=%q, ID_LIKE=%q)",
+ osRelease["ID"],
+ osRelease["ID_LIKE"],
+ )
return packageTypeNone, err
}
diff --git a/pkg/cmd/util_windows.go b/pkg/cmd/util_windows.go
index d00e7ab7765..5b1482a2308 100644
--- a/pkg/cmd/util_windows.go
+++ b/pkg/cmd/util_windows.go
@@ -37,7 +37,11 @@ func fileInfoUID(fs.FileInfo) int {
}
func windowsVersion() (map[string]any, error) {
- registryKey, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
+ registryKey, err := registry.OpenKey(
+ registry.LOCAL_MACHINE,
+ `SOFTWARE\Microsoft\Windows NT\CurrentVersion`,
+ registry.QUERY_VALUE,
+ )
if err != nil {
return nil, fmt.Errorf("registry.OpenKey: %w", err)
}
diff --git a/pkg/cmd/verifycmd.go b/pkg/cmd/verifycmd.go
index 37612dba0d1..b06b5fb9b35 100644
--- a/pkg/cmd/verifycmd.go
+++ b/pkg/cmd/verifycmd.go
@@ -31,7 +31,13 @@ func (c *Config) newVerifyCmd() *cobra.Command {
flags.VarP(c.Verify.Exclude, "exclude", "x", "Exclude entry types")
flags.VarP(c.Verify.include, "include", "i", "Include entry types")
flags.BoolVar(&c.Verify.init, "init", c.Verify.init, "Recreate config file from template")
- flags.BoolVarP(&c.Verify.recursive, "recursive", "r", c.Verify.recursive, "Recurse into subdirectories")
+ flags.BoolVarP(
+ &c.Verify.recursive,
+ "recursive",
+ "r",
+ c.Verify.recursive,
+ "Recurse into subdirectories",
+ )
registerExcludeIncludeFlagCompletionFuncs(verifyCmd)
diff --git a/pkg/cmd/verifycmd_test.go b/pkg/cmd/verifycmd_test.go
index 7c236bf4a2f..ed849f548b5 100644
--- a/pkg/cmd/verifycmd_test.go
+++ b/pkg/cmd/verifycmd_test.go
@@ -40,7 +40,11 @@ func TestVerifyCmd(t *testing.T) {
} {
t.Run(tc.name, func(t *testing.T) {
chezmoitest.WithTestFS(t, tc.root, func(fileSystem vfs.FS) {
- assert.Equal(t, tc.expectedErr, newTestConfig(t, fileSystem).execute([]string{"verify"}))
+ assert.Equal(
+ t,
+ tc.expectedErr,
+ newTestConfig(t, fileSystem).execute([]string{"verify"}),
+ )
})
})
}
diff --git a/pkg/shell/shell_posix.go b/pkg/shell/shell_posix.go
index 740bb054746..86180eb4ec3 100644
--- a/pkg/shell/shell_posix.go
+++ b/pkg/shell/shell_posix.go
@@ -32,7 +32,9 @@ func CurrentUserShell() (string, bool) {
// If getent is available, use it.
if getent, err := exec.LookPath("getent"); err == nil {
if output, err := exec.Command(getent, "passwd", u.Username).Output(); err == nil {
- if fields := strings.SplitN(strings.TrimSuffix(string(output), "\n"), ":", 7); len(fields) == 7 {
+ if fields := strings.SplitN(strings.TrimSuffix(string(output), "\n"), ":", 7); len(
+ fields,
+ ) == 7 {
return fields[6], true
}
}
diff --git a/pkg/shell/shellcgo.go b/pkg/shell/shellcgo.go
index df6c5ce6c79..701df01fbc0 100644
--- a/pkg/shell/shellcgo.go
+++ b/pkg/shell/shellcgo.go
@@ -28,7 +28,13 @@ func cgoGetUserShell(name string) (string, bool) {
buf = make([]byte, buflen)
result *C.struct_passwd
)
- rc := C.getpwnam_r(cName, &pwd, (*C.char)(unsafe.Pointer(&buf[0])), C.size_t(buflen), &result) //nolint:gocritic
+ rc := C.getpwnam_r(
+ cName,
+ &pwd,
+ (*C.char)(unsafe.Pointer(&buf[0])),
+ C.size_t(buflen),
+ &result, //nolint:gocritic
+ )
C.free(unsafe.Pointer(cName))
switch rc {
|
chore
|
Break long lines with segmentio/golines
|
36e5aeb7d41c0a7ce8cf6e485bb5f2db6d14991f
|
2021-12-22 16:53:42
|
Tom Payne
|
chore: Disable gpg tests on Windows
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 46989e82ddb..98bfb7d8503 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -354,12 +354,6 @@ jobs:
$env:PATH = "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin"
[Environment]::SetEnvironmentVariable("Path", $env:PATH, "Machine")
choco install --no-progress --yes age.portable
- - name: Install gpg4win
- run: |
- $env:PATH = "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin"
- [Environment]::SetEnvironmentVariable("Path", $env:PATH, "Machine")
- choco install --no-progress --yes gpg4win
- echo "C:\Program Files (x86)\GnuPG\bin" >> $env:GITHUB_PATH
- name: Upload chocolatey log
if: failure()
uses: actions/upload-artifact@v2
diff --git a/internal/chezmoi/gpgencryption_test.go b/internal/chezmoi/gpgencryption_test.go
index 6d1fd9a16e7..1e5da9f1420 100644
--- a/internal/chezmoi/gpgencryption_test.go
+++ b/internal/chezmoi/gpgencryption_test.go
@@ -1,6 +1,7 @@
package chezmoi
import (
+ "runtime"
"testing"
"github.com/stretchr/testify/require"
@@ -9,6 +10,9 @@ import (
)
func TestGPGEncryption(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skip("skipping gpg tests on Windows")
+ }
command := lookPathOrSkip(t, "gpg")
tempDir := t.TempDir()
diff --git a/internal/cmd/testdata/scripts/addencrypted.txt b/internal/cmd/testdata/scripts/addencrypted.txt
index 17fc5860fdd..33bcc064288 100644
--- a/internal/cmd/testdata/scripts/addencrypted.txt
+++ b/internal/cmd/testdata/scripts/addencrypted.txt
@@ -1,3 +1,4 @@
+[windows] skip 'skipping gpg tests on Windows'
[!exec:gpg] skip 'gpg not found in $PATH'
mkgpgconfig
diff --git a/internal/cmd/testdata/scripts/applyskipencrypted.txt b/internal/cmd/testdata/scripts/applyskipencrypted.txt
index 4e9a14ae92d..95eb40a6be2 100644
--- a/internal/cmd/testdata/scripts/applyskipencrypted.txt
+++ b/internal/cmd/testdata/scripts/applyskipencrypted.txt
@@ -1,3 +1,4 @@
+[windows] skip 'skipping gpg tests on Windows'
[!exec:gpg] skip 'gpg not found in $PATH'
mkhomedir
diff --git a/internal/cmd/testdata/scripts/externalencrypted.txt b/internal/cmd/testdata/scripts/externalencrypted.txt
index 26b565215db..89d77be0e09 100644
--- a/internal/cmd/testdata/scripts/externalencrypted.txt
+++ b/internal/cmd/testdata/scripts/externalencrypted.txt
@@ -1,3 +1,4 @@
+[windows] skip 'skipping gpg tests on Windows'
[!exec:gpg] skip 'gpg not found in $PATH'
mkgpgconfig
diff --git a/internal/cmd/testdata/scripts/gpg.txt b/internal/cmd/testdata/scripts/gpg.txt
index a14629f9a55..3f6ef822dff 100644
--- a/internal/cmd/testdata/scripts/gpg.txt
+++ b/internal/cmd/testdata/scripts/gpg.txt
@@ -1,3 +1,4 @@
+[windows] skip 'skipping gpg tests on Windows'
[!exec:gpg] skip 'gpg not found in $PATH'
mkhomedir
diff --git a/internal/cmd/testdata/scripts/gpgencryption.txt b/internal/cmd/testdata/scripts/gpgencryption.txt
index 72aa6b2171c..f5e2143ee40 100644
--- a/internal/cmd/testdata/scripts/gpgencryption.txt
+++ b/internal/cmd/testdata/scripts/gpgencryption.txt
@@ -1,3 +1,4 @@
+[windows] skip 'skipping gpg tests on Windows'
[!exec:gpg] skip 'gpg not found in $PATH'
mkhomedir
diff --git a/internal/cmd/testdata/scripts/gpgencryptionsymmetric.txt b/internal/cmd/testdata/scripts/gpgencryptionsymmetric.txt
index 3e746a31111..ad886dea3d5 100644
--- a/internal/cmd/testdata/scripts/gpgencryptionsymmetric.txt
+++ b/internal/cmd/testdata/scripts/gpgencryptionsymmetric.txt
@@ -1,3 +1,4 @@
+[windows] skip 'skipping gpg tests on Windows'
[!exec:gpg] skip 'gpg not found in $PATH'
mkhomedir
|
chore
|
Disable gpg tests on Windows
|
f47c2687f8f6216b7867565cd7fab9a92bd11f31
|
2023-10-11 00:58:54
|
Tom Payne
|
feat: Warn when overriding CHEZMOI_ env vars
| false
|
diff --git a/internal/cmd/config.go b/internal/cmd/config.go
index 67cc3c0d00d..ec02306baf9 100644
--- a/internal/cmd/config.go
+++ b/internal/cmd/config.go
@@ -2125,6 +2125,9 @@ func (c *Config) persistentPreRunRootE(cmd *cobra.Command, args []string) error
}
}
for key, value := range c.ScriptEnv {
+ if strings.HasPrefix(key, "CHEZMOI_") {
+ c.errorf("warning: %s: overriding reserved environment variable", key)
+ }
os.Setenv(key, value)
}
|
feat
|
Warn when overriding CHEZMOI_ env vars
|
3739b0bd8d18849af879a86dedf93060b171e78b
|
2024-12-10 02:20:19
|
Tom Payne
|
docs: Describe how to use tools installed with Flatpak
| false
|
diff --git a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/usage.md b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/usage.md
index 3ae25a5bc9e..ac927d71451 100644
--- a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/usage.md
+++ b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/usage.md
@@ -208,3 +208,46 @@ and a [`completion`](/reference/templates/functions/completion.md) template
function which return the shell completions for the given shell.
These can be used either as a one-off or as part of your dotfiles repo.
The details of how to use these depend on your shell.
+
+## How do I use tools that I installed with Flatpak?
+
+Command line programs installed with [Flatpak](https://flatpak.org/) cannot be
+run directly. Instead, they must be run with `flatpak run`. This can either be
+added by using a wrapper script or by configuring chezmoi to invoke `flatpak
+run` with the correct arguments directly. Wrapper scripts are recommended, as
+they work with the [`doctor` command](../../reference/commands/doctor.md).
+
+### Use a wrapper script
+
+Create a wrapper script with the exact same name as the command that invokes
+`flatpak run` and passes all arguments to the wrapped command.
+
+For example, to wrap KeePassXC installed with Flatpak, create the script:
+
+```bash title="keepassxc-cli"
+#!/bin/bash
+
+flatpak run --command=keepassxc-cli org.keepassxc.KeePassXC -- "$@"
+```
+
+Note that the script is called `keepassxc-cli` without any `.sh` extension, so
+it has the exact same name as the `keepassxc-cli` command that chezmoi invokes
+by default. Ensure that this script is in your path and is executable.
+
+### Configure chezmoi to invoke `flatpak run`
+
+For tools that chezmoi invokes with `.command` and `.args` configuration
+variables, you can configure chezmoi to invoke `flatpak` directly with the
+correct arguments.
+
+For example, to use VSCodium installed with Flatpak as your diff command, add
+the following to your config file:
+
+```toml title="~/.config/chezmoi/chezmoi.toml"
+[diff]
+ command = "flatpak"
+ args = ["run", "com.vscodium.codium", "--wait", "--diff"]
+```
+
+Note that the command is `flatpak`, the first two arguments are `run` and the
+name of app, and any further arguments are passed to the app.
|
docs
|
Describe how to use tools installed with Flatpak
|
c9ddc841bd0866202ce2e4493b2bae044b38d5ff
|
2024-02-17 06:32:22
|
Tom Payne
|
chore: Remove owner/repo abstraction
| false
|
diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go
index 6d02397be22..9984310c6d4 100644
--- a/internal/cmd/cmd.go
+++ b/internal/cmd/cmd.go
@@ -21,13 +21,7 @@ import (
"github.com/twpayne/chezmoi/v2/internal/chezmoierrors"
)
-// GitHub owner and repo for chezmoi itself.
-const (
- gitHubOwner = "twpayne"
- gitHubRepo = "chezmoi"
-
- readSourceStateHookName = "read-source-state"
-)
+const readSourceStateHookName = "read-source-state"
var (
noArgs = []string(nil)
diff --git a/internal/cmd/config.go b/internal/cmd/config.go
index 2b5fa96775b..ea779703f08 100644
--- a/internal/cmd/config.go
+++ b/internal/cmd/config.go
@@ -379,10 +379,6 @@ func newConfig(options ...configOption) (*Config, error) {
unmanaged: unmanagedCmdConfig{
pathStyle: chezmoi.PathStyleRelative,
},
- upgrade: upgradeCmdConfig{
- owner: gitHubOwner,
- repo: gitHubRepo,
- },
// Configuration.
fileSystem: vfs.OSFS,
diff --git a/internal/cmd/doctorcmd.go b/internal/cmd/doctorcmd.go
index 7329db2e658..9a156759acd 100644
--- a/internal/cmd/doctorcmd.go
+++ b/internal/cmd/doctorcmd.go
@@ -118,8 +118,6 @@ type goVersionCheck struct{}
type latestVersionCheck struct {
httpClient *http.Client
httpClientErr error
- owner string
- repo string
version semver.Version
}
@@ -179,8 +177,6 @@ func (c *Config) runDoctorCmd(cmd *cobra.Command, args []string) error {
&latestVersionCheck{
httpClient: httpClient,
httpClientErr: httpClientErr,
- owner: gitHubOwner,
- repo: gitHubRepo,
version: c.version,
},
osArchCheck{},
@@ -663,7 +659,7 @@ func (c *latestVersionCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.A
ctx := context.Background()
gitHubClient := chezmoi.NewGitHubClient(ctx, c.httpClient)
- rr, _, err := gitHubClient.Repositories.GetLatestRelease(ctx, c.owner, c.repo)
+ rr, _, err := gitHubClient.Repositories.GetLatestRelease(ctx, "twpayne", "chezmoi")
var rateLimitErr *github.RateLimitError
var abuseRateLimitErr *github.AbuseRateLimitError
switch {
diff --git a/internal/cmd/upgradecmd.go b/internal/cmd/upgradecmd.go
index c835dd26581..b0e6354ddad 100644
--- a/internal/cmd/upgradecmd.go
+++ b/internal/cmd/upgradecmd.go
@@ -45,8 +45,6 @@ var (
type upgradeCmdConfig struct {
executable string
method string
- owner string
- repo string
}
func (c *Config) newUpgradeCmd() *cobra.Command {
@@ -64,8 +62,6 @@ func (c *Config) newUpgradeCmd() *cobra.Command {
upgradeCmd.Flags().StringVar(&c.upgrade.executable, "executable", c.upgrade.method, "Set executable to replace")
upgradeCmd.Flags().StringVar(&c.upgrade.method, "method", c.upgrade.method, "Set upgrade method")
- upgradeCmd.Flags().StringVar(&c.upgrade.owner, "owner", c.upgrade.owner, "Set owner")
- upgradeCmd.Flags().StringVar(&c.upgrade.repo, "repo", c.upgrade.repo, "Set repo")
return upgradeCmd
}
@@ -86,7 +82,7 @@ func (c *Config) runUpgradeCmd(cmd *cobra.Command, args []string) error {
client := chezmoi.NewGitHubClient(ctx, httpClient)
// Get the latest release.
- rr, _, err := client.Repositories.GetLatestRelease(ctx, c.upgrade.owner, c.upgrade.repo)
+ rr, _, err := client.Repositories.GetLatestRelease(ctx, "twpayne", "chezmoi")
if err != nil {
return err
}
@@ -159,7 +155,7 @@ func (c *Config) runUpgradeCmd(cmd *cobra.Command, args []string) error {
// that, otherwise look in $PATH.
path := c.upgrade.executable
if method != upgradeMethodReplaceExecutable {
- path, err = chezmoi.LookPath(c.upgrade.repo)
+ path, err = chezmoi.LookPath("chezmoi")
if err != nil {
return err
}
@@ -174,7 +170,7 @@ func (c *Config) runUpgradeCmd(cmd *cobra.Command, args []string) error {
}
func (c *Config) getChecksums(ctx context.Context, rr *github.RepositoryRelease) (map[string][]byte, error) {
- name := fmt.Sprintf("%s_%s_checksums.txt", c.upgrade.repo, strings.TrimPrefix(rr.GetTagName(), "v"))
+ name := fmt.Sprintf("chezmoi_%s_checksums.txt", strings.TrimPrefix(rr.GetTagName(), "v"))
releaseAsset := getReleaseAssetByName(rr, name)
if releaseAsset == nil {
return nil, fmt.Errorf("%s: cannot find release asset", name)
@@ -239,16 +235,16 @@ func (c *Config) replaceExecutable(
if libc, err = getLibc(); err != nil {
return
}
- archiveName = fmt.Sprintf("%s_%s_%s-%s_%s.tar.gz", c.upgrade.repo, releaseVersion, runtime.GOOS, libc, runtime.GOARCH)
+ archiveName = fmt.Sprintf("chezmoi_%s_%s-%s_%s.tar.gz", releaseVersion, runtime.GOOS, libc, runtime.GOARCH)
case runtime.GOOS == "linux" && runtime.GOARCH == "386":
archiveFormat = chezmoi.ArchiveFormatTarGz
- archiveName = fmt.Sprintf("%s_%s_%s_i386.tar.gz", c.upgrade.repo, releaseVersion, runtime.GOOS)
+ archiveName = fmt.Sprintf("chezmoi_%s_%s_i386.tar.gz", releaseVersion, runtime.GOOS)
case runtime.GOOS == "windows":
archiveFormat = chezmoi.ArchiveFormatZip
- archiveName = fmt.Sprintf("%s_%s_%s_%s.zip", c.upgrade.repo, releaseVersion, runtime.GOOS, runtime.GOARCH)
+ archiveName = fmt.Sprintf("chezmoi_%s_%s_%s.zip", releaseVersion, runtime.GOOS, runtime.GOARCH)
default:
archiveFormat = chezmoi.ArchiveFormatTarGz
- archiveName = fmt.Sprintf("%s_%s_%s_%s.tar.gz", c.upgrade.repo, releaseVersion, runtime.GOOS, runtime.GOARCH)
+ archiveName = fmt.Sprintf("chezmoi_%s_%s_%s.tar.gz", releaseVersion, runtime.GOOS, runtime.GOARCH)
}
releaseAsset := getReleaseAssetByName(rr, archiveName)
if releaseAsset == nil {
@@ -266,7 +262,7 @@ func (c *Config) replaceExecutable(
// Extract the executable from the archive.
var executableData []byte
- executableName := c.upgrade.repo
+ executableName := "chezmoi"
if runtime.GOOS == "windows" {
executableName += ".exe"
}
diff --git a/internal/cmd/upgradecmd_unix.go b/internal/cmd/upgradecmd_unix.go
index 2987a278289..d9322c90235 100644
--- a/internal/cmd/upgradecmd_unix.go
+++ b/internal/cmd/upgradecmd_unix.go
@@ -65,7 +65,7 @@ var (
)
func (c *Config) brewUpgrade() error {
- return c.run(chezmoi.EmptyAbsPath, "brew", []string{"upgrade", c.upgrade.repo})
+ return c.run(chezmoi.EmptyAbsPath, "brew", []string{"upgrade", "chezmoi"})
}
func (c *Config) getPackageFilename(packageType string, version *semver.Version, os, arch string) (string, error) {
@@ -74,18 +74,18 @@ func (c *Config) getPackageFilename(packageType string, version *semver.Version,
}
switch packageType {
case packageTypeAPK:
- return fmt.Sprintf("%s_%s_%s_%s.apk", c.upgrade.repo, version, os, arch), nil
+ return fmt.Sprintf("chezmoi_%s_%s_%s.apk", version, os, arch), nil
case packageTypeDEB:
- return fmt.Sprintf("%s_%s_%s_%s.deb", c.upgrade.repo, version, os, arch), nil
+ return fmt.Sprintf("chezmoi_%s_%s_%s.deb", version, os, arch), nil
case packageTypeRPM:
- return fmt.Sprintf("%s-%s-%s.rpm", c.upgrade.repo, version, arch), nil
+ return fmt.Sprintf("chezmoi-%s-%s.rpm", version, arch), nil
default:
return "", fmt.Errorf("%s: unsupported package type", packageType)
}
}
func (c *Config) snapRefresh() error {
- return c.run(chezmoi.EmptyAbsPath, "snap", []string{"refresh", c.upgrade.repo})
+ return c.run(chezmoi.EmptyAbsPath, "snap", []string{"refresh", "chezmoi"})
}
func (c *Config) upgradeUNIXPackage(
@@ -109,7 +109,7 @@ func (c *Config) upgradeUNIXPackage(
if useSudo {
args = append(args, "sudo")
}
- args = append(args, "pacman", "-S", c.upgrade.repo)
+ args = append(args, "pacman", "-S", "chezmoi")
return c.run(chezmoi.EmptyAbsPath, args[0], args[1:])
}
diff --git a/internal/cmd/upgradecmd_windows.go b/internal/cmd/upgradecmd_windows.go
index 42cfcc53c98..22ef5524957 100644
--- a/internal/cmd/upgradecmd_windows.go
+++ b/internal/cmd/upgradecmd_windows.go
@@ -5,7 +5,6 @@ package cmd
import (
"context"
"errors"
- "fmt"
"io/fs"
"os"
"path/filepath"
@@ -96,8 +95,9 @@ func (c *Config) upgradeUNIXPackage(
}
func (c *Config) winGetUpgrade() error {
- format := "upgrade command is not currently supported for WinGet installations. chezmoi can still be upgraded via WinGet by running `winget upgrade --id %s.%s --source winget`"
- return fmt.Errorf(format, c.upgrade.owner, c.upgrade.repo)
+ return errors.New(
+ "upgrade command is not currently supported for WinGet installations. chezmoi can still be upgraded via WinGet by running `winget upgrade --id twpayne.chezmoi --source winget`",
+ )
}
// getLibc attempts to determine the system's libc.
|
chore
|
Remove owner/repo abstraction
|
3f6897d73c05399d57f64404fd635cdd4459295c
|
2025-01-01 23:03:00
|
Tom Payne
|
chore: Update GitHub Actions
| false
|
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 37009b80b8a..f91d1e270ca 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -70,10 +70,10 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}
upload-cache: false
- - uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88
+ - uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169
with:
languages: go
- - uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88
+ - uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169
misspell:
runs-on: ubuntu-22.04
permissions:
|
chore
|
Update GitHub Actions
|
ee0c3a5b7be8c7f8e22222275def7026df26bb55
|
2024-12-29 14:39:46
|
bakito
|
chore: Apply lint rules for missing keepassxc attributes
| false
|
diff --git a/internal/cmd/keepassxctemplatefuncs.go b/internal/cmd/keepassxctemplatefuncs.go
index 3b2fdd380da..96165983028 100644
--- a/internal/cmd/keepassxctemplatefuncs.go
+++ b/internal/cmd/keepassxctemplatefuncs.go
@@ -83,8 +83,6 @@ func (c *Config) keepassxcAttachmentTemplateFunc(entry, name string) string {
if data, ok := c.Keepassxc.cache[entry]; ok {
if att, ok := data[name]; ok {
return att
- } else {
- panic(fmt.Sprintf("attachment %s of entry %s not found", name, entry))
}
}
panic(fmt.Sprintf("attachment %s of entry %s not found", name, entry))
|
chore
|
Apply lint rules for missing keepassxc attributes
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.