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
c1a53e1ae448eaef8eff74de0933238dbcba31d3
2022-09-12 22:54:21
Tom Payne
fix: Treat git-repo externals as directories of include/exclude purposes
false
diff --git a/pkg/chezmoi/entrytypeset.go b/pkg/chezmoi/entrytypeset.go index 814fef4c583..2bb19a87175 100644 --- a/pkg/chezmoi/entrytypeset.go +++ b/pkg/chezmoi/entrytypeset.go @@ -98,7 +98,7 @@ func (s *EntryTypeSet) IncludeTargetStateEntry(targetStateEntry TargetStateEntry case *TargetStateFile: return s.bits&EntryTypeFiles != 0 case *TargetStateModifyDirWithCmd: - return s.bits&EntryTypeScripts != 0 + return s.bits&EntryTypeDirs != 0 case *TargetStateRemove: return s.bits&EntryTypeRemove != 0 case *TargetStateScript: diff --git a/pkg/cmd/testdata/scripts/externalgitrepo.txtar b/pkg/cmd/testdata/scripts/externalgitrepo.txtar index e824c928c6b..f4545db2932 100644 --- a/pkg/cmd/testdata/scripts/externalgitrepo.txtar +++ b/pkg/cmd/testdata/scripts/externalgitrepo.txtar @@ -4,6 +4,10 @@ mkgitconfig expandenv $WORK/home/user/.local/share/chezmoi/.chezmoiexternal.toml +# test that chezmoi managed lists the directory +exec chezmoi managed +stdout ^\.dir$ + # create a git repo cd $WORK/repo exec git init
fix
Treat git-repo externals as directories of include/exclude purposes
585adb1f26dfefd09c7c5121d5080fc980c73042
2022-02-25 04:18:52
Tom Payne
feat: Add initial git-repo external type
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 5cdb9e293a8..b31bcb13b0c 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 @@ -12,21 +12,23 @@ externals to be included on different machines. Entries are indexed by target name relative to the directory of the `.chezmoiexternal.<format>` file, and must have a `type` and a `url` field. -`type` can be either `file` or `archive`. If the entry's parent directories do -not already exist in the source state then chezmoi will create them as regular -directories. +`type` can be either `file`, `archive`, or `git-repo`. If the entry's parent +directories do not already exist in the source state then chezmoi will create +them as regular directories. Entries may have the following fields: | Variable | Type | Default value | Description | | ----------------- | -------- | ------------- | ------------------------------------------------------------- | -| `type` | string | *none* | External type (`file` or `archive`) | +| `type` | string | *none* | External type (`file`, `archive`, or `git-repo`) | +| `clone.args` | []string | *none* | Extra args to `git clone` | | `encrypted` | bool | `false` | Whether the external is encrypted | | `exact` | bool | `false` | Add `exact_` attribute to directories in archive | | `executable` | bool | `false` | Add `executable_` attribute to file | | `filter.command` | string | *none* | Command to filter contents | | `filter.args` | []string | *none* | Extra args to command to filter contents | | `format` | string | *autodetect* | Format of archive | +| `pull.args` | []string | *none* | Extra args to `git pull` | | `refreshPeriod` | duration | `0` | Refresh period | | `stripComponents` | int | `0` | Number of leading directory components to strip from archives | | `url` | string | *none* | URL | @@ -52,12 +54,17 @@ The supported archive formats are `tar`, `tar.gz`, `tgz`, `tar.bz2`, `tbz2`, `xz`, and `zip`. If `format` is not specified then chezmoi will guess the format using firstly the path of the URL and secondly its contents. -By default, chezmoi will cache downloaded URLs. The optional duration -`refreshPeriod` field specifies how often chezmoi will re-download the URL. The -default is zero meaning that chezmoi will never re-download unless forced. To -force chezmoi to re-download URLs, pass the `-R`/`--refresh-externals` flag. -Suitable refresh periods include one day (`24h`), one week (`168h`), or four -weeks (`672h`). +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 +exists, then chezmoi will run `git pull` with the optional `pull.args` to +update the target. + +For `file` and `archive` externals, chezmoi will cache downloaded URLs. The +optional duration `refreshPeriod` field specifies how often chezmoi will +re-download the URL. The default is zero meaning that chezmoi will never +re-download unless forced. To force chezmoi to re-download URLs, pass the +`-R`/`--refresh-externals` flag. Suitable refresh periods include one day +(`24h`), one week (`168h`), or four weeks (`672h`). !!! example diff --git a/assets/chezmoi.io/docs/user-guide/include-dotfiles-from-elsewhere.md b/assets/chezmoi.io/docs/user-guide/include-dotfiles-from-elsewhere.md index c828b56867e..ba49e6f4406 100644 --- a/assets/chezmoi.io/docs/user-guide/include-dotfiles-from-elsewhere.md +++ b/assets/chezmoi.io/docs/user-guide/include-dotfiles-from-elsewhere.md @@ -87,6 +87,50 @@ to include refreshPeriod = "168h" ``` +## Include a subdirectory from a git repository + +You can configure chezmoi to keep a git repository up to date in a subdirectory +by using the external type `git-repo`, for example: + +```toml title="~/.local/share/chezmoi/.chezmoiexternal.toml" +[".vim/pack/alker0/chezmoi.vim"] + type = "git-repo" + url = "https://github.com/alker0/chezmoi.vim.git" + refreshPeriod = "168h" +``` + +If the directory does not exist then chezmoi will run `git clone` to clone it. +If the directory does exist then chezmoi will run `git pull` to pull the latest +changes, but not more often than every `refreshPeriod`. In the above example +the `refreshPeriod` is `168h` which is one week. The default `refreshPeriod` is +zero, which disables refreshes. You can force a refresh (i.e. force a `git +pull`) by passing the `--refresh-externals`/`-R` flag to `chezmoi apply`. + +You can customize the arguments to `git clone` and `git pull` by setting the +`<dir>.clone.args` and `<dir>.pull.args` variables in +`.chezmoiexternal.<format>`, for example: + +```toml title="~/.local/share/chezmoi/.chezmoiexternal.toml" +[".vim/pack/alker0/chezmoi.vim"] + type = "git-repo" + url = "https://github.com/alker0/chezmoi.vim.git" + refreshPeriod = "168h" + [".vim/pack/alker0/chezmoi.vim".pull] + args = ["--ff-only"] +``` + +!!! note + + chezmoi's support for `git-repo` externals is limited to running `git + clone` and/or `git pull` in a directory. The contents of `git-repo` + externals are not manifested in commands like `chezmoi archive` or `chezmoi + dump`. + +!!! note + + chezmoi's support for `git-repo` externals currently requires `git` to be + in your `$PATH`. + ## Import archives It is occasionally useful to import entire archives of configuration into your diff --git a/pkg/chezmoi/entrytypeset.go b/pkg/chezmoi/entrytypeset.go index ee3448fdb7f..a11bdaba0e5 100644 --- a/pkg/chezmoi/entrytypeset.go +++ b/pkg/chezmoi/entrytypeset.go @@ -97,6 +97,8 @@ func (s *EntryTypeSet) IncludeTargetStateEntry(targetStateEntry TargetStateEntry return s.bits&EntryTypeDirs != 0 case *TargetStateFile: return s.bits&EntryTypeFiles != 0 + case *TargetStateModifyDirWithCmd: + return s.bits&EntryTypeScripts != 0 case *TargetStateRemove: return s.bits&EntryTypeRemove != 0 case *TargetStateScript: diff --git a/pkg/chezmoi/persistentstate.go b/pkg/chezmoi/persistentstate.go index acc9ad21d4c..af109c92e78 100644 --- a/pkg/chezmoi/persistentstate.go +++ b/pkg/chezmoi/persistentstate.go @@ -11,6 +11,10 @@ var ( // scripts. scriptStateBucket = []byte("scriptState") + // modifyDirWithCmdStateBucket is the bucket for recording the state of + // commands that modify directories. + modifyDirWithCmdStateBucket = []byte("gitRepoExternalState") + stateFormat = formatJSON{} ) diff --git a/pkg/chezmoi/sourcerelpath.go b/pkg/chezmoi/sourcerelpath.go index 3691525d421..1153c21f948 100644 --- a/pkg/chezmoi/sourcerelpath.go +++ b/pkg/chezmoi/sourcerelpath.go @@ -5,6 +5,8 @@ import ( "strings" ) +var emptySourceRelPath SourceRelPath + // A SourceRelPath is a relative path to an entry in the source state. type SourceRelPath struct { relPath RelPath diff --git a/pkg/chezmoi/sourcestate.go b/pkg/chezmoi/sourcestate.go index 6d0588f2fd3..c356f18cf95 100644 --- a/pkg/chezmoi/sourcestate.go +++ b/pkg/chezmoi/sourcestate.go @@ -41,6 +41,7 @@ type ExternalType string const ( ExternalTypeArchive ExternalType = "archive" ExternalTypeFile ExternalType = "file" + ExternalTypeGitRepo ExternalType = "git-repo" ) // An External is an external source. @@ -49,11 +50,17 @@ type External struct { Encrypted bool `json:"encrypted" toml:"encrypted" yaml:"encrypted"` Exact bool `json:"exact" toml:"exact" yaml:"exact"` Executable bool `json:"executable" toml:"executable" yaml:"executable"` - Filter struct { + Clone struct { + Args []string `json:"args" toml:"args" yaml:"args"` + } `json:"clone" toml:"clone" yaml:"clone"` + 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"` + Format ArchiveFormat `json:"format" toml:"format" yaml:"format"` + Pull struct { + Args []string `json:"args" toml:"args" yaml:"args"` + } `json:"pull" toml:"pull" yaml:"pull"` RefreshPeriod time.Duration `json:"refreshPeriod" toml:"refreshPeriod" yaml:"refreshPeriod"` StripComponents int `json:"stripComponents" toml:"stripComponents" yaml:"stripComponents"` URL string `json:"url" toml:"url" yaml:"url"` @@ -1009,6 +1016,51 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error { } } + // Generate SourceStateCommands for git-repo externals. + var gitRepoExternalRelPaths RelPaths + for externalRelPath, external := range s.externals { + if external.Type == ExternalTypeGitRepo { + gitRepoExternalRelPaths = append(gitRepoExternalRelPaths, externalRelPath) + } + } + sort.Sort(gitRepoExternalRelPaths) + for _, externalRelPath := range gitRepoExternalRelPaths { + external := s.externals[externalRelPath] + destAbsPath := s.destDirAbsPath.Join(externalRelPath) + switch _, err := s.system.Lstat(destAbsPath); { + case errors.Is(err, fs.ErrNotExist): + // FIXME add support for using builtin git + args := []string{"clone"} + args = append(args, external.Clone.Args...) + args = append(args, external.URL, destAbsPath.String()) + cmd := exec.Command("git", args...) + sourceStateCommand := &SourceStateCommand{ + cmd: cmd, + external: true, + origin: external.origin, + forceRefresh: options.RefreshExternals, + refreshPeriod: external.RefreshPeriod, + } + allSourceStateEntries[externalRelPath] = append(allSourceStateEntries[externalRelPath], sourceStateCommand) + case err != nil: + return err + default: + // FIXME add support for using builtin git + args := []string{"pull"} + args = append(args, external.Pull.Args...) + cmd := exec.Command("git", args...) + cmd.Dir = destAbsPath.String() + sourceStateCommand := &SourceStateCommand{ + cmd: cmd, + external: true, + origin: external.origin, + forceRefresh: options.RefreshExternals, + refreshPeriod: external.RefreshPeriod, + } + allSourceStateEntries[externalRelPath] = append(allSourceStateEntries[externalRelPath], sourceStateCommand) + } + } + // Check for inconsistent source entries. Iterate over the target names in // order so that any error is deterministic. targetRelPaths := make(RelPaths, 0, len(allSourceStateEntries)) @@ -1748,6 +1800,8 @@ func (s *SourceState) readExternal( return s.readExternalArchive(ctx, externalRelPath, parentSourceRelPath, external, options) case ExternalTypeFile: return s.readExternalFile(ctx, externalRelPath, parentSourceRelPath, external, options) + case ExternalTypeGitRepo: + return nil, nil default: return nil, fmt.Errorf("%s: unknown external type: %s", externalRelPath, external.Type) } diff --git a/pkg/chezmoi/sourcestateentry.go b/pkg/chezmoi/sourcestateentry.go index b94f2820510..89056dd174b 100644 --- a/pkg/chezmoi/sourcestateentry.go +++ b/pkg/chezmoi/sourcestateentry.go @@ -2,6 +2,8 @@ package chezmoi import ( "encoding/hex" + "os/exec" + "time" "github.com/rs/zerolog" @@ -19,6 +21,15 @@ type SourceStateEntry interface { TargetStateEntry(destSystem System, destDirAbsPath AbsPath) (TargetStateEntry, error) } +// A SourceStateCommand represents a command that should be run. +type SourceStateCommand struct { + cmd *exec.Cmd + external bool + origin string + forceRefresh bool + refreshPeriod time.Duration +} + // A SourceStateDir represents the state of a directory in the source state. type SourceStateDir struct { Attr DirAttr @@ -46,6 +57,47 @@ type SourceStateRemove struct { targetRelPath RelPath } +// Evaluate evaluates s and returns any error. +func (s *SourceStateCommand) Evaluate() error { + return nil +} + +// External returns if s is from an external. +func (s *SourceStateCommand) External() bool { + return s.external +} + +// MarshalZerologObject implements +// github.com/rs/zerolog.LogObjectMarshaler.MarshalZerologObject. +func (s *SourceStateCommand) MarshalZerologObject(e *zerolog.Event) { + e.EmbedObject(chezmoilog.OSExecCmdLogObject{Cmd: s.cmd}) + e.Str("origin", s.origin) +} + +// Order returns s's order. +func (s *SourceStateCommand) Order() ScriptOrder { + return ScriptOrderDuring +} + +// Origin returns s's origin. +func (s *SourceStateCommand) Origin() string { + return s.origin +} + +// SourceRelPath returns s's source relative path. +func (s *SourceStateCommand) SourceRelPath() SourceRelPath { + return emptySourceRelPath +} + +// TargetStateEntry returns s's target state entry. +func (s *SourceStateCommand) TargetStateEntry(destSystem System, destDirAbsPath AbsPath) (TargetStateEntry, error) { + return &TargetStateModifyDirWithCmd{ + cmd: s.cmd, + forceRefresh: s.forceRefresh, + refreshPeriod: s.refreshPeriod, + }, nil +} + // Evaluate evaluates s and returns any error. func (s *SourceStateDir) Evaluate() error { return nil diff --git a/pkg/chezmoi/targetstateentry.go b/pkg/chezmoi/targetstateentry.go index 3e02ba25a52..d6a3e1257f2 100644 --- a/pkg/chezmoi/targetstateentry.go +++ b/pkg/chezmoi/targetstateentry.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/hex" "io/fs" + "os/exec" "runtime" "time" ) @@ -16,6 +17,14 @@ type TargetStateEntry interface { SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error) } +// A TargetStateModifyDirWithCmd represents running a command that modifies +// a directory. +type TargetStateModifyDirWithCmd struct { + cmd *exec.Cmd + forceRefresh bool + refreshPeriod time.Duration +} + // A TargetStateDir represents the state of a directory in the target state. type TargetStateDir struct { perm fs.FileMode @@ -45,12 +54,82 @@ type TargetStateSymlink struct { *lazyLinkname } +// 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"` +} + // 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"` } +// Apply updates actualStateEntry to match t. +func (t *TargetStateModifyDirWithCmd) Apply( + system System, persistentState PersistentState, actualStateEntry ActualStateEntry, +) (bool, error) { + if _, ok := actualStateEntry.(*ActualStateDir); !ok { + if err := actualStateEntry.Remove(system); err != nil { + return false, err + } + } + + runAt := time.Now().UTC() + if err := system.RunCmd(t.cmd); err != nil { + return false, err + } + + modifyDirWithCmdStateKey := []byte(actualStateEntry.Path().String()) + if err := persistentStateSet( + persistentState, modifyDirWithCmdStateBucket, modifyDirWithCmdStateKey, &modifyDirWithCmdState{ + Name: actualStateEntry.Path(), + RunAt: runAt, + }); err != nil { + return false, err + } + + return true, nil +} + +// EntryState returns t's entry state. +func (t *TargetStateModifyDirWithCmd) EntryState(umask fs.FileMode) (*EntryState, error) { + return &EntryState{ + Type: EntryStateTypeDir, + Mode: fs.ModeDir | 0o777&^umask, + }, nil +} + +// Evaluate evaluates t. +func (t *TargetStateModifyDirWithCmd) Evaluate() error { + return nil +} + +// SkipApply implements TargetState.SkipApply. +func (t *TargetStateModifyDirWithCmd) SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error) { + if t.forceRefresh { + return false, nil + } + modifyDirWithCmdKey := []byte(targetAbsPath.String()) + switch modifyDirWithCmdStateBytes, err := persistentState.Get(modifyDirWithCmdStateBucket, modifyDirWithCmdKey); { + case err != nil: + return false, err + case modifyDirWithCmdStateBytes == nil: + return false, nil + default: + var modifyDirWithCmdState modifyDirWithCmdState + if err := stateFormat.Unmarshal(modifyDirWithCmdStateBytes, &modifyDirWithCmdState); err != nil { + return false, err + } + if t.refreshPeriod == 0 { + return true, nil + } + return time.Since(modifyDirWithCmdState.RunAt) < t.refreshPeriod, nil + } +} + // Apply updates actualStateEntry to match t. It does not recurse. func (t *TargetStateDir) Apply( system System, persistentState PersistentState, actualStateEntry ActualStateEntry, diff --git a/pkg/cmd/main_test.go b/pkg/cmd/main_test.go index f9d929c0e74..979ceb789b7 100644 --- a/pkg/cmd/main_test.go +++ b/pkg/cmd/main_test.go @@ -31,6 +31,7 @@ import ( var ( envConditionRx = regexp.MustCompile(`\Aenv:(\w+)\z`) + envVarRx = regexp.MustCompile(`\$\w+`) umaskConditionRx = regexp.MustCompile(`\Aumask:([0-7]{3})\z`) ) @@ -55,6 +56,7 @@ func TestScript(t *testing.T) { "chhome": cmdChHome, "cmpmod": cmdCmpMod, "edit": cmdEdit, + "expandenv": cmdExpandEnv, "httpd": cmdHTTPD, "issymlink": cmdIsSymlink, "mkfile": cmdMkFile, @@ -179,6 +181,32 @@ func cmdEdit(ts *testscript.TestScript, neg bool, args []string) { } } +// cmdExpandEnv expands environment variables in the given paths. +func cmdExpandEnv(ts *testscript.TestScript, neg bool, args []string) { + if neg { + ts.Fatalf("unsupported: ! expandenv") + } + if len(args) == 0 { + ts.Fatalf("usage: expandenv paths...") + } + for _, arg := range args { + filename := ts.MkAbs(arg) + data, err := os.ReadFile(filename) + if err != nil { + ts.Fatalf("%s: %v", filename, err) + } + data = envVarRx.ReplaceAllFunc(data, func(key []byte) []byte { + if value := ts.Getenv(string(bytes.TrimPrefix(key, []byte{'$'}))); value != "" { + return []byte(value) + } + return key + }) + if err := os.WriteFile(filename, data, 0o666); err != nil { + ts.Fatalf("%s: %v", filename, err) + } + } +} + // cmdHTTPD starts an HTTP server serving files from the given directory and // sets the HTTPD_URL environment variable to the URL of the server. func cmdHTTPD(ts *testscript.TestScript, neg bool, args []string) { diff --git a/pkg/cmd/testdata/scripts/externalgitrepo.txt b/pkg/cmd/testdata/scripts/externalgitrepo.txt new file mode 100644 index 00000000000..9300c1b8694 --- /dev/null +++ b/pkg/cmd/testdata/scripts/externalgitrepo.txt @@ -0,0 +1,60 @@ +[windows] skip 'UNIX only' +[!exec:git] skip 'git not found in $PATH' + +mkgitconfig +expandenv $WORK/home/user/.local/share/chezmoi/.chezmoiexternal.toml + +# create a git repo +cd $WORK/repo +exec git init +exec git add . +exec git commit --message 'initial commit' +cd $WORK + +# test that chezmoi apply clones the git repo +chezmoi apply --debug +cmp $HOME/.dir/.file golden/.file + +chhome home2/user +mkgitconfig +expandenv $WORK/home2/user/.local/share/chezmoi/.chezmoiexternal.toml + +# test that chezmoi apply clones the git repo +chezmoi apply --debug +cmp $HOME/.dir/.file golden/.file + +# update the git repo +cd $WORK/repo +edit $WORK/repo/.file +exec git commit --message 'edit .file' . +cd $WORK + +chhome home/user + +# test that chezmoi apply does not pull from the git repo when refreshDuration is zero +chezmoi apply +! grep '# edited' $HOME/.dir/.file + +# test that chezmoi apply --refresh-externals does pull from the git repo +chezmoi apply --refresh-externals +grep '# edited' $HOME/.dir/.file + +chhome home2/user + +# test that chezmoi apply does not pull from the git repo within the refresh period +chezmoi apply +! grep '# edited' $HOME/.dir/.file + +-- golden/.file -- +# contents of .file +-- home/user/.local/share/chezmoi/.chezmoiexternal.toml -- +[".dir"] + type = "git-repo" + url = "file://$WORK/repo" +-- home2/user/.local/share/chezmoi/.chezmoiexternal.toml -- +[".dir"] + type = "git-repo" + url = "file://$WORK/repo" + refreshPeriod = "1h" +-- repo/.file -- +# contents of .file
feat
Add initial git-repo external type
7e72386dd8adcf044d59d9a766a866e258ff8b92
2022-01-14 07:36:38
Tom Payne
docs: Fix indentation error in FAQ
false
diff --git a/docs/FAQ.md b/docs/FAQ.md index 037b8cb07ab..75a99f1e9ea 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -18,7 +18,7 @@ * [Why doesn't chezmoi use symlinks like GNU Stow?](#why-doesnt-chezmoi-use-symlinks-like-gnu-stow) * [What are the limitations of chezmoi's symlink mode?](#what-are-the-limitations-of-chezmois-symlink-mode) * [Can I change how chezmoi's source state is represented on disk?](#can-i-change-how-chezmois-source-state-is-represented-on-disk) - * [The output of `chezmoi diff` is broken and does not contain color. What could be wrong?](#the-output-of-chezmoi-diff-is-broken-and-does-not-contain-color-what-could-be-wrong) +* [The output of `chezmoi diff` is broken and does not contain color. What could be wrong?](#the-output-of-chezmoi-diff-is-broken-and-does-not-contain-color-what-could-be-wrong) * [gpg encryption fails. What could be wrong?](#gpg-encryption-fails-what-could-be-wrong) * [Why does the builtin `age` command not support passphrases, symmetric encryption, or SSH keys?](#why-does-the-builtin-age-command-not-support-passphrases-symmetric-encryption-or-ssh-keys) * [chezmoi reports `chezmoi: user: lookup userid NNNNN: input/output error`](#chezmoi-reports-chezmoi-user-lookup-userid-nnnnn-inputoutput-error) @@ -383,7 +383,7 @@ but must meet the following criteria, in order of importance: --- -### The output of `chezmoi diff` is broken and does not contain color. What could be wrong? +## The output of `chezmoi diff` is broken and does not contain color. What could be wrong? By default, chezmoi's diff output includes ANSI color escape sequences (e.g. `ESC[37m`) and is piped into your pager (by default `less`). chezmoi assumes
docs
Fix indentation error in FAQ
621379b0c85082840529a2460954d5a13353569a
2025-01-12 20:35:08
Tom Payne
feat: Add --git-lfs option 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 64837b2c4db..880193028c7 100644 --- a/assets/chezmoi.io/docs/reference/commands/init.md +++ b/assets/chezmoi.io/docs/reference/commands/init.md @@ -57,6 +57,10 @@ existing template data. Clone the repo with depth *depth*. +### `--git-lfs` *bool* + +Run `git lfs pull` after cloning the repo. + ### `-g`, `--guess-repo-url` *bool* Guess the repo URL from the *repo* argument. This defaults to `true`. diff --git a/assets/chezmoi.io/docs/reference/configuration-file/variables.md.yaml b/assets/chezmoi.io/docs/reference/configuration-file/variables.md.yaml index 84c870aa4be..7f20f7e76c1 100644 --- a/assets/chezmoi.io/docs/reference/configuration-file/variables.md.yaml +++ b/assets/chezmoi.io/docs/reference/configuration-file/variables.md.yaml @@ -226,6 +226,9 @@ sections: commitMessageTemplateFile: type: string description: Commit message template file (relative to source directory) + lfs: + type: bool + description: Run `git lfs pull` after cloning gitHub: refreshPeriod: type: duration diff --git a/internal/cmd/gitcmd.go b/internal/cmd/gitcmd.go index 64ff4cc2156..091ec6b7b5e 100644 --- a/internal/cmd/gitcmd.go +++ b/internal/cmd/gitcmd.go @@ -11,6 +11,7 @@ type gitCmdConfig struct { AutoPush bool `json:"autopush" mapstructure:"autopush" yaml:"autopush"` CommitMessageTemplate string `json:"commitMessageTemplate" mapstructure:"commitMessageTemplate" yaml:"commitMessageTemplate"` CommitMessageTemplateFile string `json:"commitMessageTemplateFile" mapstructure:"commitMessageTemplateFile" yaml:"commitMessageTemplateFile"` + LFS bool `json:"lfs" mapstructure:"lfs" yaml:"lfs"` } func (c *Config) newGitCmd() *cobra.Command { diff --git a/internal/cmd/initcmd.go b/internal/cmd/initcmd.go index 22c5d4c3ed5..eba3ba670d9 100644 --- a/internal/cmd/initcmd.go +++ b/internal/cmd/initcmd.go @@ -110,6 +110,7 @@ func (c *Config) newInitCmd() *cobra.Command { initCmd.Flags().VarP(c.init.filter.Exclude, "exclude", "x", "Exclude entry types") initCmd.Flags().BoolVarP(&c.init.guessRepoURL, "guess-repo-url", "g", c.init.guessRepoURL, "Guess the repo URL") initCmd.Flags().VarP(c.init.filter.Include, "include", "i", "Include entry types") + initCmd.Flags().BoolVar(&c.Git.LFS, "git-lfs", c.Git.LFS, "Run git pull lfs after cloning") initCmd.Flags().BoolVar(&c.init.oneShot, "one-shot", c.init.oneShot, "Run in one-shot mode") initCmd.Flags().BoolVarP(&c.init.purge, "purge", "p", c.init.purge, "Purge config and source directories after running") initCmd.Flags().BoolVarP(&c.init.purgeBinary, "purge-binary", "P", c.init.purgeBinary, "Purge chezmoi binary after running") @@ -129,6 +130,8 @@ func (c *Config) runInitCmd(cmd *cobra.Command, args []string) error { c.init.purgeBinary = true } + useBuiltinGit := c.UseBuiltinGit.Value(c.useBuiltinGitAutoFunc) + // If we're not in a working tree then init it or clone it. gitDirAbsPath := c.WorkingTreeAbsPath.JoinString(git.GitDirName) switch _, err := c.baseSystem.Stat(gitDirAbsPath); { @@ -138,8 +141,6 @@ func (c *Config) runInitCmd(cmd *cobra.Command, args []string) error { return err } - useBuiltinGit := c.UseBuiltinGit.Value(c.useBuiltinGitAutoFunc) - if len(args) == 0 { if useBuiltinGit { if err := c.builtinGitInit(workingTreeRawPath); err != nil { @@ -196,6 +197,13 @@ func (c *Config) runInitCmd(cmd *cobra.Command, args []string) error { return err } + if c.Git.LFS && !useBuiltinGit { + args := []string{"lfs", "pull"} + if err := c.run(chezmoi.EmptyAbsPath, c.Git.Command, args); err != nil { + return err + } + } + // Apply. if c.init.apply { if err := c.applyArgs(cmd.Context(), c.destSystem, c.DestDirAbsPath, noArgs, applyArgsOptions{ diff --git a/internal/cmd/testdata/scripts/initgitlfs.txtar b/internal/cmd/testdata/scripts/initgitlfs.txtar new file mode 100644 index 00000000000..518e4328289 --- /dev/null +++ b/internal/cmd/testdata/scripts/initgitlfs.txtar @@ -0,0 +1,15 @@ +[windows] skip 'UNIX only' + +chmod 755 bin/git + +# test that chezmoi init --git-lfs runs git lfs pull after cloning +exec chezmoi init --git-lfs user +cmpenv stdout golden/init + +-- bin/git -- +#!/bin/sh + +echo git $* +-- golden/init -- +git clone --recurse-submodules https://github.com/user/dotfiles.git $HOME/.local/share/chezmoi +git lfs pull
feat
Add --git-lfs option to init command
5e8d2b36692a5ea72704ae899a9c3d59e9de9bb1
2023-08-13 22:46:27
Tom Payne
feat: Add promptChoice and promptChoiceOnce template functions
false
diff --git a/assets/chezmoi.io/docs/reference/commands/execute-template.md b/assets/chezmoi.io/docs/reference/commands/execute-template.md index 0146aecdb6c..e4370c12106 100644 --- a/assets/chezmoi.io/docs/reference/commands/execute-template.md +++ b/assets/chezmoi.io/docs/reference/commands/execute-template.md @@ -20,6 +20,13 @@ from *pairs*. *pairs* is a comma-separated list of *prompt*`=`*value* pairs. If `promptBool` is called with a *prompt* that does not match any of *pairs*, then it returns false. +## `--promptChoice` *pairs* + +Simulate the `promptChoice` template function with a function that returns +values from *pairs*. *pairs* is a comma-separated list of *prompt*`=`*value* +pairs. If `promptChoice` is called with a *prompt* that does not match any of +*pairs*, then it returns false. + ## `--promptInt` *pairs* Simulate the `promptInt` template function with a function that returns values diff --git a/assets/chezmoi.io/docs/reference/commands/init.md b/assets/chezmoi.io/docs/reference/commands/init.md index 9c495f5bc56..c73574b5473 100644 --- a/assets/chezmoi.io/docs/reference/commands/init.md +++ b/assets/chezmoi.io/docs/reference/commands/init.md @@ -66,6 +66,13 @@ 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. +## `--promptChoice` *pairs* + +Populate the `promptChoice` template function with values from *pairs*. *pairs* +is a comma-separated list of *prompt*`=`*value* pairs. If `promptChoice` 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 diff --git a/assets/chezmoi.io/docs/reference/templates/init-functions/promptChoice.md b/assets/chezmoi.io/docs/reference/templates/init-functions/promptChoice.md new file mode 100644 index 00000000000..2c292b4d185 --- /dev/null +++ b/assets/chezmoi.io/docs/reference/templates/init-functions/promptChoice.md @@ -0,0 +1,3 @@ +# `promptChoice` *prompt* *choices* [*default*] + +`promptChoice` prompts the user with *prompt* and *choices* and returns the user's response. *choices* must be a list of strings. If *default* is passed and the user's response is empty then it returns *default*. diff --git a/assets/chezmoi.io/docs/reference/templates/init-functions/promptChoiceOnce.md b/assets/chezmoi.io/docs/reference/templates/init-functions/promptChoiceOnce.md new file mode 100644 index 00000000000..10585af5412 --- /dev/null +++ b/assets/chezmoi.io/docs/reference/templates/init-functions/promptChoiceOnce.md @@ -0,0 +1,5 @@ +# `promptChoiceOnce` *map* *path* *prompt* *choices* [*default*] + +`promptChoiceOnce` returns the value of *map* at *path* if it exists and is a +string, otherwise it prompts the user for one of *choices* with *prompt* and an +optional *default* using `promptChoice`. diff --git a/assets/chezmoi.io/mkdocs.yml b/assets/chezmoi.io/mkdocs.yml index 5d9bd59d49a..ce208845700 100644 --- a/assets/chezmoi.io/mkdocs.yml +++ b/assets/chezmoi.io/mkdocs.yml @@ -221,6 +221,8 @@ nav: - exit: reference/templates/init-functions/exit.md - promptBool: reference/templates/init-functions/promptBool.md - promptBoolOnce: reference/templates/init-functions/promptBoolOnce.md + - promptChoice: reference/templates/init-functions/promptChoice.md + - promptChoiceOnce: reference/templates/init-functions/promptChoiceOnce.md - promptInt: reference/templates/init-functions/promptInt.md - promptIntOnce: reference/templates/init-functions/promptIntOnce.md - promptString: reference/templates/init-functions/promptString.md diff --git a/internal/cmd/config.go b/internal/cmd/config.go index da611f708b4..5d7a8bdb200 100644 --- a/internal/cmd/config.go +++ b/internal/cmd/config.go @@ -771,6 +771,8 @@ func (c *Config) createConfigFile( "exit": c.exitInitTemplateFunc, "promptBool": c.promptBoolInteractiveTemplateFunc, "promptBoolOnce": c.promptBoolOnceInteractiveTemplateFunc, + "promptChoice": c.promptChoiceInteractiveTemplateFunc, + "promptChoiceOnce": c.promptChoiceOnceInteractiveTemplateFunc, "promptInt": c.promptIntInteractiveTemplateFunc, "promptIntOnce": c.promptIntOnceInteractiveTemplateFunc, "promptString": c.promptStringInteractiveTemplateFunc, @@ -1395,6 +1397,7 @@ func (c *Config) gitAutoCommit(status *git.Status) error { funcMap := maps.Clone(sprig.TxtFuncMap()) maps.Copy(funcMap, map[string]any{ "promptBool": c.promptBoolInteractiveTemplateFunc, + "promptChoice": c.promptChoiceInteractiveTemplateFunc, "promptInt": c.promptIntInteractiveTemplateFunc, "promptString": c.promptStringInteractiveTemplateFunc, "targetRelPath": func(source string) string { diff --git a/internal/cmd/config_test.go b/internal/cmd/config_test.go index bc0280969a0..8a0d19b2662 100644 --- a/internal/cmd/config_test.go +++ b/internal/cmd/config_test.go @@ -189,7 +189,7 @@ func withDestSystem(destSystem chezmoi.System) configOption { } } -func withNoTTY(noTTY bool) configOption { +func withNoTTY(noTTY bool) configOption { //nolint:unparam return func(c *Config) error { c.noTTY = noTTY return nil diff --git a/internal/cmd/executetemplatecmd.go b/internal/cmd/executetemplatecmd.go index 477ddd2f3c3..9beb55a43ff 100644 --- a/internal/cmd/executetemplatecmd.go +++ b/internal/cmd/executetemplatecmd.go @@ -7,6 +7,7 @@ import ( "strings" "github.com/spf13/cobra" + "golang.org/x/exp/slices" "github.com/twpayne/chezmoi/v2/internal/chezmoi" ) @@ -14,6 +15,7 @@ import ( type executeTemplateCmdConfig struct { init bool promptBool map[string]string + promptChoice map[string]string promptInt map[string]int promptString map[string]string stdinIsATTY bool @@ -47,6 +49,12 @@ func (c *Config) newExecuteTemplateCmd() *cobra.Command { c.executeTemplate.promptBool, "Simulate promptBool", ) + flags.StringToStringVar( + &c.executeTemplate.promptChoice, + "promptChoice", + c.executeTemplate.promptChoice, + "Simulate promptChoice", + ) flags.StringToIntVar( &c.executeTemplate.promptInt, "promptInt", @@ -148,6 +156,47 @@ func (c *Config) runExecuteTemplateCmd(cmd *cobra.Command, args []string) error return promptBoolInitTemplateFunc(field, args...) } + promptChoiceInitTemplateFunc := func(prompt string, choices []any, args ...string) string { + choiceStrs, err := anySliceToStringSlice(choices) + if err != nil { + panic(err) + } + switch len(args) { + case 0: + if value, ok := c.executeTemplate.promptChoice[prompt]; ok { + if !slices.Contains(choiceStrs, value) { + panic(fmt.Errorf("%s: invalid choice", value)) + } + return value + } + return prompt + case 1: + if value, ok := c.executeTemplate.promptChoice[prompt]; ok { + if !slices.Contains(choiceStrs, value) { + panic(fmt.Errorf("%s: invalid choice", value)) + } + return value + } + return args[0] + default: + err := fmt.Errorf("want 2 or 3 arguments, got %d", len(args)+1) + panic(err) + } + } + + 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) + } + if value, ok := nestedMap[lastKey]; ok { + if stringValue, ok := value.(string); ok { + return stringValue + } + } + return promptChoiceInitTemplateFunc(prompt, choices, args...) + } + promptIntInitTemplateFunc := func(prompt string, args ...int64) int64 { switch len(args) { case 0: @@ -163,7 +212,7 @@ func (c *Config) runExecuteTemplateCmd(cmd *cobra.Command, args []string) error } } - promptIntOnceInitTemplateFunc := func(m map[string]any, path any, field string, args ...int64) int64 { + promptIntOnceInitTemplateFunc := func(m map[string]any, path any, prompt string, args ...int64) int64 { nestedMap, lastKey, err := nestedMapAtPath(m, path) if err != nil { panic(err) @@ -173,7 +222,7 @@ func (c *Config) runExecuteTemplateCmd(cmd *cobra.Command, args []string) error return intValue } } - return promptIntInitTemplateFunc(field, args...) + return promptIntInitTemplateFunc(prompt, args...) } promptStringInitTemplateFunc := func(prompt string, args ...string) string { @@ -194,7 +243,7 @@ func (c *Config) runExecuteTemplateCmd(cmd *cobra.Command, args []string) error } } - promptStringOnceInitTemplateFunc := func(m map[string]any, path any, field string, args ...string) string { + promptStringOnceInitTemplateFunc := func(m map[string]any, path any, prompt string, args ...string) string { nestedMap, lastKey, err := nestedMapAtPath(m, path) if err != nil { panic(err) @@ -204,7 +253,7 @@ func (c *Config) runExecuteTemplateCmd(cmd *cobra.Command, args []string) error return stringValue } } - return promptStringInitTemplateFunc(field, args...) + return promptStringInitTemplateFunc(prompt, args...) } stdinIsATTYInitTemplateFunc := func() bool { @@ -215,6 +264,8 @@ func (c *Config) runExecuteTemplateCmd(cmd *cobra.Command, args []string) error "exit": c.exitInitTemplateFunc, "promptBool": promptBoolInitTemplateFunc, "promptBoolOnce": promptBoolOnceInitTemplateFunc, + "promptChoice": promptChoiceInitTemplateFunc, + "promptChoiceOnce": promptChoiceOnceInitTemplateFunc, "promptInt": promptIntInitTemplateFunc, "promptIntOnce": promptIntOnceInitTemplateFunc, "promptString": promptStringInitTemplateFunc, diff --git a/internal/cmd/inittemplatefuncs_test.go b/internal/cmd/inittemplatefuncs_test.go index 3e8b2377710..3454d185217 100644 --- a/internal/cmd/inittemplatefuncs_test.go +++ b/internal/cmd/inittemplatefuncs_test.go @@ -80,6 +80,96 @@ func TestPromptBoolInteractiveTemplateFunc(t *testing.T) { } } +func TestPromptChoiceInteractiveTemplateFunc(t *testing.T) { + for _, tc := range []struct { + name string + prompt string + choices []any + args []string + stdinStr string + expectedStdoutStr string + expected string + expectedErr bool + }{ + { + name: "response_without_default", + prompt: "choice", + choices: []any{"one", "two", "three"}, + stdinStr: "one\n", + expectedStdoutStr: "choice (one/two/three)? ", + expected: "one", + }, + { + name: "response_with_default", + prompt: "choice", + choices: []any{"one", "two", "three"}, + args: []string{"one"}, + stdinStr: "two\n", + expectedStdoutStr: "choice (one/two/three, default one)? ", + expected: "two", + }, + { + name: "no_response_with_default", + prompt: "choice", + choices: []any{"one", "two", "three"}, + args: []string{"three"}, + stdinStr: "\n", + expectedStdoutStr: "choice (one/two/three, default three)? ", + expected: "three", + }, + { + name: "invalid_response", + prompt: "choice", + choices: []any{"one", "two", "three"}, + stdinStr: "invalid\n", + expectedErr: true, + }, + { + name: "invalid_response_with_default", + prompt: "choice", + choices: []any{"one", "two", "three"}, + args: []string{"one"}, + stdinStr: "invalid\n", + expectedErr: true, + }, + { + name: "too_many_args", + prompt: "choice", + choices: []any{"one", "two", "three"}, + args: []string{"two", "three"}, + stdinStr: "\n", + expectedErr: true, + }, + { + name: "invalid_default", + prompt: "choice", + choices: []any{"one", "two", "three"}, + args: []string{"four"}, + stdinStr: "\n", + expectedErr: true, + }, + } { + t.Run(tc.name, func(t *testing.T) { + stdin := strings.NewReader(tc.stdinStr) + stdout := &strings.Builder{} + config, err := newConfig( + withNoTTY(true), + withStdin(stdin), + withStdout(stdout), + ) + assert.NoError(t, err) + if tc.expectedErr { + assert.Panics(t, func() { + config.promptChoiceInteractiveTemplateFunc(tc.prompt, tc.choices, tc.args...) + }) + } else { + assert.Equal(t, tc.expected, config.promptChoiceInteractiveTemplateFunc(tc.prompt, tc.choices, tc.args...)) + assert.Equal(t, tc.expectedStdoutStr, stdout.String()) + } + }) + } +} + func TestPromptIntInteractiveTemplateFunc(t *testing.T) { for _, tc := range []struct { name string diff --git a/internal/cmd/interactivetemplatefuncs.go b/internal/cmd/interactivetemplatefuncs.go index 76340893c1a..455ec44d8b0 100644 --- a/internal/cmd/interactivetemplatefuncs.go +++ b/internal/cmd/interactivetemplatefuncs.go @@ -11,6 +11,7 @@ import ( type interactiveTemplateFuncsConfig struct { forcePromptOnce bool promptBool map[string]string + promptChoice map[string]string promptDefaults bool promptInt map[string]int promptString map[string]string @@ -35,6 +36,12 @@ func (c *Config) addInteractiveTemplateFuncFlags(flags *pflag.FlagSet) { c.interactiveTemplateFuncs.promptBool, "Populate promptBool", ) + flags.StringToStringVar( + &c.interactiveTemplateFuncs.promptChoice, + "promptChoice", + c.interactiveTemplateFuncs.promptChoice, + "Populate promptChoice", + ) flags.StringToIntVar( &c.interactiveTemplateFuncs.promptInt, "promptInt", @@ -101,6 +108,49 @@ func (c *Config) promptBoolOnceInteractiveTemplateFunc( return c.promptBoolInteractiveTemplateFunc(prompt, args...) } +func (c *Config) promptChoiceInteractiveTemplateFunc(prompt string, choices []any, args ...string) string { + if len(args) > 1 { + err := fmt.Errorf("want 2 or 3 arguments, got %d", len(args)+2) + panic(err) + } + + if valueStr, ok := c.interactiveTemplateFuncs.promptChoice[prompt]; ok { + return valueStr + } + + choiceStrs, err := anySliceToStringSlice(choices) + if err != nil { + panic(err) + } + + value, err := c.promptChoice(prompt, choiceStrs, args...) + if err != nil { + panic(err) + } + return value +} + +func (c *Config) promptChoiceOnceInteractiveTemplateFunc(m map[string]any, path any, prompt string, choices []any, args ...string) string { + if len(args) > 1 { + err := fmt.Errorf("want 4 or 5 arguments, got %d", len(args)+4) + panic(err) + } + + nestedMap, lastKey, err := nestedMapAtPath(m, path) + if err != nil { + panic(err) + } + if !c.interactiveTemplateFuncs.forcePromptOnce { + if value, ok := nestedMap[lastKey]; ok { + if valueStr, ok := value.(string); ok { + return valueStr + } + } + } + + return c.promptChoiceInteractiveTemplateFunc(prompt, choices, args...) +} + func (c *Config) promptIntInteractiveTemplateFunc(prompt string, args ...int64) int64 { if len(args) > 1 { err := fmt.Errorf("want 1 or 2 arguments, got %d", len(args)+1) @@ -186,3 +236,18 @@ func (c *Config) promptStringOnceInteractiveTemplateFunc( return c.promptStringInteractiveTemplateFunc(prompt, args...) } + +func anySliceToStringSlice(slice []any) ([]string, error) { + result := make([]string, 0, len(slice)) + for _, elem := range slice { + switch elem := elem.(type) { + case []byte: + result = append(result, string(elem)) + case string: + result = append(result, elem) + default: + return nil, fmt.Errorf("%v: not a string", elem) + } + } + return result, nil +} diff --git a/internal/cmd/testdata/scripts/executetemplate.txtar b/internal/cmd/testdata/scripts/executetemplate.txtar index 38382ae758f..afdff8b95e0 100644 --- a/internal/cmd/testdata/scripts/executetemplate.txtar +++ b/internal/cmd/testdata/scripts/executetemplate.txtar @@ -60,6 +60,18 @@ stderr 'invalid syntax' exec chezmoi execute-template --init '{{ promptBool "value" true }}' stdout true +# test --init --promptChoice +exec chezmoi execute-template --init --promptChoice value=one '{{ promptChoice "value" (list "one" "two" "three") }}' +stdout one + +# test --init --promptChoice with an invalid value +! exec chezmoi execute-template --init --promptChoice value=four '{{ promptChoice "value" (list "one" "two" "three") }}' +stderr 'invalid choice' + +# test --init --promptChoice with a default value +exec chezmoi execute-template --init '{{ promptChoice "value" (list "one" "two" "three") "three" }}' +stdout three + # test --init --promptInt exec chezmoi execute-template --init --promptInt value=1 '{{ promptInt "value" }}' stdout 1 diff --git a/internal/cmd/testdata/scripts/init.txtar b/internal/cmd/testdata/scripts/init.txtar index 8c56831ca8f..fd5ada80a81 100644 --- a/internal/cmd/testdata/scripts/init.txtar +++ b/internal/cmd/testdata/scripts/init.txtar @@ -111,7 +111,7 @@ exec chezmoi init chhome home12/user # test chezmoi init --prompt* -exec chezmoi init --promptBool bool=true,boolOncePrompt=true --promptInt int=1,intOncePrompt=2 --promptString bool=string,stringOncePrompt=once +exec chezmoi init --promptBool bool=true,boolOncePrompt=true --promptChoice=choice=one,choiceOncePrompt=two --promptInt int=1,intOncePrompt=2 --promptString bool=string,stringOncePrompt=once cmp $CHEZMOICONFIGDIR/chezmoi.yaml golden/chezmoi.yaml chhome home13/user @@ -134,6 +134,8 @@ stdout ^value$ data: bool: true boolOnce: true + choice: one + choiceOnce: two int: 1 intOnce: 2 string: string @@ -142,6 +144,8 @@ data: data: bool: {{ promptBool "bool" }} boolOnce: {{ promptBoolOnce . "boolOnce" "boolOncePrompt" }} + choice: {{ promptChoice "choice" (list "one" "two" "three") }} + choiceOnce: {{ promptChoiceOnce . "choiceOnce" "choiceOncePrompt" (list "one" "two" "three") }} int: {{ promptInt "int" }} intOnce: {{ promptIntOnce . "intOnce" "intOncePrompt" }} string: {{ promptString "bool" }} diff --git a/internal/cmd/testdata/scripts/inittemplatefuncs.txtar b/internal/cmd/testdata/scripts/inittemplatefuncs.txtar index 6a09ec2fc58..c1cb4e84b94 100644 --- a/internal/cmd/testdata/scripts/inittemplatefuncs.txtar +++ b/internal/cmd/testdata/scripts/inittemplatefuncs.txtar @@ -6,6 +6,10 @@ exec chezmoi execute-template --init '{{ exit 0 }}' exec chezmoi execute-template --init --promptBool bool=true '{{ promptBoolOnce . "bool" "bool" }}' stdout true +# test promptChoiceOnce template function with execute-template --init +exec chezmoi execute-template --init --promptChoice choice=one '{{ promptChoiceOnce . "choice" "choice" (list "one" "two" "three") }}' +stdout one + # test promptIntOnce template function with execute-template --init exec chezmoi execute-template --init --promptInt int=1 '{{ promptIntOnce . "int" "int" }}' stdout 1
feat
Add promptChoice and promptChoiceOnce template functions
d1374cf82016a3ba18ace12c9e5809c9d0f2875d
2022-03-24 19:53:26
Tom Payne
feat: Add ignored command
false
diff --git a/assets/chezmoi.io/docs/reference/commands/ignored.md b/assets/chezmoi.io/docs/reference/commands/ignored.md new file mode 100644 index 00000000000..d967b033ed9 --- /dev/null +++ b/assets/chezmoi.io/docs/reference/commands/ignored.md @@ -0,0 +1,9 @@ +# `ignored` + +Print the list of entries ignored by chezmoi. + +!!! example + + ```console + $ chezmoi ignored + ``` diff --git a/assets/chezmoi.io/docs/user-guide/manage-machine-to-machine-differences.md b/assets/chezmoi.io/docs/user-guide/manage-machine-to-machine-differences.md index 6845de601ff..5a060150bbe 100644 --- a/assets/chezmoi.io/docs/user-guide/manage-machine-to-machine-differences.md +++ b/assets/chezmoi.io/docs/user-guide/manage-machine-to-machine-differences.md @@ -152,6 +152,12 @@ f* will ignore all files beginning with an `f` except `foo`. +You can see what files chezmoi ignores with the command + +```console +$ chezmoi ignored +``` + ## Handle different file locations on different systems with the same contents If you want to have the same file contents in different locations on different diff --git a/assets/chezmoi.io/mkdocs.yml b/assets/chezmoi.io/mkdocs.yml index 70d69a56c19..c4156499281 100644 --- a/assets/chezmoi.io/mkdocs.yml +++ b/assets/chezmoi.io/mkdocs.yml @@ -122,6 +122,7 @@ nav: - help: reference/commands/help.md - init: reference/commands/init.md - import: reference/commands/import.md + - ignored: reference/commands/ignored.md - license: reference/commands/license.md - list: reference/commands/list.md - manage: reference/commands/manage.md diff --git a/pkg/chezmoi/sourcestate.go b/pkg/chezmoi/sourcestate.go index bdc2f3e162e..6cb4c61e56f 100644 --- a/pkg/chezmoi/sourcestate.go +++ b/pkg/chezmoi/sourcestate.go @@ -106,6 +106,7 @@ type SourceState struct { templateOptions []string templates map[string]*template.Template externals map[RelPath]External + ignoredRelPaths map[RelPath]struct{} } // A SourceStateOption sets an option on a source state. @@ -250,6 +251,7 @@ func NewSourceState(options ...SourceStateOption) *SourceState { templateOptions: DefaultTemplateOptions, templates: make(map[string]*template.Template), externals: make(map[RelPath]External), + ignoredRelPaths: make(map[RelPath]struct{}), } for _, option := range options { option(s) @@ -306,6 +308,7 @@ DESTABSPATH: targetRelPath := destAbsPath.MustTrimDirPrefix(s.destDirAbsPath) if s.Ignore(targetRelPath) { + s.ignoredRelPaths[targetRelPath] = struct{}{} continue } @@ -740,6 +743,16 @@ func (s *SourceState) Ignore(targetRelPath RelPath) bool { return s.ignore.match(targetRelPath.String()) == patternSetMatchInclude } +// Ignored returns all ignored RelPaths. +func (s *SourceState) Ignored() RelPaths { + relPaths := make(RelPaths, 0, len(s.ignoredRelPaths)) + for relPath := range s.ignoredRelPaths { + relPaths = append(relPaths, relPath) + } + sort.Sort(relPaths) + return relPaths +} + // MustEntry returns the source state entry associated with targetRelPath, and // panics if it does not exist. func (s *SourceState) MustEntry(targetRelPath RelPath) SourceStateEntry { @@ -884,6 +897,7 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error { da := parseDirAttr(sourceName.String()) targetRelPath := parentSourceRelPath.Dir().TargetRelPath(s.encryption.EncryptedSuffix()).JoinString(da.TargetName) if s.Ignore(targetRelPath) { + s.ignoredRelPaths[targetRelPath] = struct{}{} return vfs.SkipDir } sourceStateDir := s.newSourceStateDir(sourceRelPath, da) @@ -898,6 +912,7 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error { fa := parseFileAttr(sourceName.String(), s.encryption.EncryptedSuffix()) targetRelPath := parentSourceRelPath.Dir().TargetRelPath(s.encryption.EncryptedSuffix()).JoinString(fa.TargetName) if s.Ignore(targetRelPath) { + s.ignoredRelPaths[targetRelPath] = struct{}{} return nil } var sourceStateEntry SourceStateEntry @@ -927,6 +942,7 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error { sort.Sort(externalRelPaths) for _, externalRelPath := range externalRelPaths { if s.Ignore(externalRelPath) { + s.ignoredRelPaths[externalRelPath] = struct{}{} continue } external := s.externals[externalRelPath] @@ -944,6 +960,7 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error { } for targetRelPath, sourceStateEntries := range externalSourceStateEntries { if s.Ignore(targetRelPath) { + s.ignoredRelPaths[targetRelPath] = struct{}{} continue } allSourceStateEntries[targetRelPath] = append(allSourceStateEntries[targetRelPath], sourceStateEntries...) @@ -953,6 +970,7 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error { // Remove all ignored targets. for targetRelPath := range allSourceStateEntries { if s.Ignore(targetRelPath) { + s.ignoredRelPaths[targetRelPath] = struct{}{} delete(allSourceStateEntries, targetRelPath) } } @@ -963,10 +981,11 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error { return err } for _, match := range matches { - if s.Ignore(NewRelPath(match)) { + targetRelPath := NewRelPath(match) + if s.Ignore(targetRelPath) { + s.ignoredRelPaths[targetRelPath] = struct{}{} continue } - targetRelPath := NewRelPath(match) sourceStateEntry := &SourceStateRemove{ sourceRelPath: NewSourceRelPath(".chezmoiremove"), targetRelPath: targetRelPath, @@ -1000,6 +1019,7 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error { continue } if s.Ignore(destEntryRelPath) { + s.ignoredRelPaths[destEntryRelPath] = struct{}{} continue } sourceStateRemove := &SourceStateRemove{ @@ -1886,6 +1906,7 @@ func (s *SourceState) readExternalArchive( targetRelPath := externalRelPath.JoinString(name) if s.Ignore(targetRelPath) { + s.ignoredRelPaths[targetRelPath] = struct{}{} return nil } @@ -2053,6 +2074,7 @@ func (s *SourceState) readScriptsDir( } targetRelPath := parentSourceRelPath.Dir().TargetRelPath(s.encryption.EncryptedSuffix()).JoinString(fa.TargetName) if s.Ignore(targetRelPath) { + s.ignoredRelPaths[targetRelPath] = struct{}{} return nil } var sourceStateEntry SourceStateEntry diff --git a/pkg/chezmoi/sourcestate_test.go b/pkg/chezmoi/sourcestate_test.go index 1650ee83938..9c6e8bdaebf 100644 --- a/pkg/chezmoi/sourcestate_test.go +++ b/pkg/chezmoi/sourcestate_test.go @@ -1097,6 +1097,9 @@ func TestSourceStateRead(t *testing.T) { "README.md": patternSetInclude, }), ), + withIgnoredRelPathStrs( + "README.md", + ), ), }, { @@ -1150,6 +1153,9 @@ func TestSourceStateRead(t *testing.T) { "dir/file3": patternSetInclude, }), ), + withIgnoredRelPathStrs( + "dir/file3", + ), ), }, { @@ -1198,6 +1204,9 @@ func TestSourceStateRead(t *testing.T) { "file2": patternSetInclude, }), ), + withIgnoredRelPathStrs( + "file2", + ), withRemove( mustNewPatternSet(t, map[string]patternSetIncludeType{ "file*": patternSetInclude, @@ -1241,6 +1250,9 @@ func TestSourceStateRead(t *testing.T) { "dir/file2": patternSetInclude, }), ), + withIgnoredRelPathStrs( + "dir/file2", + ), withRemove( mustNewPatternSet(t, map[string]patternSetIncludeType{ "dir/file*": patternSetInclude, @@ -1600,6 +1612,14 @@ func withIgnore(ignore *patternSet) SourceStateOption { } } +func withIgnoredRelPathStrs(relPathStrs ...string) SourceStateOption { + return func(s *SourceState) { + for _, relPathStr := range relPathStrs { + s.ignoredRelPaths[NewRelPath(relPathStr)] = struct{}{} + } + } +} + func withRemove(remove *patternSet) SourceStateOption { return func(s *SourceState) { s.remove = remove diff --git a/pkg/cmd/config.go b/pkg/cmd/config.go index c43129ee793..e6ec65795c7 100644 --- a/pkg/cmd/config.go +++ b/pkg/cmd/config.go @@ -1342,6 +1342,7 @@ func (c *Config) newRootCmd() (*cobra.Command, error) { c.newExecuteTemplateCmd(), c.newForgetCmd(), c.newGitCmd(), + c.newIgnoredCmd(), c.newImportCmd(), c.newInitCmd(), c.newInternalTestCmd(), diff --git a/pkg/cmd/ignoredcmd.go b/pkg/cmd/ignoredcmd.go new file mode 100644 index 00000000000..20de77906e4 --- /dev/null +++ b/pkg/cmd/ignoredcmd.go @@ -0,0 +1,35 @@ +package cmd + +import ( + "strings" + + "github.com/spf13/cobra" + + "github.com/twpayne/chezmoi/v2/pkg/chezmoi" +) + +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), + } + + return ignoredCmd +} + +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 { + return err + } + if err := builder.WriteByte('\n'); err != nil { + return err + } + } + return c.writeOutputString(builder.String()) +} diff --git a/pkg/cmd/targetpathcmd.go b/pkg/cmd/targetpathcmd.go index ca2989f40f4..6ee124c955e 100644 --- a/pkg/cmd/targetpathcmd.go +++ b/pkg/cmd/targetpathcmd.go @@ -25,7 +25,7 @@ func (c *Config) runTargetPathCmd(cmd *cobra.Command, args []string) error { return c.writeOutputString(c.DestDirAbsPath.String() + "\n") } - var sb strings.Builder + builder := strings.Builder{} for _, arg := range args { argAbsPath, err := chezmoi.NewAbsPathFromExtPath(arg, c.homeDirAbsPath) @@ -50,19 +50,19 @@ func (c *Config) runTargetPathCmd(cmd *cobra.Command, args []string) error { targetRelPath := sourceRelPath.TargetRelPath(c.encryption.EncryptedSuffix()) - if _, err := sb.WriteString(c.DestDirAbsPath.String()); err != nil { + if _, err := builder.WriteString(c.DestDirAbsPath.String()); err != nil { return err } - if err := sb.WriteByte('/'); err != nil { + if err := builder.WriteByte('/'); err != nil { return err } - if _, err := sb.WriteString(targetRelPath.String()); err != nil { + if _, err := builder.WriteString(targetRelPath.String()); err != nil { return err } - if err := sb.WriteByte('\n'); err != nil { + if err := builder.WriteByte('\n'); err != nil { return err } } - return c.writeOutputString(sb.String()) + return c.writeOutputString(builder.String()) } diff --git a/pkg/cmd/testdata/scripts/ignore.txt b/pkg/cmd/testdata/scripts/ignore.txt index e421d07198b..2bc3064308c 100644 --- a/pkg/cmd/testdata/scripts/ignore.txt +++ b/pkg/cmd/testdata/scripts/ignore.txt @@ -7,6 +7,10 @@ exists $HOME/.file ! exists $HOME/README.md ! exists $HOME/.dir +# test that chezmoi ignored lists the ignored entries +chezmoi ignored +cmp stdout golden/ignored + chhome home2/user # test that chezmoi manage lists all managed files @@ -41,6 +45,9 @@ cmp stdout golden/managed-ignore-star-star-slash-star-dot-txt */*.txt -- golden/.chezmoiignore-star-star-slash-star-dot-txt -- **/*.txt +-- golden/ignored -- +.dir +README.md -- golden/managed-all -- .dir .dir/file.txt diff --git a/pkg/cmd/testdata/scripts/ignored.txt b/pkg/cmd/testdata/scripts/ignored.txt new file mode 100644 index 00000000000..f1a3109077e --- /dev/null +++ b/pkg/cmd/testdata/scripts/ignored.txt @@ -0,0 +1,16 @@ +mksourcedir + +# test that chezmoi ignored prints the list of ignored paths +chezmoi ignored +cmp stdout golden/ignored + +-- golden/ignored -- +.dir/file +.dir/subdir +.readonly +.template +-- home/user/.local/share/chezmoi/.chezmoiignore -- +.dir/subdir +.read* +**/file +.template
feat
Add ignored command
2ec90c4b3b2cefa1d874f83b0f3817557b76a3e7
2023-05-14 12:23:58
dependabot[bot]
chore(deps): bump github.com/cloudflare/circl from 1.3.2 to 1.3.3
false
diff --git a/go.mod b/go.mod index 19f1717afa7..8f5591e6d76 100644 --- a/go.mod +++ b/go.mod @@ -78,7 +78,7 @@ require ( github.com/bradenhilton/cityhash v1.0.0 // indirect github.com/charmbracelet/harmonica v0.2.0 // indirect github.com/charmbracelet/lipgloss v0.7.1 // indirect - github.com/cloudflare/circl v1.3.2 // 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 diff --git a/go.sum b/go.sum index 630b8757fb2..269e0959a28 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ -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= @@ -60,7 +58,6 @@ 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= @@ -73,7 +70,6 @@ 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.2 h1:S2C0mmSjCLS3H9+zfXoIoKzl+cOncvBvt6pE+zTm5Ms= 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= @@ -87,18 +83,15 @@ github.com/charmbracelet/lipgloss v0.6.0/go.mod h1:tHh2wr34xcHjC2HCXIlGSG1jaDF0S github.com/charmbracelet/lipgloss v0.7.1 h1:17WMwi7N1b1rVWOjMT+rCh7sQkvDU75B2hbZpc5Kc1E= github.com/charmbracelet/lipgloss v0.7.1/go.mod h1:yG0k3giv8Qj8edTCbbg6AlQ5e8KNWpFujkNawKNhE2c= github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= -github.com/cloudflare/circl v1.3.2 h1:VWp8dY3yH69fdM7lM6A1+NhhVoDu9vqK0jOgmkQHFWk= -github.com/cloudflare/circl v1.3.2/go.mod h1:+CauBF6R70Jqcyl8N2hC8pAXYbWkGIezuSbuGLtRhnw= +github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= 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.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/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= 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/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -172,11 +165,8 @@ 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= @@ -186,12 +176,10 @@ 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= @@ -224,7 +212,6 @@ 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= @@ -241,7 +228,6 @@ 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= @@ -251,7 +237,6 @@ 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= @@ -262,22 +247,17 @@ 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/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/skeema/knownhosts v1.1.0 h1:Wvr9V0MxhjRbl3f9nMnKnFfiWTJmtECJ9Njkea3ysW0= github.com/skeema/knownhosts v1.1.0/go.mod h1:sKFq3RD6/TKZkSWn8boUbDC7Qkgcv+8XXijpFO6roag= github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w= @@ -312,7 +292,6 @@ 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= @@ -328,11 +307,8 @@ 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= @@ -427,7 +403,6 @@ 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/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= @@ -444,12 +419,10 @@ 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= @@ -458,8 +431,6 @@ 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
bump github.com/cloudflare/circl from 1.3.2 to 1.3.3
73bbc21a0fd6da533ac9e6fff720bde98d305657
2024-09-19 23:51:43
Tom Payne
chore: Update tools
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4a04ec8f058..995528c87ab 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ env: 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 - GORELEASER_VERSION: 2.3.0 # https://github.com/goreleaser/goreleaser/releases + GORELEASER_VERSION: 2.3.2 # https://github.com/goreleaser/goreleaser/releases GOVERSIONINFO_VERSION: 1.4.1 # https://github.com/josephspurrier/goversioninfo/releases RAGE_VERSION: 0.10.0 # https://github.com/str4d/rage/releases jobs:
chore
Update tools
4417ba455d62264b4dd88e28323a41204068a045
2021-12-27 02:23:00
Tim Byrne
docs: Update yadm comparison (windows)
false
diff --git a/docs/COMPARISON.md b/docs/COMPARISON.md index b80ea514431..29666455485 100644 --- a/docs/COMPARISON.md +++ b/docs/COMPARISON.md @@ -26,7 +26,7 @@ | Distribution | Single binary | Python package | Multiple files | Ruby gem | Single script or package | Single script | - | | Install method | Many | git submodule | Many | Ruby gem | Many | Many | Manual | | Non-root install on bare system | ✅ | ⁉️ | ⁉️ | ⁉️ | ✅ | ✅ | ✅ | -| Windows support | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | +| Windows support | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ | | Bootstrap requirements | None | Python, git | Perl, git | Ruby, git | sh, git | git | git | | Source repos | Single | Single | Multiple | Single | Multiple | Single | Single | | dotfiles are... | Files | Symlinks | Files | Symlinks | Files | Files | Files |
docs
Update yadm comparison (windows)
53f7b92cd47cfc9184bae0813529c14fb436ee6b
2024-01-19 15:59:11
Tom Payne
feat: Add re-add --recursive flag and make it the default
false
diff --git a/assets/chezmoi.io/docs/reference/commands/re-add.md b/assets/chezmoi.io/docs/reference/commands/re-add.md index 51395b0b82a..5d35ac97b93 100644 --- a/assets/chezmoi.io/docs/reference/commands/re-add.md +++ b/assets/chezmoi.io/docs/reference/commands/re-add.md @@ -2,11 +2,15 @@ Re-add modified files in the target state, preserving any `encrypted_` attributes. chezmoi will not overwrite templates, and all entries that are not -files are ignored. +files are ignored. Directories are recursed into by default. If no *target*s are specified then all modified files are re-added. If one or more *target*s are given then only those targets are re-added. +## `-r`, `--recursive` + +Recursively add files in subdirectories. + !!! hint If you want to re-add a single file unconditionally, use `chezmoi add --force` instead. @@ -16,4 +20,5 @@ more *target*s are given then only those targets are re-added. ```console $ chezmoi re-add $ chezmoi re-add ~/.bashrc + $ chezmoi re-add --recursive=false ~/.config/git ``` diff --git a/internal/cmd/config.go b/internal/cmd/config.go index 2442cfca6cd..8a31eec61fd 100644 --- a/internal/cmd/config.go +++ b/internal/cmd/config.go @@ -364,7 +364,8 @@ func newConfig(options ...configOption) (*Config, error) { recursive: true, }, reAdd: reAddCmdConfig{ - filter: chezmoi.NewEntryTypeFilter(chezmoi.EntryTypesAll, chezmoi.EntryTypesNone), + filter: chezmoi.NewEntryTypeFilter(chezmoi.EntryTypesAll, chezmoi.EntryTypesNone), + recursive: true, }, unmanaged: unmanagedCmdConfig{ pathStyle: chezmoi.PathStyleRelative, diff --git a/internal/cmd/readdcmd.go b/internal/cmd/readdcmd.go index ac285c0d50c..ec818f40ccf 100644 --- a/internal/cmd/readdcmd.go +++ b/internal/cmd/readdcmd.go @@ -4,7 +4,6 @@ import ( "bytes" "fmt" "io/fs" - "path/filepath" "sort" "github.com/spf13/cobra" @@ -13,7 +12,8 @@ import ( ) type reAddCmdConfig struct { - filter *chezmoi.EntryTypeFilter + filter *chezmoi.EntryTypeFilter + recursive bool } func (c *Config) newReAddCmd() *cobra.Command { @@ -35,6 +35,7 @@ func (c *Config) newReAddCmd() *cobra.Command { flags := reAddCmd.Flags() flags.VarP(c.reAdd.filter.Exclude, "exclude", "x", "Exclude entry types") flags.VarP(c.reAdd.filter.Include, "include", "i", "Include entry types") + flags.BoolVarP(&c.reAdd.recursive, "recursive", "r", c.reAdd.recursive, "Recurse into subdirectories") registerExcludeIncludeFlagCompletionFuncs(reAddCmd) @@ -53,17 +54,15 @@ func (c *Config) runReAddCmd(cmd *cobra.Command, args []string, sourceState *che }, ) } else { - for _, arg := range args { - arg = filepath.Clean(arg) - destAbsPath, err := chezmoi.NewAbsPathFromExtPath(arg, c.homeDirAbsPath) - if err != nil { - return err - } - targetRelPath, err := c.targetRelPath(destAbsPath) - if err != nil { - return err - } - targetRelPaths = append(targetRelPaths, targetRelPath) + var err error + targetRelPaths, err = c.targetRelPaths(sourceState, args, targetRelPathsOptions{ + mustBeManaged: true, + recursive: c.reAdd.recursive, + }) + if err != nil { + return err + } + for _, targetRelPath := range targetRelPaths { sourceStateEntries[targetRelPath] = sourceState.Get(targetRelPath) } } diff --git a/internal/cmd/testdata/scripts/re-add.txtar b/internal/cmd/testdata/scripts/re-add.txtar index 658305e2bc7..444fae870f4 100644 --- a/internal/cmd/testdata/scripts/re-add.txtar +++ b/internal/cmd/testdata/scripts/re-add.txtar @@ -21,3 +21,11 @@ exec chezmoi re-add ~/.dir/file grep -count=1 '# edited' $CHEZMOISOURCEDIR/dot_file grep -count=2 '# edited' $CHEZMOISOURCEDIR/dot_dir/file grep -count=1 '# edited' $CHEZMOISOURCEDIR/dot_dir/exact_subdir/file + +# test that chezmoi re-add --recursive=false does not recurse into subdirectories +exec chezmoi re-add --recursive=false ~/.dir/subdir +grep -count=1 '# edited' $CHEZMOISOURCEDIR/dot_dir/exact_subdir/file + +# test that chezmoi re-add is recursive by default +exec chezmoi re-add ~/.dir/subdir +grep -count=2 '# edited' $CHEZMOISOURCEDIR/dot_dir/exact_subdir/file
feat
Add re-add --recursive flag and make it the default
e85f13ddd6b8d1e4b19e82823ab1447ee34d3eae
2021-12-11 21:21:23
Tom Payne
chore: Log duration of commands and HTTP requests
false
diff --git a/internal/chezmoi/sourcestate.go b/internal/chezmoi/sourcestate.go index f48590efafe..458e8e4a0e8 100644 --- a/internal/chezmoi/sourcestate.go +++ b/internal/chezmoi/sourcestate.go @@ -1164,9 +1164,11 @@ func (s *SourceState) getExternalDataRaw( if err != nil { return nil, err } + start := time.Now() resp, err := s.httpClient.Do(req) if resp != nil { s.logger.Err(err). + Stringer("duration", time.Since(start)). Str("method", req.Method). Int("statusCode", resp.StatusCode). Str("status", resp.Status). @@ -1174,6 +1176,7 @@ func (s *SourceState) getExternalDataRaw( Msg("HTTP") } else { s.logger.Err(err). + Stringer("duration", time.Since(start)). Str("method", req.Method). Stringer("url", req.URL). Msg("HTTP") diff --git a/internal/chezmoilog/chezmoilog.go b/internal/chezmoilog/chezmoilog.go index dbffa3f2857..611936b2e83 100644 --- a/internal/chezmoilog/chezmoilog.go +++ b/internal/chezmoilog/chezmoilog.go @@ -5,6 +5,7 @@ import ( "errors" "os" "os/exec" + "time" "github.com/rs/zerolog" "github.com/rs/zerolog/log" @@ -98,21 +99,25 @@ func FirstFewBytes(data []byte) []byte { // LogCmdCombinedOutput calls cmd.CombinedOutput, logs the result, and returns the result. func LogCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error) { + start := time.Now() combinedOutput, err := cmd.CombinedOutput() log.Err(err). EmbedObject(OSExecCmdLogObject{Cmd: cmd}). EmbedObject(OSExecExitErrorLogObject{Err: err}). Bytes("combinedOutput", Output(combinedOutput, err)). + Stringer("duration", time.Since(start)). Msg("CombinedOutput") return combinedOutput, err } // LogCmdOutput calls cmd.Output, logs the result, and returns the result. func LogCmdOutput(cmd *exec.Cmd) ([]byte, error) { + start := time.Now() output, err := cmd.Output() log.Err(err). EmbedObject(OSExecCmdLogObject{Cmd: cmd}). EmbedObject(OSExecExitErrorLogObject{Err: err}). + Stringer("duration", time.Since(start)). Bytes("output", Output(output, err)). Msg("Output") return output, err @@ -120,10 +125,12 @@ func LogCmdOutput(cmd *exec.Cmd) ([]byte, error) { // LogCmdRun calls cmd.Run, logs the result, and returns the result. func LogCmdRun(cmd *exec.Cmd) error { + start := time.Now() err := cmd.Run() log.Err(err). EmbedObject(OSExecCmdLogObject{Cmd: cmd}). EmbedObject(OSExecExitErrorLogObject{Err: err}). + Stringer("duration", time.Since(start)). Msg("Run") return err } diff --git a/internal/cmd/upgradecmd.go b/internal/cmd/upgradecmd.go index 59f8e10ffaa..0eccf6a05ce 100644 --- a/internal/cmd/upgradecmd.go +++ b/internal/cmd/upgradecmd.go @@ -19,6 +19,7 @@ import ( "regexp" "runtime" "strings" + "time" "github.com/coreos/go-semver/semver" "github.com/google/go-github/v40/github" @@ -245,9 +246,11 @@ func (c *Config) downloadURL(ctx context.Context, url string) ([]byte, error) { if err != nil { return nil, err } + start := time.Now() resp, err := httpClient.Do(req) if resp != nil { c.logger.Err(err). + Stringer("duration", time.Since(start)). Str("method", req.Method). Int("statusCode", resp.StatusCode). Str("status", resp.Status). @@ -255,6 +258,7 @@ func (c *Config) downloadURL(ctx context.Context, url string) ([]byte, error) { Msg("HTTP") } else { c.logger.Err(err). + Stringer("duration", time.Since(start)). Str("method", req.Method). Stringer("url", req.URL). Msg("HTTP")
chore
Log duration of commands and HTTP requests
84ac2e23f4e99d982aa7aa1e90ac959095afb854
2022-04-23 14:31:39
Tom Payne
docs: Add guide on encrypting files with GPG and a passphrase
false
diff --git a/assets/chezmoi.io/docs/user-guide/encryption/gpg.md b/assets/chezmoi.io/docs/user-guide/encryption/gpg.md index 86c05af06c7..868d7439550 100644 --- a/assets/chezmoi.io/docs/user-guide/encryption/gpg.md +++ b/assets/chezmoi.io/docs/user-guide/encryption/gpg.md @@ -58,3 +58,28 @@ chezmoi will encrypt files: ```sh gpg --armor --symmetric ``` + +## Encrypting files with a passphrase + +If you want to encrypt your files with a passphrase, but don't mind the +passphrase being stored in plaintext on your machines, then you can use the +following configuration: + +``` title="~/.local/share/chezmoi/.chezmoi.toml.tmpl" +{{ $passphrase := "" -}} +{{ if hasKey . "passphrase" -}} +{{ $passphrase = .passphrase -}} +{{ else -}} +{{ $passphrase = promptString "passphrase" -}} +{{ end -}} + +encryption = "gpg" +[data] + passphrase = {{ $passphrase | quote }} +[gpg] + symmetric = true + args = ["--batch", "--passphrase", {{ $passphrase | quote }}, "--no-symkey-cache"] +``` + +This will prompt you for the passphrase the first time you run `chezmoi init` on +a new machine, and then remember the passphrase in your configuration file.
docs
Add guide on encrypting files with GPG and a passphrase
781c5b7f6ada6512027905c9dd667a8fd6c1737e
2023-06-08 01:02:47
Tom Payne
chore: Blacklist non-Solaris-compatible charmbracelet/bubbletea
false
diff --git a/go.mod b/go.mod index 420ec190964..93322d9db1b 100644 --- a/go.mod +++ b/go.mod @@ -136,6 +136,7 @@ exclude ( github.com/charmbracelet/bubbles v0.16.1 // https://github.com/charmbracelet/bubbletea/issues/737 github.com/charmbracelet/bubbletea v0.24.0 // https://github.com/charmbracelet/bubbletea/issues/737 github.com/charmbracelet/bubbletea v0.24.1 // https://github.com/charmbracelet/bubbletea/issues/737 + github.com/charmbracelet/bubbletea v0.24.2 // 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
chore
Blacklist non-Solaris-compatible charmbracelet/bubbletea
ed9a05853cffa2ddd7a4e0f887be9423458fbf90
2022-01-22 21:33:04
Tom Payne
chore: Add misspell action
false
diff --git a/.github/workflows/misspell.yml b/.github/workflows/misspell.yml new file mode 100644 index 00000000000..94113daa9f3 --- /dev/null +++ b/.github/workflows/misspell.yml @@ -0,0 +1,20 @@ +name: misspell + +on: + push: + branches: + - master + tags: + - v* + pull_request: + +jobs: + misspell: + name: spellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: misspell + uses: reviewdog/action-misspell@v1 + with: + locale: "US" diff --git a/assets/chezmoi.io/docs/links/related-software.md b/assets/chezmoi.io/docs/links/related-software.md index 5ec19ea6f49..01b5945b106 100644 --- a/assets/chezmoi.io/docs/links/related-software.md +++ b/assets/chezmoi.io/docs/links/related-software.md @@ -15,7 +15,7 @@ chezmoi plugin for asdf version manager. ## [`github.com/tcaxle/drapeau`](https://github.com/tcaxle/drapeau) -An add-on to synchronise your colorschemes across systems and allow easy +An add-on to synchronize your colorschemes across systems and allow easy colorscheme switching using chezmoi templates. ## [`github.com/tuh8888/chezmoi.el`](https://github.com/tuh8888/chezmoi.el) diff --git a/assets/scripts/install.ps1 b/assets/scripts/install.ps1 index 70249a2eb9b..439ca50aac3 100644 --- a/assets/scripts/install.ps1 +++ b/assets/scripts/install.ps1 @@ -248,7 +248,7 @@ function Install-Chezmoi { ) # some sub-functions (ie, get_goarch, likely others) require fetching of - # non-existent properites to not error + # non-existent properties to not error Set-StrictMode -off # $BinDir = Resolve-Path $BinDir diff --git a/internal/cmd/testdata/scripts/scriptinterpreters_windows.txt b/internal/cmd/testdata/scripts/scriptinterpreters_windows.txt index b3f24109c74..d3064de9b95 100644 --- a/internal/cmd/testdata/scripts/scriptinterpreters_windows.txt +++ b/internal/cmd/testdata/scripts/scriptinterpreters_windows.txt @@ -39,6 +39,6 @@ Write-Host 'Hello from PowerShell' -- home3/user/.local/share/chezmoi/run_python_script.py -- #!/usr/bin/env python -# this should never be executed as the interpreter is overriden with +# this should never be executed as the interpreter is overridden with # fake-python.bat in the config file fail()
chore
Add misspell action
fc8c20f921eecbe20b01c98e54eb4d3b15ec42de
2025-01-08 02:07:01
bakito
fix: Correct nested groups for keepassxc builtin mode
false
diff --git a/internal/cmd/keepassxctemplatefuncs.go b/internal/cmd/keepassxctemplatefuncs.go index 96165983028..499f4c0f851 100644 --- a/internal/cmd/keepassxctemplatefuncs.go +++ b/internal/cmd/keepassxctemplatefuncs.go @@ -425,6 +425,9 @@ func keepassxcBuiltinBuildCache( entry, mapper, ) + if len(mapData) > 0 { + return mapData + } } } return map[string]string{} diff --git a/internal/cmd/keepassxctemplatefuncs_test.go b/internal/cmd/keepassxctemplatefuncs_test.go index 4af8fb02c65..1c9f10f154f 100644 --- a/internal/cmd/keepassxctemplatefuncs_test.go +++ b/internal/cmd/keepassxctemplatefuncs_test.go @@ -74,6 +74,13 @@ func TestKeepassxcTemplateFuncs(t *testing.T) { attachmentName := "test / attachment name" attachmentData := "test / attachment data" + nestedGroupName := "some/nested/group" + nestedEntryName := nestedGroupName + "/nested entry" + nestedEntryUsername := "nested / username" + nestedEntryPassword := "nested / password" + nestedAttachmentName := "nested / attachment name" + nestedAttachmentData := "nested / attachment data" + // Create a KeePassXC database. dbCreateCmd := exec.Command(command, "db-create", "--set-password", database) dbCreateCmd.Stdin = strings.NewReader(chezmoitest.JoinLines( @@ -84,35 +91,36 @@ func TestKeepassxcTemplateFuncs(t *testing.T) { dbCreateCmd.Stderr = os.Stderr assert.NoError(t, dbCreateCmd.Run()) - // Create a group in the database. - mkdirCmd := exec.Command(command, "mkdir", database, groupName) - mkdirCmd.Stdin = strings.NewReader(chezmoitest.JoinLines( - databasePassword, - )) - mkdirCmd.Stdout = os.Stdout - mkdirCmd.Stderr = os.Stderr - assert.NoError(t, mkdirCmd.Run()) - - // Create an entry in the database. - addCmd := exec.Command(command, "add", database, entryName, "--username", entryUsername, "--password-prompt") - addCmd.Stdin = strings.NewReader(chezmoitest.JoinLines( - databasePassword, - entryPassword, - )) - addCmd.Stdout = os.Stdout - addCmd.Stderr = os.Stderr - assert.NoError(t, addCmd.Run()) - - // Import an attachment to the entry in the database. - importFile := filepath.Join(tempDir, "import file") - assert.NoError(t, os.WriteFile(importFile, []byte(attachmentData), 0o666)) - attachmentImportCmd := exec.Command(command, "attachment-import", database, entryName, attachmentName, importFile) - attachmentImportCmd.Stdin = strings.NewReader(chezmoitest.JoinLines( - databasePassword, - )) - attachmentImportCmd.Stdout = os.Stdout - attachmentImportCmd.Stderr = os.Stderr - assert.NoError(t, attachmentImportCmd.Run()) + setupKeepassEntry( + t, + command, + tempDir, + keepassEntry{ + database, + databasePassword, + groupName, + entryName, + entryUsername, + entryPassword, + attachmentName, + attachmentData, + }, + ) + setupKeepassEntry( + t, + command, + tempDir, + keepassEntry{ + database, + databasePassword, + nestedGroupName, + nestedEntryName, + nestedEntryUsername, + nestedEntryPassword, + nestedAttachmentName, + nestedAttachmentData, + }, + ) for _, mode := range []keepassxcMode{ keepassxcModeCachePassword, @@ -130,6 +138,14 @@ func TestKeepassxcTemplateFuncs(t *testing.T) { assert.Equal(t, entryPassword, config.keepassxcTemplateFunc(entryName)["Password"]) assert.Equal(t, entryUsername, config.keepassxcAttributeTemplateFunc(entryName, "UserName")) assert.Equal(t, attachmentData, config.keepassxcAttachmentTemplateFunc(entryName, attachmentName)) + + assert.Equal(t, nestedEntryPassword, config.keepassxcTemplateFunc(nestedEntryName)["Password"]) + assert.Equal(t, nestedEntryUsername, config.keepassxcAttributeTemplateFunc(nestedEntryName, "UserName")) + assert.Equal( + t, + nestedAttachmentData, + config.keepassxcAttachmentTemplateFunc(nestedEntryName, nestedAttachmentName), + ) }) t.Run("incorrect_password", func(t *testing.T) { @@ -170,3 +186,62 @@ func TestKeepassxcTemplateFuncs(t *testing.T) { }) } } + +func setupKeepassEntry(t *testing.T, command, tempDir string, kpe keepassEntry) { + t.Helper() + // Create nested groups in the database. + groupPath := strings.Split(kpe.groupName, "/") + for i := range groupPath { + var name string + if i == 0 { + name = groupPath[i] + } else { + name = strings.Join(groupPath[0:i+1], "/") + } + mkdirCmd := exec.Command(command, "mkdir", kpe.database, name) + mkdirCmd.Stdin = strings.NewReader(chezmoitest.JoinLines( + kpe.databasePassword, + )) + mkdirCmd.Stdout = os.Stdout + mkdirCmd.Stderr = os.Stderr + assert.NoError(t, mkdirCmd.Run()) + } + // Create an entry in the database. + addCmd := exec.Command(command, "add", kpe.database, kpe.entryName, "--username", kpe.entryUsername, "--password-prompt") + addCmd.Stdin = strings.NewReader(chezmoitest.JoinLines( + kpe.databasePassword, + kpe.entryPassword, + )) + addCmd.Stdout = os.Stdout + addCmd.Stderr = os.Stderr + assert.NoError(t, addCmd.Run()) + + // Import an attachment to the entry in the database. + importFile := filepath.Join(tempDir, "import file") + assert.NoError(t, os.WriteFile(importFile, []byte(kpe.attachmentData), 0o666)) + attachmentImportCmd := exec.Command( + command, + "attachment-import", + kpe.database, + kpe.entryName, + kpe.attachmentName, + importFile, + ) + attachmentImportCmd.Stdin = strings.NewReader(chezmoitest.JoinLines( + kpe.databasePassword, + )) + attachmentImportCmd.Stdout = os.Stdout + attachmentImportCmd.Stderr = os.Stderr + assert.NoError(t, attachmentImportCmd.Run()) +} + +type keepassEntry struct { + database string + databasePassword string + groupName string + entryName string + entryUsername string + entryPassword string + attachmentName string + attachmentData string +}
fix
Correct nested groups for keepassxc builtin mode
cd1d003c1de2adc218175dbc9230309cd1a70446
2022-01-29 23:06:47
Tom Payne
chore: Tidy up init template functions
false
diff --git a/pkg/cmd/inittemplatefuncs.go b/pkg/cmd/inittemplatefuncs.go index a9c7df927d8..7193c99b94a 100644 --- a/pkg/cmd/inittemplatefuncs.go +++ b/pkg/cmd/inittemplatefuncs.go @@ -112,6 +112,7 @@ func (c *Config) writeToStdout(args ...string) string { for _, arg := range args { if _, err := c.stdout.Write([]byte(arg)); err != nil { returnTemplateError(err) + return "" } } return ""
chore
Tidy up init template functions
cb02477fd5286e464fcc890dfd5a59f12beac2f2
2022-03-13 00:14:56
Tom Payne
docs: Improve docs on empty files in chezmoi edit
false
diff --git a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md index f91a975de8f..e2d14d04587 100644 --- a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md +++ b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md @@ -42,19 +42,56 @@ control characters. Alternatively, you can use the `--color=false` option to chezmoi to disable colors or the `--no-pager` option to chezmoi to disable the pager. -## Why do I get a blank buffer when running `chezmoi edit`? - -What's happening here is that your editor is forking, detaching, and terminating -the original process, which chezmoi cannot distinguish from the editor -terminating normally. - -You have two options: -1. Configure your editor command to remain in the foreground. For `vim`, this - means passing the `-f` flag, e.g. by setting the `edit.flags` configuration - variable to `["-f"]`, or by setting the `EDITOR` environment variable to - include the `-f` flag, e.g. `export EDITOR="mvim -f"`. For VSCode, pass the - `--wait` flag. -2. Set the `edit.hardlink` configuration variable to `false`. +## Why do I get a blank buffer or empty file when running `chezmoi edit`? + +In this case, `chezmoi edit` typically prints a warning like: + +``` +chezmoi: warning: $EDITOR $TMPDIR/$FILENAME: returned in less than 1s +``` + +`chezmoi edit` performs a bit of magic to improve the experience of editing +files in the source state by invoking your editor with filenames in a temporary +directory that look like filenames in your home directory. What's happening +here is that your editor command is exiting immediately, so chezmoi thinks +you've finished editing and so removes the temporary directory, but actually +your editor command has forked a edit process in the background, and that edit +process opens a now non-existent file. + +To fix this you have to configure your editor command to remain in the +foreground until you have finished editing the file, so chezmoi knows when to +remove the temporary directory. + +=== "VIM" + + Pass the `-f` flag, e.g. by setting the `edit.flags` configuration variable + to `["-f"]`, or by setting the `EDITOR` environment variable to include the + `-f` flag, e.g. `export EDITOR="vim -f"`. + +=== "VSCode" + + Pass the `--wait` flag, e.g. by setting the `edit.flags` configuration + variable to `["--wait"]` or by setting the `EDITOR` environment variable to + include the `--wait` flag, e.g. `export EDITOR="code --wait"`. + +The "bit of magic" that `chezmoi edit` performs includes: + +* `chezmoi edit` makes the filename opened by your editor more closely match + the target filename, which can help your editor choose the correct syntax + highlighting. For example, if you run `chezmoi edit ~/.zshrc`, your editor is + be opened with `$TMPDIR/.zshrc` but you'll actually be editing + `~/.local/share/chezmoi/dot_zshrc` . Under the hood, chezmoi creates a + hardlink in a temporary directory to the file in your source directory, so + even though your editor thinks it's editing `.zshrc`, it is really editing + `dot_zshrc` in your source directory. + +* If the source file is encrypted then `chezmoi edit` transparently decrypts + and re-encrypts the file for you. Specifically, chezmoi decrypts the file + into a private temporary directory and open your editor with the decrypted + file, and re-encrypts the file when you exit your editor. + +* If the source file is a template, then `chezmoi edit` preserves the `.tmpl` + extension. ## chezmoi makes `~/.ssh/config` group writeable. How do I stop this?
docs
Improve docs on empty files in chezmoi edit
f54ad7db51f667786fd3e64ac04ff3b1f5aef60c
2022-03-09 01:49:54
Tom Payne
chore: Fix jsonschema warnings in .goreleaser.yaml
false
diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 6802192dade..84c78ccc2d7 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -48,7 +48,7 @@ builds: - solaris - windows goarch: - - 386 + - "386" - amd64 - arm - arm64 @@ -65,7 +65,7 @@ builds: - '-X main.builtBy=goreleaser' ignore: - goos: darwin - goarch: 386 + goarch: "386" - goos: linux goarch: amd64 @@ -190,6 +190,7 @@ snapcrafts: confinement: classic apps: chezmoi: + command: chezmoi completer: completions/chezmoi-completion.bash source:
chore
Fix jsonschema warnings in .goreleaser.yaml
f9ba484442ad5ec2cc1c14fffa5fab05779546c7
2021-11-28 22:27:41
Tom Payne
chore: Tidy up Docker tests
false
diff --git a/assets/docker/archlinux.Dockerfile b/assets/docker/archlinux.Dockerfile index 13d8db11972..ec03da08190 100644 --- a/assets/docker/archlinux.Dockerfile +++ b/assets/docker/archlinux.Dockerfile @@ -1,4 +1,5 @@ FROM archlinux:latest RUN pacman -Sy --noconfirm --noprogressbar age gcc git go unzip zip + ENTRYPOINT ( cd /chezmoi && go test ./... ) diff --git a/assets/docker/fedora.Dockerfile b/assets/docker/fedora.Dockerfile index 623c931f036..5b361a2647f 100644 --- a/assets/docker/fedora.Dockerfile +++ b/assets/docker/fedora.Dockerfile @@ -2,5 +2,5 @@ FROM fedora:latest RUN dnf update -y && \ dnf install -y bzip2 git gnupg golang -COPY assets/docker/fedora.entrypoint.sh /entrypoint.sh -ENTRYPOINT /entrypoint.sh + +ENTRYPOINT ( cd /chezmoi && go test ./... ) diff --git a/assets/docker/fedora.entrypoint.sh b/assets/docker/fedora.entrypoint.sh deleted file mode 100755 index a27de7948e0..00000000000 --- a/assets/docker/fedora.entrypoint.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -set -eufo pipefail - -( cd /chezmoi && go test ./... ) diff --git a/assets/docker/voidlinux.Dockerfile b/assets/docker/voidlinux.Dockerfile index 7948db8d884..08811e2ba60 100644 --- a/assets/docker/voidlinux.Dockerfile +++ b/assets/docker/voidlinux.Dockerfile @@ -3,4 +3,5 @@ FROM voidlinux/voidlinux:latest RUN \ xbps-install --sync --update --yes && \ xbps-install --yes age gcc git go unzip zip + ENTRYPOINT ( cd /chezmoi && go test ./... )
chore
Tidy up Docker tests
2abddec2e4c3a5080fa3f53a449c393123461f86
2022-09-15 01:10:38
Tom Payne
chore: Link to issue with sergi/go-diff
false
diff --git a/go.mod b/go.mod index c180c1da3d3..4bec22ff04a 100644 --- a/go.mod +++ b/go.mod @@ -123,4 +123,4 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect ) -exclude github.com/sergi/go-diff v1.2.0 // Produces incorrect diffs +exclude github.com/sergi/go-diff v1.2.0 // https://github.com/sergi/go-diff/issues/123
chore
Link to issue with sergi/go-diff
763d7c3b53d46cd13f54d8210f84193f6d4acebc
2022-12-07 03:05:20
Tom Payne
chore: Build with Go 1.19.4
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b2036e2343c..54a628293fd 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.3 + GO_VERSION: 1.19.4 GOFUMPT_VERSION: 0.4.0 GOLANGCI_LINT_VERSION: 1.50.1 GOVERSIONINFO_VERSION: 1.4.0
chore
Build with Go 1.19.4
5689a9f5ed31473cd69911991824b64c02760749
2022-01-31 08:28:10
Tom Payne
chore: Add tests for all packages
false
diff --git a/assets/chezmoi.io/docs/reference/commands/commands_test.go b/assets/chezmoi.io/docs/reference/commands/commands_test.go new file mode 100644 index 00000000000..812d7a2fc68 --- /dev/null +++ b/assets/chezmoi.io/docs/reference/commands/commands_test.go @@ -0,0 +1,12 @@ +package commands + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestFS(t *testing.T) { + _, err := FS.ReadFile("add.md") + require.NoError(t, err) +} diff --git a/assets/templates/templates_test.go b/assets/templates/templates_test.go new file mode 100644 index 00000000000..ed82ab0c136 --- /dev/null +++ b/assets/templates/templates_test.go @@ -0,0 +1,12 @@ +package templates + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestFS(t *testing.T) { + _, err := FS.ReadFile("COMMIT_MESSAGE.tmpl") + require.NoError(t, err) +} diff --git a/main_test.go b/main_test.go new file mode 100644 index 00000000000..0f1d1422e8b --- /dev/null +++ b/main_test.go @@ -0,0 +1,20 @@ +package main + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/twpayne/chezmoi/v2/pkg/cmd" +) + +func TestMain(t *testing.T) { + versionInfo := cmd.VersionInfo{ + Version: version, + Commit: commit, + Date: date, + BuiltBy: builtBy, + } + args := []string{"--version"} + assert.Equal(t, 0, cmd.Main(versionInfo, args)) +} diff --git a/pkg/chezmoilog/chezmoilog.go b/pkg/chezmoilog/chezmoilog.go index 3e3472ac1c3..9bb59a744d5 100644 --- a/pkg/chezmoilog/chezmoilog.go +++ b/pkg/chezmoilog/chezmoilog.go @@ -12,6 +12,8 @@ import ( "github.com/rs/zerolog/log" ) +const few = 64 + // An OSExecCmdLogObject wraps an *os/exec.Cmd and adds // github.com/rs/zerolog.LogObjectMarshaler functionality. type OSExecCmdLogObject struct { @@ -90,7 +92,6 @@ func (p OSProcessStateLogObject) MarshalZerologObject(event *zerolog.Event) { // FirstFewBytes returns the first few bytes of data in a human-readable form. func FirstFewBytes(data []byte) []byte { - const few = 64 if len(data) > few { data = append([]byte{}, data[:few]...) data = append(data, '.', '.', '.') diff --git a/pkg/chezmoilog/chezmoilog_test.go b/pkg/chezmoilog/chezmoilog_test.go new file mode 100644 index 00000000000..aedf524c9ab --- /dev/null +++ b/pkg/chezmoilog/chezmoilog_test.go @@ -0,0 +1,66 @@ +package chezmoilog + +import ( + "errors" + "strconv" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestOutput(t *testing.T) { + nonNilError := errors.New("") + for i, tc := range []struct { + data []byte + err error + expected []byte + }{ + { + data: nil, + err: nil, + expected: nil, + }, + { + data: newByteSlice(0), + err: nil, + expected: newByteSlice(0), + }, + { + data: newByteSlice(16), + err: nil, + expected: newByteSlice(16), + }, + { + data: newByteSlice(2 * few), + err: nil, + expected: append(newByteSlice(few), []byte("...")...), + }, + { + data: newByteSlice(0), + err: nonNilError, + expected: newByteSlice(0), + }, + { + data: newByteSlice(few), + err: nonNilError, + expected: newByteSlice(few), + }, + { + data: newByteSlice(2 * few), + err: nonNilError, + expected: newByteSlice(2 * few), + }, + } { + t.Run(strconv.Itoa(i), func(t *testing.T) { + assert.Equal(t, tc.expected, Output(tc.data, tc.err)) + }) + } +} + +func newByteSlice(n int) []byte { + s := make([]byte, 0, n) + for i := 0; i < n; i++ { + s = append(s, byte(i)) + } + return s +} diff --git a/pkg/chezmoitest/chezmoitest_test.go b/pkg/chezmoitest/chezmoitest_test.go new file mode 100644 index 00000000000..3cb009377c5 --- /dev/null +++ b/pkg/chezmoitest/chezmoitest_test.go @@ -0,0 +1,36 @@ +package chezmoitest + +import ( + "strconv" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestJoinLines(t *testing.T) { + for i, tc := range []struct { + lines []string + expected string + }{ + { + lines: nil, + expected: "\n", + }, + { + lines: []string{""}, + expected: "\n", + }, + { + lines: []string{"a"}, + expected: "a\n", + }, + { + lines: []string{"a", "b"}, + expected: "a\nb\n", + }, + } { + t.Run(strconv.Itoa(i), func(t *testing.T) { + assert.Equal(t, tc.expected, JoinLines(tc.lines...)) + }) + } +} diff --git a/pkg/cmds/generate-install.sh/main_test.go b/pkg/cmds/generate-install.sh/main_test.go new file mode 100644 index 00000000000..c4246da13d0 --- /dev/null +++ b/pkg/cmds/generate-install.sh/main_test.go @@ -0,0 +1,12 @@ +package main + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestGoToolDistList(t *testing.T) { + _, err := goToolDistList() + require.NoError(t, err) +} diff --git a/pkg/cmds/lint-whitespace/main.go b/pkg/cmds/lint-whitespace/main.go index 73072812e78..bce7b1d2440 100644 --- a/pkg/cmds/lint-whitespace/main.go +++ b/pkg/cmds/lint-whitespace/main.go @@ -29,18 +29,15 @@ var ( trailingWhitespaceRx = regexp.MustCompile(`\s+\z`) ) -func lintFile(filename string) error { - data, err := os.ReadFile(filename) - if err != nil { - return err - } - +func lintData(filename string, data []byte) error { if !strings.HasPrefix(http.DetectContentType(data), "text/") { return nil } lines := bytes.Split(data, []byte{'\n'}) + var err error + for i, line := range lines { switch { case crlfLineEndingRx.Match(line): @@ -57,6 +54,14 @@ func lintFile(filename string) error { return err } +func lintFile(filename string) error { + data, err := os.ReadFile(filename) + if err != nil { + return err + } + return lintData(filename, data) +} + func run() error { var lintErrs error if err := fs.WalkDir(os.DirFS("."), ".", func(path string, dirEntry fs.DirEntry, err error) error { diff --git a/pkg/cmds/lint-whitespace/main_test.go b/pkg/cmds/lint-whitespace/main_test.go new file mode 100644 index 00000000000..3a6a5e1f075 --- /dev/null +++ b/pkg/cmds/lint-whitespace/main_test.go @@ -0,0 +1,45 @@ +package main + +import ( + "strconv" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestLintData(t *testing.T) { + for i, tc := range []struct { + data []byte + expectedErrStr string + }{ + { + data: nil, + expectedErrStr: "", + }, + { + data: []byte("package main\n"), + expectedErrStr: "", + }, + { + data: []byte("package main\r\n"), + expectedErrStr: "CRLF line ending", + }, + { + data: []byte("package main \n"), + expectedErrStr: "trailing whitespace", + }, + { + data: []byte("package main"), + expectedErrStr: "no newline at end of file", + }, + } { + t.Run(strconv.Itoa(i), func(t *testing.T) { + actualErr := lintData("main.go", tc.data) + if tc.expectedErrStr == "" { + assert.NoError(t, actualErr) + } else { + assert.Contains(t, actualErr.Error(), tc.expectedErrStr) + } + }) + } +}
chore
Add tests for all packages
a450748cf0f672dd09cdf933c21de4e2049e45de
2024-01-01 17:27:19
dependabot[bot]
chore(deps-dev): bump ruff from 0.1.6 to 0.1.9 in /assets
false
diff --git a/assets/requirements.dev.txt b/assets/requirements.dev.txt index ef58a36c6ef..8eb5fe02a4d 100644 --- a/assets/requirements.dev.txt +++ b/assets/requirements.dev.txt @@ -1 +1 @@ -ruff==0.1.6 +ruff==0.1.9
chore
bump ruff from 0.1.6 to 0.1.9 in /assets
7d7fe613eab27a49f25e0ceec63c63b2895f4e72
2023-02-02 05:57:30
Tom Payne
feat: Add freebsd/riscv64 to install instructions
false
diff --git a/assets/chezmoi.io/docs/install.md.tmpl b/assets/chezmoi.io/docs/install.md.tmpl index 4a81de5b945..7e3af57e017 100644 --- a/assets/chezmoi.io/docs/install.md.tmpl +++ b/assets/chezmoi.io/docs/install.md.tmpl @@ -226,7 +226,7 @@ pre-built binary and shell completions. === "FreeBSD" -{{ range $arch := list "amd64" "arm" "arm64" "i386" }} +{{ range $arch := list "amd64" "arm" "arm64" "i386" "riscv64" }} [`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_freebsd_{{ $arch }}.tar.gz) {{- end }}
feat
Add freebsd/riscv64 to install instructions
fe3ec77b4d8650ffbdfb612ffdda1b1763781f93
2022-11-26 20:40:15
Tom Payne
docs: Add link to blog post
false
diff --git a/assets/chezmoi.io/docs/links/articles-podcasts-and-videos.md.yaml b/assets/chezmoi.io/docs/links/articles-podcasts-and-videos.md.yaml index a1d306c177d..42345920817 100644 --- a/assets/chezmoi.io/docs/links/articles-podcasts-and-videos.md.yaml +++ b/assets/chezmoi.io/docs/links/articles-podcasts-and-videos.md.yaml @@ -314,3 +314,7 @@ articles: title: 'Come installare Chezmoi: gestisci in modo sicuro i dotfile su più macchine' lang: IT url: https://grayguide.net/it/come-installare-chezmoi-gestisci-in-modo-sicuro-i-dotfile-su-piu-macchine +- date: '2022-09-28' + version: 2.24.0 + title: 'Shit Hot Dotfiles' + url: https://kolv.in/posts/dotfile-managment
docs
Add link to blog post
acb893706197f7b3a38ac2745212570c3b588f5d
2023-08-30 02:14:30
Austin Ziegler
feat: add .chezmoi.targetFile template variable
false
diff --git a/assets/chezmoi.io/docs/reference/templates/variables.md b/assets/chezmoi.io/docs/reference/templates/variables.md index 1ce069ab148..9e4159103b2 100644 --- a/assets/chezmoi.io/docs/reference/templates/variables.md +++ b/assets/chezmoi.io/docs/reference/templates/variables.md @@ -20,6 +20,7 @@ chezmoi provides the following automatically-populated variables: | `.chezmoi.osRelease` | string | The information from `/etc/os-release`, Linux only, run `chezmoi data` to see its output | | `.chezmoi.sourceDir` | string | The source directory | | `.chezmoi.sourceFile` | string | The path of the template relative to the source directory | +| `.chezmoi.targetFile` | string | The absolute path of the target file for the template | | `.chezmoi.uid` | string | The user ID | | `.chezmoi.username` | string | The username of the user running chezmoi | | `.chezmoi.version.builtBy` | string | The program that built the `chezmoi` executable, if set | diff --git a/internal/chezmoi/sourcestate.go b/internal/chezmoi/sourcestate.go index 7273ad594fb..d96297d4331 100644 --- a/internal/chezmoi/sourcestate.go +++ b/internal/chezmoi/sourcestate.go @@ -744,6 +744,7 @@ func (s *SourceState) Encryption() Encryption { // ExecuteTemplateDataOptions are options to SourceState.ExecuteTemplateData. type ExecuteTemplateDataOptions struct { Name string + Destination string Data []byte TemplateOptions TemplateOptions } @@ -769,6 +770,7 @@ func (s *SourceState) ExecuteTemplateData(options ExecuteTemplateDataOptions) ([ templateData := s.TemplateData() if chezmoiTemplateData, ok := templateData["chezmoi"].(map[string]any); ok { chezmoiTemplateData["sourceFile"] = options.Name + chezmoiTemplateData["targetFile"] = options.Destination } return tmpl.Execute(templateData) @@ -1726,8 +1728,9 @@ func (s *SourceState) newCreateTargetStateEntryFunc( } if fileAttr.Template { contents, err = s.ExecuteTemplateData(ExecuteTemplateDataOptions{ - Name: sourceRelPath.String(), - Data: contents, + Name: sourceRelPath.String(), + Data: contents, + Destination: destAbsPath.String(), }) if err != nil { return nil, err @@ -1783,8 +1786,9 @@ func (s *SourceState) newFileTargetStateEntryFunc( } if fileAttr.Template { contents, err = s.ExecuteTemplateData(ExecuteTemplateDataOptions{ - Name: sourceRelPath.String(), - Data: contents, + Name: sourceRelPath.String(), + Data: contents, + Destination: destAbsPath.String(), }) if err != nil { return nil, err @@ -1829,8 +1833,9 @@ func (s *SourceState) newModifyTargetStateEntryFunc( } if fileAttr.Template { modifierContents, err = s.ExecuteTemplateData(ExecuteTemplateDataOptions{ - Name: sourceRelPath.String(), - Data: modifierContents, + Name: sourceRelPath.String(), + Data: modifierContents, + Destination: destAbsPath.String(), }) if err != nil { return @@ -1934,8 +1939,9 @@ func (s *SourceState) newScriptTargetStateEntryFunc( } if fileAttr.Template { contents, err = s.ExecuteTemplateData(ExecuteTemplateDataOptions{ - Name: sourceRelPath.String(), - Data: contents, + Name: sourceRelPath.String(), + Data: contents, + Destination: destAbsPath.String(), }) if err != nil { return nil, err @@ -1968,8 +1974,9 @@ func (s *SourceState) newSymlinkTargetStateEntryFunc( } if fileAttr.Template { linknameBytes, err = s.ExecuteTemplateData(ExecuteTemplateDataOptions{ - Name: sourceRelPath.String(), - Data: linknameBytes, + Name: sourceRelPath.String(), + Data: linknameBytes, + Destination: destAbsPath.String(), }) if err != nil { return "", err diff --git a/internal/cmd/testdata/scripts/templatedata.txtar b/internal/cmd/testdata/scripts/templatedata.txtar index a755223d937..e76cb8522a7 100644 --- a/internal/cmd/testdata/scripts/templatedata.txtar +++ b/internal/cmd/testdata/scripts/templatedata.txtar @@ -27,6 +27,15 @@ stdout ok exec chezmoi execute-template '{{ template "template" . }}' stdout ok +[!windows] chhome home4/user + +# test that .chezmoi.sourceFile is set +[!windows] exec chezmoi cat $HOME${/}.file +[!windows] cmpenv stdout golden/dot_file + +-- golden/dot_file -- +dot_file.tmpl +$WORK/home4/user/.file -- home/user/.local/share/chezmoi/dot_file.tmpl -- {{ .chezmoi.sourceFile }} -- home2/user/.local/share/chezmoi/.chezmoidata.toml -- @@ -51,3 +60,6 @@ message: ok {{ "invalid template" -- home3/user/.local/share/chezmoi/.chezmoitemplates/template -- {{ .message }} +-- home4/user/.local/share/chezmoi/dot_file.tmpl -- +{{ .chezmoi.sourceFile }} +{{ .chezmoi.targetFile }}
feat
add .chezmoi.targetFile template variable
840d2db1bc1f17fa5b22ec6ea5de2d9dea6d041f
2025-03-17 06:46:12
Tom Payne
chore: Improve info message in install script
false
diff --git a/assets/scripts/install-local-bin.sh b/assets/scripts/install-local-bin.sh index 5bd56cb20c8..011bc0376e6 100644 --- a/assets/scripts/install-local-bin.sh +++ b/assets/scripts/install-local-bin.sh @@ -40,7 +40,7 @@ main() { TAG="$(real_tag "${TAGARG}")" VERSION="${TAG#v}" - log_info "found version ${VERSION} for ${TAGARG}/${GOOS}/${GOARCH}" + log_info "found chezmoi version ${VERSION} for ${TAGARG}/${GOOS}/${GOARCH}" BINSUFFIX= FORMAT=tar.gz diff --git a/assets/scripts/install.sh b/assets/scripts/install.sh index 7caace3ff93..0cbf88ec8f4 100644 --- a/assets/scripts/install.sh +++ b/assets/scripts/install.sh @@ -40,7 +40,7 @@ main() { TAG="$(real_tag "${TAGARG}")" VERSION="${TAG#v}" - log_info "found version ${VERSION} for ${TAGARG}/${GOOS}/${GOARCH}" + log_info "found chezmoi version ${VERSION} for ${TAGARG}/${GOOS}/${GOARCH}" BINSUFFIX= FORMAT=tar.gz diff --git a/internal/cmds/generate-install.sh/install.sh.tmpl b/internal/cmds/generate-install.sh/install.sh.tmpl index a0bed48f2a8..66c32176829 100644 --- a/internal/cmds/generate-install.sh/install.sh.tmpl +++ b/internal/cmds/generate-install.sh/install.sh.tmpl @@ -40,7 +40,7 @@ main() { TAG="$(real_tag "${TAGARG}")" VERSION="${TAG#v}" - log_info "found version ${VERSION} for ${TAGARG}/${GOOS}/${GOARCH}" + log_info "found chezmoi version ${VERSION} for ${TAGARG}/${GOOS}/${GOARCH}" BINSUFFIX= FORMAT=tar.gz
chore
Improve info message in install script
5ea07c791ee8ef48000406fdb1caf1b3a9af2c6a
2022-09-01 03:32:38
Tom Payne
chore: Rename functions for consistency
false
diff --git a/pkg/cmd/config.go b/pkg/cmd/config.go index a2fae74b4e5..1084791dcb3 100644 --- a/pkg/cmd/config.go +++ b/pkg/cmd/config.go @@ -441,8 +441,8 @@ func newConfig(options ...configOption) (*Config, error) { "keepassxc": c.keepassxcTemplateFunc, "keepassxcAttachment": c.keepassxcAttachmentTemplateFunc, "keepassxcAttribute": c.keepassxcAttributeTemplateFunc, - "keeper": c.keeperTemplateFunction, - "keeperDataFields": c.keeperDataFieldsTemplateFunction, + "keeper": c.keeperTemplateFunc, + "keeperDataFields": c.keeperDataFieldsTemplateFunc, "keeperFindPassword": c.keeperFindPasswordTemplateFunc, "keyring": c.keyringTemplateFunc, "lastpass": c.lastpassTemplateFunc, diff --git a/pkg/cmd/keepertemplatefuncs.go b/pkg/cmd/keepertemplatefuncs.go index 233ee713a2a..09ba2471746 100644 --- a/pkg/cmd/keepertemplatefuncs.go +++ b/pkg/cmd/keepertemplatefuncs.go @@ -16,7 +16,7 @@ type keeperConfig struct { outputCache map[string][]byte } -func (c *Config) keeperTemplateFunction(record string) map[string]any { +func (c *Config) keeperTemplateFunc(record string) map[string]any { output, err := c.keeperOutput([]string{"get", "--format=json", record}) if err != nil { panic(err) @@ -28,7 +28,7 @@ func (c *Config) keeperTemplateFunction(record string) map[string]any { return result } -func (c *Config) keeperDataFieldsTemplateFunction(record string) map[string]any { +func (c *Config) keeperDataFieldsTemplateFunc(record string) map[string]any { output, err := c.keeperOutput([]string{"get", "--format=json", record}) if err != nil { panic(err)
chore
Rename functions for consistency
bcc2f725a2e75546df7c39ad1c9eeb9ce165171f
2022-09-17 00:14:59
Tom Payne
chore: Move parseBool function to package
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 8f488003411..832935da41c 100644 --- a/assets/chezmoi.io/docs/reference/command-line-flags/global.md +++ b/assets/chezmoi.io/docs/reference/command-line-flags/global.md @@ -7,7 +7,7 @@ Use *directory* as the cache directory. ## `--color` *value* Colorize diffs, *value* can be `on`, `off`, `auto`, or any boolean-like value -recognized by `parseBool`. The default is `auto` which will colorize diffs only +recognized by `ParseBool`. The default is `auto` which will colorize diffs only if the the environment variable `$NO_COLOR` is not set and stdout is a terminal. ## `-c`, `--config` *filename* @@ -73,7 +73,7 @@ Use *directory* as the source directory. Use chezmoi's builtin [age encryption](https://age-encryption.org) instead of an external `age` command. *value* can be `on`, `off`, `auto`, or any -boolean-like value recognized by `parseBool`. The default is `auto` which will +boolean-like value recognized by `ParseBool`. The default is `auto` which will only use the builtin age if `age.command` cannot be found in `$PATH`. The builtin `age` command does not support passphrases, symmetric encryption, @@ -83,7 +83,7 @@ or the use of SSH keys. Use chezmoi's builtin git instead of `git.command` for the `init` and `update` commands. *value* can be `on`, `off`, `auto`, or any boolean-like value -recognized by `parseBool`. The default is `auto` which will only use the +recognized by `ParseBool`. The default is `auto` which will only use the builtin git if `git.command` cannot be found in `$PATH`. !!! info diff --git a/pkg/chezmoi/chezmoi.go b/pkg/chezmoi/chezmoi.go index 83a463841f9..e44c8ff0b65 100644 --- a/pkg/chezmoi/chezmoi.go +++ b/pkg/chezmoi/chezmoi.go @@ -12,6 +12,7 @@ import ( "path/filepath" "regexp" "runtime" + "strconv" "strings" "github.com/spf13/cobra" @@ -166,6 +167,19 @@ func FlagCompletionFunc(allCompletions []string) func(*cobra.Command, []string, } } +// ParseBool is like strconv.ParseBool but also accepts on, ON, y, Y, yes, YES, +// n, N, no, NO, off, and OFF. +func ParseBool(str string) (bool, error) { + switch strings.ToLower(strings.TrimSpace(str)) { + case "n", "no", "off": + return false, nil + case "on", "y", "yes": + return true, nil + default: + return strconv.ParseBool(str) + } +} + // SHA256Sum returns the SHA256 sum of data. func SHA256Sum(data []byte) []byte { sha256SumArr := sha256.Sum256(data) diff --git a/pkg/cmd/autobool.go b/pkg/cmd/autobool.go index 65f5bf2f1b1..eb87eadc77c 100644 --- a/pkg/cmd/autobool.go +++ b/pkg/cmd/autobool.go @@ -32,7 +32,7 @@ func (b *autoBool) Set(s string) error { } b.auto = false var err error - b.value, err = parseBool(s) + b.value, err = chezmoi.ParseBool(s) if err != nil { return err } diff --git a/pkg/cmd/executetemplatecmd.go b/pkg/cmd/executetemplatecmd.go index 85a470fb90b..1f9bef52663 100644 --- a/pkg/cmd/executetemplatecmd.go +++ b/pkg/cmd/executetemplatecmd.go @@ -52,7 +52,7 @@ func (c *Config) runExecuteTemplateCmd(cmd *cobra.Command, args []string) error promptBool := make(map[string]bool) for key, valueStr := range c.executeTemplate.promptBool { - value, err := parseBool(valueStr) + value, err := chezmoi.ParseBool(valueStr) if err != nil { return err } diff --git a/pkg/cmd/inittemplatefuncs.go b/pkg/cmd/inittemplatefuncs.go index 8aab77b8460..2f43d15106b 100644 --- a/pkg/cmd/inittemplatefuncs.go +++ b/pkg/cmd/inittemplatefuncs.go @@ -22,7 +22,7 @@ func (c *Config) promptBoolInitTemplateFunc(prompt string, args ...bool) bool { } if valueStr, ok := c.init.promptBool[prompt]; ok { - value, err := parseBool(valueStr) + value, err := chezmoi.ParseBool(valueStr) if err != nil { panic(err) } @@ -31,7 +31,7 @@ func (c *Config) promptBoolInitTemplateFunc(prompt string, args ...bool) bool { switch len(args) { case 0: - value, err := parseBool(c.promptString(prompt)) + value, err := chezmoi.ParseBool(c.promptString(prompt)) if err != nil { panic(err) } @@ -42,7 +42,7 @@ func (c *Config) promptBoolInitTemplateFunc(prompt string, args ...bool) bool { if valueStr == "" { return args[0] } - value, err := parseBool(valueStr) + value, err := chezmoi.ParseBool(valueStr) if err != nil { panic(err) } diff --git a/pkg/cmd/util.go b/pkg/cmd/util.go index 80b8ac6209a..baf1832639e 100644 --- a/pkg/cmd/util.go +++ b/pkg/cmd/util.go @@ -1,7 +1,6 @@ package cmd import ( - "strconv" "strings" "unicode" ) @@ -75,19 +74,6 @@ func isWellKnownAbbreviation(word string) bool { return ok } -// parseBool is like strconv.ParseBool but also accepts on, ON, y, Y, yes, YES, -// n, N, no, NO, off, and OFF. -func parseBool(str string) (bool, error) { - switch strings.ToLower(strings.TrimSpace(str)) { - case "n", "no", "off": - return false, nil - case "on", "y", "yes": - return true, nil - default: - return strconv.ParseBool(str) - } -} - // pluralize returns the English plural form of singular. func pluralize(singular string) string { if strings.HasSuffix(singular, "y") {
chore
Move parseBool function to package
a9d389e866c691abd7b819a0ce66a61b15c9c957
2023-12-01 22:33:09
Tom Payne
feat: Add CHEZMOI_COMMAND_DIR env var for hooks
false
diff --git a/assets/chezmoi.io/docs/reference/configuration-file/hooks.md b/assets/chezmoi.io/docs/reference/configuration-file/hooks.md index 0668f9aaf1f..57a9ee77d98 100644 --- a/assets/chezmoi.io/docs/reference/configuration-file/hooks.md +++ b/assets/chezmoi.io/docs/reference/configuration-file/hooks.md @@ -36,6 +36,7 @@ after *event* has occurred. ``` When running hooks, the `CHEZMOI=1` and `CHEZMOI_*` environment variables will -be set. `CHEZMOI_COMMAND` is set to the chezmoi command being run and +be set. `CHEZMOI_COMMAND` is set to the chezmoi command being run, +`CHEZMOI_COMMAND_DIR` is set to the directory where chezmoi was run from, and `CHEZMOI_ARGS` contains the full arguments to chezmoi, starting with the path to chezmoi's executable. diff --git a/internal/cmd/config.go b/internal/cmd/config.go index 0f87dac795c..9d0447d4a02 100644 --- a/internal/cmd/config.go +++ b/internal/cmd/config.go @@ -226,6 +226,7 @@ type Config struct { logger *zerolog.Logger // Computed configuration. + commandDirAbsPath chezmoi.AbsPath homeDirAbsPath chezmoi.AbsPath encryption chezmoi.Encryption sourceDirAbsPath chezmoi.AbsPath @@ -253,6 +254,7 @@ type templateData struct { args []string cacheDir chezmoi.AbsPath command string + commandDir chezmoi.AbsPath config map[string]any configFile chezmoi.AbsPath executable chezmoi.AbsPath @@ -482,6 +484,14 @@ func newConfig(options ...configOption) (*Config, error) { } } + wd, err := os.Getwd() + if err != nil { + return nil, err + } + c.commandDirAbsPath, err = chezmoi.NormalizePath(wd) + if err != nil { + return nil, err + } c.homeDirAbsPath, err = chezmoi.NormalizePath(c.homeDir) if err != nil { return nil, err @@ -1418,6 +1428,7 @@ func (c *Config) getTemplateDataMap(cmd *cobra.Command) map[string]any { "args": templateData.args, "cacheDir": templateData.cacheDir.String(), "command": templateData.command, + "commandDir": templateData.commandDir.String(), "config": templateData.config, "configFile": templateData.configFile.String(), "executable": templateData.executable.String(), @@ -2154,6 +2165,7 @@ func (c *Config) persistentPreRunRootE(cmd *cobra.Command, args []string) error "ARGS": strings.Join(templateData.args, " "), "CACHE_DIR": templateData.cacheDir.String(), "COMMAND": templateData.command, + "COMMAND_DIR": templateData.commandDir.String(), "CONFIG_FILE": templateData.configFile.String(), "EXECUTABLE": templateData.executable.String(), "FQDN_HOSTNAME": templateData.fqdnHostname, @@ -2325,6 +2337,7 @@ func (c *Config) newTemplateData(cmd *cobra.Command) *templateData { args: os.Args, cacheDir: c.CacheDirAbsPath, command: cmd.Name(), + commandDir: c.commandDirAbsPath, config: c.ConfigFile.toMap(), configFile: c.configFileAbsPath, executable: chezmoi.NewAbsPath(executable), @@ -2648,13 +2661,8 @@ func (c *Config) targetValidArgs( } if !filepath.IsAbs(toComplete) { - wd, err := os.Getwd() - if err != nil { - cobra.CompErrorln(err.Error()) - return nil, cobra.ShellCompDirectiveError - } for i, completion := range completions { - completions[i] = strings.TrimPrefix(completion, wd+"/") + completions[i] = strings.TrimPrefix(completion, c.commandDirAbsPath.String()+"/") } } diff --git a/internal/cmd/templatefuncs.go b/internal/cmd/templatefuncs.go index 71c155140c5..91a1713820b 100644 --- a/internal/cmd/templatefuncs.go +++ b/internal/cmd/templatefuncs.go @@ -214,13 +214,9 @@ func (c *Config) fromYamlTemplateFunc(s string) any { } func (c *Config) globTemplateFunc(pattern string) []string { - wd, err := os.Getwd() - if err != nil { - panic(err) - } defer func() { value := recover() - err := os.Chdir(wd) + err := os.Chdir(c.commandDirAbsPath.String()) if value != nil { panic(value) }
feat
Add CHEZMOI_COMMAND_DIR env var for hooks
1c0bb461908bb2e24e556dcb3fbf4c6a2c575eef
2024-02-15 07:44:24
Tom Payne
chore: Tidy up flag handling
false
diff --git a/internal/cmd/addcmd.go b/internal/cmd/addcmd.go index 03904f10d30..c9228a355f9 100644 --- a/internal/cmd/addcmd.go +++ b/internal/cmd/addcmd.go @@ -41,31 +41,21 @@ func (c *Config) newAddCmd() *cobra.Command { ), } - flags := addCmd.Flags() - flags.BoolVarP( - &c.Add.autoTemplate, - "autotemplate", - "a", - c.Add.autoTemplate, - "Generate the template when adding files as templates", - ) - 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.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.Var(&c.Add.Secrets, "secrets", "Scan for secrets when adding unencrypted files") - 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", - ) + addCmd.Flags(). + BoolVarP(&c.Add.autoTemplate, "autotemplate", "a", c.Add.autoTemplate, "Generate the template when adding files as templates") + addCmd.Flags().BoolVar(&c.Add.create, "create", c.Add.create, "Add files that should exist, irrespective of their contents") + addCmd.Flags().BoolVar(&c.Add.Encrypt, "encrypt", c.Add.Encrypt, "Encrypt files") + addCmd.Flags().BoolVar(&c.Add.exact, "exact", c.Add.exact, "Add directories exactly") + addCmd.Flags().VarP(c.Add.filter.Exclude, "exclude", "x", "Exclude entry types") + addCmd.Flags().BoolVarP(&c.Add.follow, "follow", "f", c.Add.follow, "Add symlink targets instead of symlinks") + addCmd.Flags().VarP(c.Add.filter.Include, "include", "i", "Include entry types") + addCmd.Flags().BoolVarP(&c.Add.prompt, "prompt", "p", c.Add.prompt, "Prompt before adding each entry") + addCmd.Flags().BoolVarP(&c.Add.quiet, "quiet", "q", c.Add.quiet, "Suppress warnings") + addCmd.Flags().BoolVarP(&c.Add.recursive, "recursive", "r", c.Add.recursive, "Recurse into subdirectories") + addCmd.Flags().Var(&c.Add.Secrets, "secrets", "Scan for secrets when adding unencrypted files") + addCmd.Flags().BoolVarP(&c.Add.template, "template", "T", c.Add.template, "Add files as templates") + addCmd.Flags(). + BoolVar(&c.Add.TemplateSymlinks, "template-symlinks", c.Add.TemplateSymlinks, "Add symlinks with target in source or home dirs as templates") registerExcludeIncludeFlagCompletionFuncs(addCmd) if err := addCmd.RegisterFlagCompletionFunc("secrets", severityFlagCompletionFunc); err != nil { diff --git a/internal/cmd/agecmd.go b/internal/cmd/agecmd.go index 805b82e3a78..a31831a75c4 100644 --- a/internal/cmd/agecmd.go +++ b/internal/cmd/agecmd.go @@ -36,14 +36,8 @@ func (c *Config) newAgeCmd() *cobra.Command { RunE: c.runAgeDecryptCmd, Annotations: newAnnotations(), } - ageDecryptFlags := ageDecryptCmd.Flags() - ageDecryptFlags.BoolVarP( - &c.age.decrypt.passphrase, - "passphrase", - "p", - c.age.decrypt.passphrase, - "Decrypt with a passphrase", - ) + ageDecryptCmd.Flags(). + BoolVarP(&c.age.decrypt.passphrase, "passphrase", "p", c.age.decrypt.passphrase, "Decrypt with a passphrase") ageCmd.AddCommand(ageDecryptCmd) ageEncryptCmd := &cobra.Command{ @@ -52,14 +46,8 @@ func (c *Config) newAgeCmd() *cobra.Command { RunE: c.runAgeEncryptCmd, Annotations: newAnnotations(), } - ageEncryptFlags := ageEncryptCmd.Flags() - ageEncryptFlags.BoolVarP( - &c.age.encrypt.passphrase, - "passphrase", - "p", - c.age.encrypt.passphrase, - "Encrypt with a passphrase", - ) + ageEncryptCmd.Flags(). + BoolVarP(&c.age.encrypt.passphrase, "passphrase", "p", c.age.encrypt.passphrase, "Encrypt with a passphrase") ageCmd.AddCommand(ageEncryptCmd) return ageCmd diff --git a/internal/cmd/applycmd.go b/internal/cmd/applycmd.go index f1c9b4deb80..1d0b5de9c65 100644 --- a/internal/cmd/applycmd.go +++ b/internal/cmd/applycmd.go @@ -27,11 +27,10 @@ func (c *Config) newApplyCmd() *cobra.Command { ), } - flags := applyCmd.Flags() - 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") + applyCmd.Flags().VarP(c.apply.filter.Exclude, "exclude", "x", "Exclude entry types") + applyCmd.Flags().VarP(c.apply.filter.Include, "include", "i", "Include entry types") + applyCmd.Flags().BoolVar(&c.apply.init, "init", c.apply.init, "Recreate config file from template") + applyCmd.Flags().BoolVarP(&c.apply.recursive, "recursive", "r", c.apply.recursive, "Recurse into subdirectories") registerExcludeIncludeFlagCompletionFuncs(applyCmd) diff --git a/internal/cmd/archivecmd.go b/internal/cmd/archivecmd.go index e4c5b7a9150..c872333c269 100644 --- a/internal/cmd/archivecmd.go +++ b/internal/cmd/archivecmd.go @@ -35,13 +35,12 @@ func (c *Config) newArchiveCmd() *cobra.Command { ), } - flags := archiveCmd.Flags() - flags.VarP(c.archive.filter.Exclude, "exclude", "x", "Exclude entry types") - flags.VarP(&c.archive.format, "format", "f", "Set archive format") - 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") + archiveCmd.Flags().VarP(c.archive.filter.Exclude, "exclude", "x", "Exclude entry types") + archiveCmd.Flags().VarP(&c.archive.format, "format", "f", "Set archive format") + archiveCmd.Flags().BoolVarP(&c.archive.gzip, "gzip", "z", c.archive.gzip, "Compress output with gzip") + archiveCmd.Flags().VarP(c.archive.filter.Exclude, "include", "i", "Include entry types") + archiveCmd.Flags().BoolVar(&c.archive.init, "init", c.archive.init, "Recreate config file from template") + archiveCmd.Flags().BoolVarP(&c.archive.recursive, "recursive", "r", c.archive.recursive, "Recurse into subdirectories") registerExcludeIncludeFlagCompletionFuncs(archiveCmd) diff --git a/internal/cmd/chattrcmd.go b/internal/cmd/chattrcmd.go index 9312bdfdb18..057f2d94ac9 100644 --- a/internal/cmd/chattrcmd.go +++ b/internal/cmd/chattrcmd.go @@ -88,8 +88,7 @@ func (c *Config) newChattrCmd() *cobra.Command { ), } - flags := chattrCmd.Flags() - flags.BoolVarP(&c.chattr.recursive, "recursive", "r", c.chattr.recursive, "Recurse into subdirectories") + chattrCmd.Flags().BoolVarP(&c.chattr.recursive, "recursive", "r", c.chattr.recursive, "Recurse into subdirectories") return chattrCmd } diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go index b66b403c3e9..685f98a326e 100644 --- a/internal/cmd/cmd.go +++ b/internal/cmd/cmd.go @@ -238,10 +238,10 @@ func renderLines(lines []string, termRenderer *glamour.TermRenderer) (string, er return renderedLines, nil } -// markPersistentFlagsRequired marks all of flags as required for cmd. -func markPersistentFlagsRequired(cmd *cobra.Command, flags ...string) { +// markFlagsRequired marks all of flags as required for cmd. +func markFlagsRequired(cmd *cobra.Command, flags ...string) { for _, flag := range flags { - if err := cmd.MarkPersistentFlagRequired(flag); err != nil { + if err := cmd.MarkFlagRequired(flag); err != nil { panic(err) } } diff --git a/internal/cmd/datacmd.go b/internal/cmd/datacmd.go index fb97b6020ae..7ace6cd64bd 100644 --- a/internal/cmd/datacmd.go +++ b/internal/cmd/datacmd.go @@ -17,8 +17,7 @@ func (c *Config) newDataCmd() *cobra.Command { Annotations: newAnnotations(), } - persistentFlags := dataCmd.PersistentFlags() - persistentFlags.VarP(&c.Format, "format", "f", "Output format") + dataCmd.Flags().VarP(&c.Format, "format", "f", "Output format") if err := dataCmd.RegisterFlagCompletionFunc("format", writeDataFormatFlagCompletionFunc); err != nil { panic(err) } diff --git a/internal/cmd/diffcmd.go b/internal/cmd/diffcmd.go index 8b0cf9fa084..efc951773c6 100644 --- a/internal/cmd/diffcmd.go +++ b/internal/cmd/diffcmd.go @@ -34,14 +34,13 @@ func (c *Config) newDiffCmd() *cobra.Command { ), } - flags := diffCmd.Flags() - flags.VarP(c.Diff.Exclude, "exclude", "x", "Exclude entry types") - 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.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") + diffCmd.Flags().VarP(c.Diff.Exclude, "exclude", "x", "Exclude entry types") + diffCmd.Flags().VarP(c.Diff.include, "include", "i", "Include entry types") + diffCmd.Flags().BoolVar(&c.Diff.init, "init", c.Diff.init, "Recreate config file from template") + diffCmd.Flags().StringVar(&c.Diff.Pager, "pager", c.Diff.Pager, "Set pager") + diffCmd.Flags().BoolVarP(&c.Diff.recursive, "recursive", "r", c.Diff.recursive, "Recurse into subdirectories") + diffCmd.Flags().BoolVar(&c.Diff.Reverse, "reverse", c.Diff.Reverse, "Reverse the direction of the diff") + diffCmd.Flags().BoolVar(&c.Diff.ScriptContents, "script-contents", c.Diff.ScriptContents, "Show script contents") registerExcludeIncludeFlagCompletionFuncs(diffCmd) diff --git a/internal/cmd/dumpcmd.go b/internal/cmd/dumpcmd.go index 1ea4b021171..c84b1a9b9e3 100644 --- a/internal/cmd/dumpcmd.go +++ b/internal/cmd/dumpcmd.go @@ -26,12 +26,11 @@ func (c *Config) newDumpCmd() *cobra.Command { ), } - flags := dumpCmd.Flags() - flags.VarP(c.dump.filter.Exclude, "exclude", "x", "Exclude entry types") - 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") + dumpCmd.Flags().VarP(c.dump.filter.Exclude, "exclude", "x", "Exclude entry types") + dumpCmd.Flags().VarP(&c.Format, "format", "f", "Output format") + dumpCmd.Flags().VarP(c.dump.filter.Include, "include", "i", "Include entry types") + dumpCmd.Flags().BoolVar(&c.dump.init, "init", c.dump.init, "Recreate config file from template") + dumpCmd.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/internal/cmd/dumpconfigcmd.go b/internal/cmd/dumpconfigcmd.go index 3db4f91d2d1..2198e95954b 100644 --- a/internal/cmd/dumpconfigcmd.go +++ b/internal/cmd/dumpconfigcmd.go @@ -13,8 +13,7 @@ func (c *Config) newDumpConfigCmd() *cobra.Command { Annotations: newAnnotations(), } - flags := dumpConfigCmd.Flags() - flags.VarP(&c.Format, "format", "f", "Output format") + dumpConfigCmd.Flags().VarP(&c.Format, "format", "f", "Output format") return dumpConfigCmd } diff --git a/internal/cmd/editcmd.go b/internal/cmd/editcmd.go index ad9d859ee0e..749386b7d7b 100644 --- a/internal/cmd/editcmd.go +++ b/internal/cmd/editcmd.go @@ -41,13 +41,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.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") + editCmd.Flags().BoolVarP(&c.Edit.Apply, "apply", "a", c.Edit.Apply, "Apply after editing") + editCmd.Flags().VarP(c.Edit.filter.Exclude, "exclude", "x", "Exclude entry types") + editCmd.Flags().BoolVar(&c.Edit.Hardlink, "hardlink", c.Edit.Hardlink, "Invoke editor with a hardlink to the source file") + editCmd.Flags().VarP(c.Edit.filter.Include, "include", "i", "Include entry types") + editCmd.Flags().BoolVar(&c.Edit.init, "init", c.Edit.init, "Recreate config file from template") + editCmd.Flags().BoolVar(&c.Edit.Watch, "watch", c.Edit.Watch, "Apply on save") registerExcludeIncludeFlagCompletionFuncs(editCmd) diff --git a/internal/cmd/executetemplatecmd.go b/internal/cmd/executetemplatecmd.go index 67b4c036e8c..f406ba91505 100644 --- a/internal/cmd/executetemplatecmd.go +++ b/internal/cmd/executetemplatecmd.go @@ -35,42 +35,23 @@ 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") - flags.StringToStringVar( - &c.executeTemplate.promptChoice, - "promptChoice", - c.executeTemplate.promptChoice, - "Simulate promptChoice", - ) - 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", - ) + executeTemplateCmd.Flags().BoolVarP(&c.executeTemplate.init, "init", "i", c.executeTemplate.init, "Simulate chezmoi init") + executeTemplateCmd.Flags(). + StringToStringVar(&c.executeTemplate.promptBool, "promptBool", c.executeTemplate.promptBool, "Simulate promptBool") + executeTemplateCmd.Flags(). + StringToStringVar(&c.executeTemplate.promptChoice, "promptChoice", c.executeTemplate.promptChoice, "Simulate promptChoice") + executeTemplateCmd.Flags(). + StringToIntVar(&c.executeTemplate.promptInt, "promptInt", c.executeTemplate.promptInt, "Simulate promptInt") + executeTemplateCmd.Flags(). + StringToStringVarP(&c.executeTemplate.promptString, "promptString", "p", c.executeTemplate.promptString, "Simulate promptString") + executeTemplateCmd.Flags(). + BoolVar(&c.executeTemplate.stdinIsATTY, "stdinisatty", c.executeTemplate.stdinIsATTY, "Simulate stdinIsATTY") + executeTemplateCmd.Flags(). + StringVar(&c.executeTemplate.templateOptions.LeftDelimiter, "left-delimiter", c.executeTemplate.templateOptions.LeftDelimiter, "Set left template delimiter") + executeTemplateCmd.Flags(). + StringVar(&c.executeTemplate.templateOptions.RightDelimiter, "right-delimiter", c.executeTemplate.templateOptions.RightDelimiter, "Set right template delimiter") + executeTemplateCmd.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/internal/cmd/importcmd.go b/internal/cmd/importcmd.go index 32218c65ce6..f842d127f16 100644 --- a/internal/cmd/importcmd.go +++ b/internal/cmd/importcmd.go @@ -31,29 +31,14 @@ 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.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", - ) - flags.IntVar( - &c._import.stripComponents, - "strip-components", - c._import.stripComponents, - "Strip leading path components", - ) + importCmd.Flags().VarP(&c._import.destination, "destination", "d", "Set destination prefix") + importCmd.Flags().BoolVar(&c._import.exact, "exact", c._import.exact, "Set exact_ attribute on imported directories") + importCmd.Flags().VarP(c._import.filter.Exclude, "exclude", "x", "Exclude entry types") + importCmd.Flags().VarP(c._import.filter.Include, "include", "i", "Include entry types") + importCmd.Flags(). + BoolVarP(&c._import.removeDestination, "remove-destination", "r", c._import.removeDestination, "Remove destination before import") + importCmd.Flags(). + IntVar(&c._import.stripComponents, "strip-components", c._import.stripComponents, "Strip leading path components") registerExcludeIncludeFlagCompletionFuncs(importCmd) diff --git a/internal/cmd/initcmd.go b/internal/cmd/initcmd.go index f34f79fc175..7c61b0e9c28 100644 --- a/internal/cmd/initcmd.go +++ b/internal/cmd/initcmd.go @@ -101,21 +101,21 @@ func (c *Config) newInitCmd() *cobra.Command { ), } - flags := initCmd.Flags() - c.addInteractiveTemplateFuncFlags(flags) - flags.BoolVarP(&c.init.apply, "apply", "a", c.init.apply, "Update destination directory") - flags.StringVar(&c.init.branch, "branch", c.init.branch, "Set initial branch to checkout") - flags.VarP(&c.init.configPath, "config-path", "C", "Path to write generated config file") - 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.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") - flags.BoolVar(&c.init.ssh, "ssh", c.init.ssh, "Use ssh instead of https when guessing repo URL") + c.addInteractiveTemplateFuncFlags(initCmd.Flags()) + initCmd.Flags().BoolVarP(&c.init.apply, "apply", "a", c.init.apply, "Update destination directory") + initCmd.Flags().StringVar(&c.init.branch, "branch", c.init.branch, "Set initial branch to checkout") + initCmd.Flags().VarP(&c.init.configPath, "config-path", "C", "Path to write generated config file") + initCmd.Flags().BoolVar(&c.init.data, "data", c.init.data, "Include existing template data") + initCmd.Flags().IntVarP(&c.init.depth, "depth", "d", c.init.depth, "Create a shallow clone") + initCmd.Flags().VarP(c.init.filter.Exclude, "exclude", "x", "Exclude entry types") + initCmd.Flags().BoolVarP(&c.init.guessRepoURL, "guess-repo-url", "g", c.init.guessRepoURL, "Guess the repo URL") + initCmd.Flags().VarP(c.init.filter.Include, "include", "i", "Include entry types") + initCmd.Flags().BoolVar(&c.init.oneShot, "one-shot", c.init.oneShot, "Run in one-shot mode") + initCmd.Flags().BoolVarP(&c.init.purge, "purge", "p", c.init.purge, "Purge config and source directories after running") + initCmd.Flags().BoolVarP(&c.init.purgeBinary, "purge-binary", "P", c.init.purgeBinary, "Purge chezmoi binary after running") + initCmd.Flags(). + BoolVar(&c.init.recurseSubmodules, "recurse-submodules", c.init.recurseSubmodules, "Checkout submodules recursively") + initCmd.Flags().BoolVar(&c.init.ssh, "ssh", c.init.ssh, "Use ssh instead of https when guessing repo URL") return initCmd } diff --git a/internal/cmd/mackupcmd_darwin.go b/internal/cmd/mackupcmd_darwin.go index 95ef24acf23..cbb2a1f6c95 100644 --- a/internal/cmd/mackupcmd_darwin.go +++ b/internal/cmd/mackupcmd_darwin.go @@ -52,8 +52,7 @@ func (c *Config) newMackupCmd() *cobra.Command { requiresSourceDirectory, ), } - mackupAddCmdPersistentFlags := mackupAddCmd.PersistentFlags() - mackupAddCmdPersistentFlags.Var(&c.Add.Secrets, "secrets", "Scan for secrets when adding unencrypted files") + mackupAddCmd.Flags().Var(&c.Add.Secrets, "secrets", "Scan for secrets when adding unencrypted files") if err := mackupAddCmd.RegisterFlagCompletionFunc("secrets", severityFlagCompletionFunc); err != nil { panic(err) } diff --git a/internal/cmd/managedcmd.go b/internal/cmd/managedcmd.go index fae67e8f4c1..e739cc7039d 100644 --- a/internal/cmd/managedcmd.go +++ b/internal/cmd/managedcmd.go @@ -27,10 +27,9 @@ func (c *Config) newManagedCmd() *cobra.Command { Annotations: newAnnotations(), } - flags := managedCmd.Flags() - flags.VarP(c.managed.filter.Exclude, "exclude", "x", "Exclude entry types") - flags.VarP(c.managed.filter.Include, "include", "i", "Include entry types") - flags.VarP(&c.managed.pathStyle, "path-style", "p", "Path style") + managedCmd.Flags().VarP(c.managed.filter.Exclude, "exclude", "x", "Exclude entry types") + managedCmd.Flags().VarP(c.managed.filter.Include, "include", "i", "Include entry types") + managedCmd.Flags().VarP(&c.managed.pathStyle, "path-style", "p", "Path style") registerExcludeIncludeFlagCompletionFuncs(managedCmd) if err := managedCmd.RegisterFlagCompletionFunc("path-style", chezmoi.PathStyleFlagCompletionFunc); err != nil { diff --git a/internal/cmd/mergeallcmd.go b/internal/cmd/mergeallcmd.go index 91079a1b261..bc7de70c5f4 100644 --- a/internal/cmd/mergeallcmd.go +++ b/internal/cmd/mergeallcmd.go @@ -27,15 +27,8 @@ 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", - ) + mergeAllCmd.Flags().BoolVar(&c.mergeAll.init, "init", c.mergeAll.init, "Recreate config file from template") + mergeAllCmd.Flags().BoolVarP(&c.mergeAll.recursive, "recursive", "r", c.mergeAll.recursive, "Recurse into subdirectories") return mergeAllCmd } diff --git a/internal/cmd/purgecmd.go b/internal/cmd/purgecmd.go index eca2a74efc2..baaf5202d8f 100644 --- a/internal/cmd/purgecmd.go +++ b/internal/cmd/purgecmd.go @@ -31,8 +31,7 @@ func (c *Config) newPurgeCmd() *cobra.Command { ), } - flags := purgeCmd.Flags() - flags.BoolVarP(&c.purge.binary, "binary", "P", c.purge.binary, "Purge chezmoi binary") + purgeCmd.Flags().BoolVarP(&c.purge.binary, "binary", "P", c.purge.binary, "Purge chezmoi binary") return purgeCmd } diff --git a/internal/cmd/readdcmd.go b/internal/cmd/readdcmd.go index ec818f40ccf..af413c646d3 100644 --- a/internal/cmd/readdcmd.go +++ b/internal/cmd/readdcmd.go @@ -32,10 +32,9 @@ func (c *Config) newReAddCmd() *cobra.Command { ), } - flags := reAddCmd.Flags() - flags.VarP(c.reAdd.filter.Exclude, "exclude", "x", "Exclude entry types") - flags.VarP(c.reAdd.filter.Include, "include", "i", "Include entry types") - flags.BoolVarP(&c.reAdd.recursive, "recursive", "r", c.reAdd.recursive, "Recurse into subdirectories") + reAddCmd.Flags().VarP(c.reAdd.filter.Exclude, "exclude", "x", "Exclude entry types") + reAddCmd.Flags().VarP(c.reAdd.filter.Include, "include", "i", "Include entry types") + reAddCmd.Flags().BoolVarP(&c.reAdd.recursive, "recursive", "r", c.reAdd.recursive, "Recurse into subdirectories") registerExcludeIncludeFlagCompletionFuncs(reAddCmd) diff --git a/internal/cmd/removecmd.go b/internal/cmd/removecmd.go index 2f6efb8ecfe..88f2e806ae0 100644 --- a/internal/cmd/removecmd.go +++ b/internal/cmd/removecmd.go @@ -31,8 +31,7 @@ func (c *Config) newRemoveCmd() *cobra.Command { ), } - flags := removeCmd.Flags() - flags.BoolVarP(&c.remove.recursive, "recursive", "r", c.remove.recursive, "Recurse into subdirectories") + removeCmd.Flags().BoolVarP(&c.remove.recursive, "recursive", "r", c.remove.recursive, "Recurse into subdirectories") return removeCmd } diff --git a/internal/cmd/secretkeyringcmd.go b/internal/cmd/secretkeyringcmd.go index e0bc4bad023..85c4b7b88a6 100644 --- a/internal/cmd/secretkeyringcmd.go +++ b/internal/cmd/secretkeyringcmd.go @@ -30,13 +30,13 @@ type secretKeyringSetCmdConfig struct { } func (c *Config) newSecretKeyringCmd() *cobra.Command { - keyringCmd := &cobra.Command{ + secretKeyringCmd := &cobra.Command{ Use: "keyring", Args: cobra.NoArgs, Short: "Interact with keyring", } - keyringDeleteCmd := &cobra.Command{ + secretKeyringDeleteCmd := &cobra.Command{ Use: "delete", Args: cobra.NoArgs, Short: "Delete a value from keyring", @@ -45,13 +45,12 @@ func (c *Config) newSecretKeyringCmd() *cobra.Command { doesNotRequireValidConfig, ), } - secretKeyringDeletePersistentFlags := keyringDeleteCmd.PersistentFlags() - 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) + secretKeyringDeleteCmd.Flags().StringVar(&c.secret.keyring.delete.service, "service", "", "service") + secretKeyringDeleteCmd.Flags().StringVar(&c.secret.keyring.delete.user, "user", "", "user") + markFlagsRequired(secretKeyringDeleteCmd, "service", "user") + secretKeyringCmd.AddCommand(secretKeyringDeleteCmd) - keyringGetCmd := &cobra.Command{ + secretKeyringGetCmd := &cobra.Command{ Use: "get", Args: cobra.NoArgs, Short: "Get a value from keyring", @@ -60,13 +59,12 @@ func (c *Config) newSecretKeyringCmd() *cobra.Command { doesNotRequireValidConfig, ), } - secretKeyringGetPersistentFlags := keyringGetCmd.PersistentFlags() - 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) + secretKeyringGetCmd.Flags().StringVar(&c.secret.keyring.get.service, "service", "", "service") + secretKeyringGetCmd.Flags().StringVar(&c.secret.keyring.get.user, "user", "", "user") + markFlagsRequired(secretKeyringGetCmd, "service", "user") + secretKeyringCmd.AddCommand(secretKeyringGetCmd) - keyringSetCmd := &cobra.Command{ + secretKeyringSetCmd := &cobra.Command{ Use: "set", Args: cobra.NoArgs, Short: "Set a value in keyring", @@ -75,14 +73,13 @@ func (c *Config) newSecretKeyringCmd() *cobra.Command { doesNotRequireValidConfig, ), } - secretKeyringSetPersistentFlags := keyringSetCmd.PersistentFlags() - 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") - keyringCmd.AddCommand(keyringSetCmd) + secretKeyringSetCmd.Flags().StringVar(&c.secret.keyring.set.service, "service", "", "service") + secretKeyringSetCmd.Flags().StringVar(&c.secret.keyring.set.user, "user", "", "user") + secretKeyringSetCmd.Flags().StringVar(&c.secret.keyring.set.value, "value", "", "value") + markFlagsRequired(secretKeyringSetCmd, "service", "user") + secretKeyringCmd.AddCommand(secretKeyringSetCmd) - return keyringCmd + return secretKeyringCmd } func (c *Config) runSecretKeyringDeleteCmdE(cmd *cobra.Command, args []string) error { diff --git a/internal/cmd/statecmd.go b/internal/cmd/statecmd.go index 51bed90ef8a..d779996cb33 100644 --- a/internal/cmd/statecmd.go +++ b/internal/cmd/statecmd.go @@ -59,8 +59,7 @@ func (c *Config) newStateCmd() *cobra.Command { persistentStateModeReadOnly, ), } - stateDataPersistentFlags := stateDataCmd.PersistentFlags() - stateDataPersistentFlags.VarP(&c.Format, "format", "f", "Output format") + stateDataCmd.Flags().VarP(&c.Format, "format", "f", "Output format") if err := stateDataCmd.RegisterFlagCompletionFunc("format", writeDataFormatFlagCompletionFunc); err != nil { panic(err) } @@ -75,9 +74,8 @@ func (c *Config) newStateCmd() *cobra.Command { persistentStateModeReadWrite, ), } - stateDeletePersistentFlags := stateDeleteCmd.PersistentFlags() - stateDeletePersistentFlags.StringVar(&c.state.delete.bucket, "bucket", c.state.delete.bucket, "Bucket") - stateDeletePersistentFlags.StringVar(&c.state.delete.key, "key", c.state.delete.key, "Key") + stateDeleteCmd.Flags().StringVar(&c.state.delete.bucket, "bucket", c.state.delete.bucket, "Bucket") + stateDeleteCmd.Flags().StringVar(&c.state.delete.key, "key", c.state.delete.key, "Key") stateCmd.AddCommand(stateDeleteCmd) stateDeleteBucketCmd := &cobra.Command{ @@ -89,8 +87,7 @@ func (c *Config) newStateCmd() *cobra.Command { persistentStateModeReadWrite, ), } - stateDeleteBucketPersistentFlags := stateDeleteBucketCmd.PersistentFlags() - stateDeleteBucketPersistentFlags.StringVar(&c.state.deleteBucket.bucket, "bucket", c.state.deleteBucket.bucket, "Bucket") + stateDeleteBucketCmd.Flags().StringVar(&c.state.deleteBucket.bucket, "bucket", c.state.deleteBucket.bucket, "Bucket") stateCmd.AddCommand(stateDeleteBucketCmd) stateDumpCmd := &cobra.Command{ @@ -102,8 +99,7 @@ func (c *Config) newStateCmd() *cobra.Command { persistentStateModeReadOnly, ), } - stateDumpPersistentFlags := stateDumpCmd.PersistentFlags() - stateDumpPersistentFlags.VarP(&c.Format, "format", "f", "Output format") + stateDumpCmd.Flags().VarP(&c.Format, "format", "f", "Output format") if err := stateDumpCmd.RegisterFlagCompletionFunc("format", writeDataFormatFlagCompletionFunc); err != nil { panic(err) } @@ -118,9 +114,8 @@ func (c *Config) newStateCmd() *cobra.Command { persistentStateModeReadOnly, ), } - stateGetPersistentFlags := stateGetCmd.PersistentFlags() - stateGetPersistentFlags.StringVar(&c.state.get.bucket, "bucket", c.state.get.bucket, "Bucket") - stateGetPersistentFlags.StringVar(&c.state.get.key, "key", c.state.get.key, "Key") + stateGetCmd.Flags().StringVar(&c.state.get.bucket, "bucket", c.state.get.bucket, "Bucket") + stateGetCmd.Flags().StringVar(&c.state.get.key, "key", c.state.get.key, "Key") stateCmd.AddCommand(stateGetCmd) stateGetBucketCmd := &cobra.Command{ @@ -132,9 +127,8 @@ func (c *Config) newStateCmd() *cobra.Command { persistentStateModeReadOnly, ), } - stateGetBucketPersistentFlags := stateGetBucketCmd.PersistentFlags() - stateGetBucketPersistentFlags.StringVar(&c.state.getBucket.bucket, "bucket", c.state.getBucket.bucket, "bucket") - stateGetBucketPersistentFlags.VarP(&c.Format, "format", "f", "Output format") + stateGetBucketCmd.Flags().StringVar(&c.state.getBucket.bucket, "bucket", c.state.getBucket.bucket, "bucket") + stateGetBucketCmd.Flags().VarP(&c.Format, "format", "f", "Output format") if err := stateGetBucketCmd.RegisterFlagCompletionFunc("format", writeDataFormatFlagCompletionFunc); err != nil { panic(err) } @@ -160,10 +154,9 @@ func (c *Config) newStateCmd() *cobra.Command { persistentStateModeReadWrite, ), } - stateSetPersistentFlags := stateSetCmd.PersistentFlags() - stateSetPersistentFlags.StringVar(&c.state.set.bucket, "bucket", c.state.set.bucket, "Bucket") - stateSetPersistentFlags.StringVar(&c.state.set.key, "key", c.state.set.key, "Key") - stateSetPersistentFlags.StringVar(&c.state.set.value, "value", c.state.set.value, "Value") + stateSetCmd.Flags().StringVar(&c.state.set.bucket, "bucket", c.state.set.bucket, "Bucket") + stateSetCmd.Flags().StringVar(&c.state.set.key, "key", c.state.set.key, "Key") + stateSetCmd.Flags().StringVar(&c.state.set.value, "value", c.state.set.value, "Value") stateCmd.AddCommand(stateSetCmd) return stateCmd diff --git a/internal/cmd/statuscmd.go b/internal/cmd/statuscmd.go index 67d993413e4..f3c05ceb095 100644 --- a/internal/cmd/statuscmd.go +++ b/internal/cmd/statuscmd.go @@ -36,18 +36,11 @@ func (c *Config) newStatusCmd() *cobra.Command { ), } - flags := statusCmd.Flags() - flags.VarP(c.Status.Exclude, "exclude", "x", "Exclude entry types") - flags.VarP(c.Status.PathStyle, "path-style", "p", "Path style") - 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", - ) + statusCmd.Flags().VarP(c.Status.Exclude, "exclude", "x", "Exclude entry types") + statusCmd.Flags().VarP(c.Status.PathStyle, "path-style", "p", "Path style") + statusCmd.Flags().VarP(c.Status.include, "include", "i", "Include entry types") + statusCmd.Flags().BoolVar(&c.Status.init, "init", c.Status.init, "Recreate config file from template") + statusCmd.Flags().BoolVarP(&c.Status.recursive, "recursive", "r", c.Status.recursive, "Recurse into subdirectories") registerExcludeIncludeFlagCompletionFuncs(statusCmd) diff --git a/internal/cmd/unmanagedcmd.go b/internal/cmd/unmanagedcmd.go index e5fb75e4893..9c678465c72 100644 --- a/internal/cmd/unmanagedcmd.go +++ b/internal/cmd/unmanagedcmd.go @@ -27,8 +27,7 @@ func (c *Config) newUnmanagedCmd() *cobra.Command { Annotations: newAnnotations(), } - flags := unmanagedCmd.Flags() - flags.VarP(&c.unmanaged.pathStyle, "path-style", "p", "Path style") + unmanagedCmd.Flags().VarP(&c.unmanaged.pathStyle, "path-style", "p", "Path style") if err := unmanagedCmd.RegisterFlagCompletionFunc("path-style", chezmoi.PathStyleFlagCompletionFunc); err != nil { panic(err) diff --git a/internal/cmd/updatecmd.go b/internal/cmd/updatecmd.go index 798fb6dc3fb..ddb3079945c 100644 --- a/internal/cmd/updatecmd.go +++ b/internal/cmd/updatecmd.go @@ -36,18 +36,13 @@ func (c *Config) newUpdateCmd() *cobra.Command { ), } - flags := updateCmd.Flags() - flags.BoolVarP(&c.Update.Apply, "apply", "a", c.Update.Apply, "Apply after pulling") - 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", - ) - flags.BoolVarP(&c.Update.recursive, "recursive", "r", c.Update.recursive, "Recurse into subdirectories") + updateCmd.Flags().BoolVarP(&c.Update.Apply, "apply", "a", c.Update.Apply, "Apply after pulling") + updateCmd.Flags().VarP(c.Update.filter.Exclude, "exclude", "x", "Exclude entry types") + updateCmd.Flags().VarP(c.Update.filter.Include, "include", "i", "Include entry types") + updateCmd.Flags().BoolVar(&c.Update.init, "init", c.Update.init, "Recreate config file from template") + updateCmd.Flags(). + BoolVar(&c.Update.RecurseSubmodules, "recurse-submodules", c.Update.RecurseSubmodules, "Recursively update submodules") + updateCmd.Flags().BoolVarP(&c.Update.recursive, "recursive", "r", c.Update.recursive, "Recurse into subdirectories") registerExcludeIncludeFlagCompletionFuncs(updateCmd) diff --git a/internal/cmd/upgradecmd.go b/internal/cmd/upgradecmd.go index 9e3f4a93e48..c835dd26581 100644 --- a/internal/cmd/upgradecmd.go +++ b/internal/cmd/upgradecmd.go @@ -62,11 +62,10 @@ 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.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") + 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 } diff --git a/internal/cmd/verifycmd.go b/internal/cmd/verifycmd.go index 2fc1407725e..68037a24355 100644 --- a/internal/cmd/verifycmd.go +++ b/internal/cmd/verifycmd.go @@ -27,11 +27,10 @@ func (c *Config) newVerifyCmd() *cobra.Command { ), } - flags := verifyCmd.Flags() - 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") + verifyCmd.Flags().VarP(c.Verify.Exclude, "exclude", "x", "Exclude entry types") + verifyCmd.Flags().VarP(c.Verify.include, "include", "i", "Include entry types") + verifyCmd.Flags().BoolVar(&c.Verify.init, "init", c.Verify.init, "Recreate config file from template") + verifyCmd.Flags().BoolVarP(&c.Verify.recursive, "recursive", "r", c.Verify.recursive, "Recurse into subdirectories") registerExcludeIncludeFlagCompletionFuncs(verifyCmd)
chore
Tidy up flag handling
9c8305b85576e8ef81bc9ac54d3da8b9b4e90cee
2022-09-01 18:19:27
Tom Payne
chore: Update dependencies
false
diff --git a/go.mod b/go.mod index bb094a51ca4..715fd09da83 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.2 - github.com/aws/aws-sdk-go-v2 v1.16.11 - github.com/aws/aws-sdk-go-v2/config v1.17.1 - github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.18 + github.com/aws/aws-sdk-go-v2 v1.16.13 + github.com/aws/aws-sdk-go-v2/config v1.17.4 + github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.21 github.com/bmatcuk/doublestar/v4 v4.2.0 github.com/bradenhilton/mozillainstallhash v1.0.0 github.com/charmbracelet/glamour v0.5.0 @@ -39,7 +39,7 @@ require ( golang.org/x/exp v0.0.0-20220827204233-334a2380cb91 golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094 golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde - golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 + golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 gopkg.in/ini.v1 v1.67.0 gopkg.in/yaml.v3 v3.0.1 @@ -55,15 +55,16 @@ require ( github.com/acomagu/bufpipe v1.0.3 // indirect github.com/alecthomas/chroma v0.10.0 // indirect github.com/alessio/shellescape v1.4.1 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.12.14 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.11.17 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.16.13 // indirect - github.com/aws/smithy-go v1.12.1 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.12.17 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.14 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.20 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.14 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.3.21 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.14 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.11.20 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.16.16 // indirect + github.com/aws/smithy-go v1.13.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/bradenhilton/cityhash v1.0.0 // indirect github.com/cloudflare/circl v1.2.0 // indirect @@ -113,7 +114,7 @@ require ( github.com/yuin/goldmark v1.4.13 // indirect github.com/yuin/goldmark-emoji v1.0.1 // indirect go.uber.org/atomic v1.10.0 // indirect - golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d // indirect + golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b // indirect golang.org/x/text v0.3.7 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index abd8d881ea8..4ae6169155a 100644 --- a/go.sum +++ b/go.sum @@ -75,30 +75,32 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYU github.com/armon/go-metrics v0.3.10 h1:FR+drcQStOe+32sYyJYyZ7FIdgoGGBnwLl+flodp8Uo= 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/aws/aws-sdk-go-v2 v1.16.11 h1:xM1ZPSvty3xVmdxiGr7ay/wlqv+MWhH0rMlyLdbC0YQ= -github.com/aws/aws-sdk-go-v2 v1.16.11/go.mod h1:WTACcleLz6VZTp7fak4EO5b9Q4foxbn+8PIz3PmyKlo= -github.com/aws/aws-sdk-go-v2/config v1.17.1 h1:BWxTjokU/69BZ4DnLrZco6OvBDii6ToEdfBL/y5I1nA= -github.com/aws/aws-sdk-go-v2/config v1.17.1/go.mod h1:uOxDHjBemNTF2Zos+fgG0NNfE86wn1OAHDTGxjMEYi0= -github.com/aws/aws-sdk-go-v2/credentials v1.12.14 h1:AtVG/amkjbDBfnPr/tuW2IG18HGNznP6L12Dx0rLz+Q= -github.com/aws/aws-sdk-go-v2/credentials v1.12.14/go.mod h1:opAndTyq+YN7IpVG57z2CeNuXSQMqTYxGGlYH0m0RMY= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12 h1:wgJBHO58Pc1V1QAnzdVM3JK3WbE/6eUF0JxCZ+/izz0= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12/go.mod h1:aZ4vZnyUuxedC7eD4JyEHpGnCz+O2sHQEx3VvAwklSE= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18 h1:OmiwoVyLKEqqD5GvB683dbSqxiOfvx4U2lDZhG2Esc4= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18/go.mod h1:348MLhzV1GSlZSMusdwQpXKbhD7X2gbI/TxwAPKkYZQ= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12 h1:5mvQDtNWtI6H56+E4LUnLWEmATMB7oEh+Z9RurtIuC0= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12/go.mod h1:ckaCVTEdGAxO6KwTGzgskxR1xM+iJW4lxMyDFVda2Fc= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19 h1:g5qq9sgtEzt2szMaDqQO6fqKe026T6dHTFJp5NsPzkQ= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19/go.mod h1:cVHo8KTuHjShb9V8/VjH3S/8+xPu16qx8fdGwmotJhE= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12 h1:7iPTTX4SAI2U2VOogD7/gmHlsgnYSgoNHt7MSQXtG2M= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12/go.mod h1:1TODGhheLWjpQWSuhYuAUWYTCKwEjx2iblIFKDHjeTc= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.18 h1:OEPeoMWuUp1SvUvrLMh8B7SJPRz6M1hP/AV4pmXybx4= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.18/go.mod h1:HvF8QZUW+evBsd/SJn4VA0WWW5qVMKxPpWiRRK4w3eM= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.17 h1:pXxu9u2z1UqSbjO9YA8kmFJBhFc1EVTDaf7A+S+Ivq8= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.17/go.mod h1:mS5xqLZc/6kc06IpXn5vRxdLaED+jEuaSRv5BxtnsiY= -github.com/aws/aws-sdk-go-v2/service/sts v1.16.13 h1:dl8T0PJlN92rvEGOEUiD0+YPYdPEaCZK0TqHukvSfII= -github.com/aws/aws-sdk-go-v2/service/sts v1.16.13/go.mod h1:Ru3QVMLygVs/07UQ3YDur1AQZZp2tUNje8wfloFttC0= -github.com/aws/smithy-go v1.12.1 h1:yQRC55aXN/y1W10HgwHle01DRuV9Dpf31iGkotjt3Ag= -github.com/aws/smithy-go v1.12.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/aws-sdk-go-v2 v1.16.13 h1:HgF7OX2q0gSZtcXoo9DMEA8A2Qk/GCxmWyM0RI7Yz2Y= +github.com/aws/aws-sdk-go-v2 v1.16.13/go.mod h1:xSyvSnzh0KLs5H4HJGeIEsNYemUWdNIl0b/rP6SIsLU= +github.com/aws/aws-sdk-go-v2/config v1.17.4 h1:9HY1wbShqObySCHP2Z07blfrSWVX+nVxCZmUuLZKcG8= +github.com/aws/aws-sdk-go-v2/config v1.17.4/go.mod h1:ul+ru+huVpfduF9XRmGUq82T8T3K+nIFQuF6F+L+548= +github.com/aws/aws-sdk-go-v2/credentials v1.12.17 h1:htUjIJOQcvIUR0jC4eLkdis1DfaLL4EUbIKUFqh2WFA= +github.com/aws/aws-sdk-go-v2/credentials v1.12.17/go.mod h1:jd1mvJulXY7ccHvcSiJceYhv06yWIIRkJnwWEA4IX+g= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.14 h1:NZwZFtxXGOEIiCd8jWN55lexakug543CaO68bTpoLwg= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.14/go.mod h1:5CU57SyF5jZLSIw4OOll0PG83ThXwNdkRFOc0EltD/0= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.20 h1:Rk8eqZSdFovt8Id+O+i2qT0c3CY13DPn2SfGOEVlxNs= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.20/go.mod h1:gdZ5gRUaxThXIZyZQ8MTtgYBk2jbHgp05BO3GcD9Cwc= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.14 h1:6Yxuq9yrkoLYab5JXqJnto9tdRuIcYVdR+eiKjsJYWU= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.14/go.mod h1:GEV9jaDPIgayiU+uevxwozcvUOjc+P4aHE2BeSjm2vE= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.21 h1:lpwSbLKYTuABo6SyUoC25xAmfO3/TehGS2SmD1EtOL0= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.21/go.mod h1:Q0pktZjvRZk77TBto6yAvUAi7fcse1bdcMctBDVGgBw= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.14 h1:c5hJNN2DkK1gAytcKp7LkiKNDJeevFSboPezEHAM4Ro= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.14/go.mod h1:8qOLjqMzY/S1kh3myDXA1yxK5eD4uN8aOJgKpgvc4OM= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.21 h1:/IRc1VVBx9/04hwGTQW+ud28AKBmcAaIMWAb0uEDt+k= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.21/go.mod h1:6JkZkiwXG3TLJh9O+WysncUbD1hTrsKiSTO1kbYM/MQ= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.20 h1:3raP0UC9rvRyY4/cc4o4F3jTrNo94AYiarNUGNnq6dU= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.20/go.mod h1:hPsROgDdgY/NQ1gPt7VJWG0GjSnalDC0DkkMfGEw2gc= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.2 h1:/SYpdjjAtraymql+/r719OgjxezdanAQiLb/NMxDb04= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.2/go.mod h1:5cxfDYtY2mDOlmesy4yycb6lwyy1U/iAUOHKhQLKw/E= +github.com/aws/aws-sdk-go-v2/service/sts v1.16.16 h1:otZvq9r+xjPL7qU/luX2QdBamiN+oSZURRi4sAKymO8= +github.com/aws/aws-sdk-go-v2/service/sts v1.16.16/go.mod h1:Y9iBgT1w2vHtYzJEkwD6FqILjDSsvbxcW/+wIYxyse4= +github.com/aws/smithy-go v1.13.1 h1:q09BdpUiaqpothcv393ACfWJJHzlzjB5HaNL1XHKmoQ= +github.com/aws/smithy-go v1.13.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/bradenhilton/cityhash v1.0.0 h1:1QauDCwfxwIGwO2jBTJdEBqXgfCusAgQOSgdl4RsTMI= @@ -513,8 +515,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d h1:3qF+Z8Hkrw9sOhrFHti9TlB1Hkac1x+DNRkv0XQiFjo= -golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM= +golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/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= @@ -669,8 +671,8 @@ golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 h1:UiNENfZ8gDvpiWw7IpOMQ27spWmThO1RwwdQVbJahJM= -golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 h1:v6hYoSR9T5oet+pMXwUWkbiVqx/63mlHjefrHmxwfeY= +golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/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-20220722155259-a9ba230a4035 h1:Q5284mrmYTpACcm+eAKjKJH48BBwSyfJqmmGDTtT8Vc= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
chore
Update dependencies
7a349503bd27da16220a46bdd24624d354038a77
2025-01-10 16:59:40
Tom Payne
chore: Increase test sharding
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c51e9ac39f..682df232e91 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -131,7 +131,7 @@ jobs: strategy: fail-fast: false matrix: - test-index: [0, 1, 2] + test-index: [0, 1, 2, 3] needs: changes if: github.event_name == 'push' || needs.changes.outputs.code == 'true' runs-on: macos-15 @@ -169,9 +169,11 @@ jobs: go test ./... -short -race go test ./internal/cmd -run=TestScript -filter='^[0-9a-dA-D]' -race elif [ "${{ matrix.test-index }}" = "1" ]; then - go test ./internal/cmd -run=TestScript -filter='^[e-iE-I]' -race + go test ./internal/cmd -run=TestScript -filter='^[e-hE-H]' -race + elif [ "${{ matrix.test-index }}" = "2" ]; then + go test ./internal/cmd -run=TestScript -filter='^[i-qI-Q]' -race else - go test ./internal/cmd -run=TestScript -filter='^[j-zJ-Z]' -race + go test ./internal/cmd -run=TestScript -filter='^[r-zR-Z]' -race fi test-oldstable-go: needs: changes @@ -353,7 +355,7 @@ jobs: strategy: fail-fast: false matrix: - test-index: [0, 1, 2] + test-index: [0, 1, 2, 3] needs: changes if: github.event_name == 'push' || needs.changes.outputs.code == 'true' runs-on: windows-2022 @@ -378,9 +380,11 @@ jobs: go test ./... -short -race go test ./internal/cmd -run=TestScript -filter='^[0-9a-cA-C]' -race } elseif (${{ matrix.test-index }} -eq 1) { - go test ./internal/cmd -run=TestScript -filter='^[d-lD-L]' -race + go test ./internal/cmd -run=TestScript -filter='^[d-fD-F]' -race + } elseif (${{ matrix.test-index }} -eq 2) { + go test ./internal/cmd -run=TestScript -filter='^[g-mG-M]' -race } else { - go test ./internal/cmd -run=TestScript -filter='^[m-zM-Z]' -race + go test ./internal/cmd -run=TestScript -filter='^[n-zN-Z]' -race } check: runs-on: ubuntu-22.04
chore
Increase test sharding
6a8ca1634654734bb33a036ffb9c21e6b9f4d28d
2023-09-19 13:44:08
Braden Hilton
chore: use json.MarshalIndent in toPrettyJson
false
diff --git a/internal/cmd/templatefuncs.go b/internal/cmd/templatefuncs.go index 9537bd2e75c..ea9db44e852 100644 --- a/internal/cmd/templatefuncs.go +++ b/internal/cmd/templatefuncs.go @@ -476,13 +476,11 @@ func (c *Config) toPrettyJsonTemplateFunc(args ...any) string { //nolint:revive, default: panic(fmt.Errorf("expected 1 or 2 arguments, got %d", len(args))) } - var builder strings.Builder - encoder := json.NewEncoder(&builder) - encoder.SetIndent("", indent) - if err := encoder.Encode(value); err != nil { + prettyJSON, err := json.MarshalIndent(value, "", indent) + if err != nil { panic(err) } - return builder.String() + return string(prettyJSON) + "\n" } func (c *Config) toTomlTemplateFunc(data any) string {
chore
use json.MarshalIndent in toPrettyJson
e0c314fc30369eba2a647b9597bff6d05db2bcda
2024-10-18 03:59:17
Ruslan Sayfutdinov
docs: Split docs into sections for age, secret and state
false
diff --git a/assets/chezmoi.io/docs/reference/commands/age.md b/assets/chezmoi.io/docs/reference/commands/age.md index 5db360f9d83..820250cb567 100644 --- a/assets/chezmoi.io/docs/reference/commands/age.md +++ b/assets/chezmoi.io/docs/reference/commands/age.md @@ -2,18 +2,26 @@ Interact with age's passphrase-based encryption. -# `age encrypt` [*file*...] +## Subcommands -## `-p`, `--passphrase` +### `age encrypt` [*file*...] -Encrypt with a passphrase. +Encrypt file or standard input. -# `age decrypt` [*file*...] +#### `-p`, `--passphrase` -## `-p`, `--passphrase` +Decrypt with a passphrase. + +### `age decrypt` [*file*...] + +Decrypt file or standard input. + +#### `-p`, `--passphrase` Decrypt with a passphrase. +## Example + !!! example ```console diff --git a/assets/chezmoi.io/docs/reference/commands/secret.md b/assets/chezmoi.io/docs/reference/commands/secret.md index 3eec0c0fd24..b70e625a7e1 100644 --- a/assets/chezmoi.io/docs/reference/commands/secret.md +++ b/assets/chezmoi.io/docs/reference/commands/secret.md @@ -9,40 +9,44 @@ manager. Normally you would use chezmoi's existing template functions to retriev If you need to pass flags to the secret manager's CLI you must separate them with `--` to prevent chezmoi from interpreting them. -# `secret keyring delete` +## Subcommands -## `--service` *string* +### `secret keyring delete` + +#### `--service` *string* Name of the service. -## `--user` *string* +#### `--user` *string* Name of the user. -# `secret keyring get` +### `secret keyring get` -## `--service` *string* +#### `--service` *string* Name of the service. -## `--user` *string* +#### `--user` *string* Name of the user. -# `secret keyring set` +### `secret keyring set` -## `--service` *string* +#### `--service` *string* Name of the service. -## `--user` *string* +#### `--user` *string* Name of the user. -## `--value` *string* +#### `--value` *string* New value. +## Example + !!! example ```console @@ -51,6 +55,8 @@ New value. $ chezmoi secret keyring delete --service=service --user=user ``` +## Warning + !!! warning On FreeBSD, the `secret keyring` command is only available if chezmoi was diff --git a/assets/chezmoi.io/docs/reference/commands/state.md b/assets/chezmoi.io/docs/reference/commands/state.md index 70e3c4edf86..a74980662a6 100644 --- a/assets/chezmoi.io/docs/reference/commands/state.md +++ b/assets/chezmoi.io/docs/reference/commands/state.md @@ -10,40 +10,42 @@ Manipulate the persistent state. $ chezmoi state help ``` -# Available subcommands +## Subcommands -## `data` +### `data` Print the raw data in the persistent state. -## `delete` +### `delete` Delete a value from the persistent state. -## `delete-bucket` +### `delete-bucket` Delete a bucket from the persistent state. -## `dump` +### `dump` Generate a dump of the persistent state. -## `get` +### `get` Get a value from the persistent state. -## `get-bucket` +### `get-bucket` Get a bucket from the persistent state. -## `reset` +### `reset` Reset the persistent state. -## `set` +### `set` Set a value from the persistent state +## Example + !!! example ```console
docs
Split docs into sections for age, secret and state
cf512599d7045bcdb92a9b4c932ed757462ed5e4
2022-09-17 00:14:59
Tom Payne
feat: Use bubbletea for user input
false
diff --git a/.golangci.yml b/.golangci.yml index 389516913af..0b7d3b63e6c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -113,6 +113,8 @@ linters-settings: - anon - empty - error + - github.com/charmbracelet/bubbletea\.Model + - github.com/charmbracelet/bubbletea\.Msg - 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 diff --git a/go.mod b/go.mod index 4bec22ff04a..1603d7d59d4 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,8 @@ require ( github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.22 github.com/bmatcuk/doublestar/v4 v4.2.0 github.com/bradenhilton/mozillainstallhash v1.0.0 + github.com/charmbracelet/bubbles v0.14.0 + github.com/charmbracelet/bubbletea v0.22.1 github.com/charmbracelet/glamour v0.5.0 github.com/coreos/go-semver v0.3.0 github.com/fsnotify/fsnotify v1.5.4 @@ -56,6 +58,7 @@ require ( github.com/acomagu/bufpipe v1.0.3 // 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.12.18 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.15 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.21 // indirect @@ -68,7 +71,9 @@ require ( github.com/aws/smithy-go v1.13.2 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/bradenhilton/cityhash v1.0.0 // indirect + github.com/charmbracelet/lipgloss v0.5.0 // indirect github.com/cloudflare/circl v1.2.0 // 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 github.com/dlclark/regexp2 v1.7.0 // indirect @@ -91,11 +96,14 @@ require ( github.com/magiconair/properties v1.8.6 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.16 // indirect + github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-runewidth v0.0.13 // indirect github.com/microcosm-cc/bluemonday v1.0.20 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect + github.com/muesli/cancelreader v0.2.2 // indirect github.com/muesli/reflow v0.3.0 // indirect github.com/muesli/termenv v0.12.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect diff --git a/go.sum b/go.sum index 592d8bb65b9..0c7fbe4e2f9 100644 --- a/go.sum +++ b/go.sum @@ -75,6 +75,8 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYU github.com/armon/go-metrics v0.3.10 h1:FR+drcQStOe+32sYyJYyZ7FIdgoGGBnwLl+flodp8Uo= 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.16.14 h1:db6GvO4Z2UqHt5gvT0lr6J5x5P+oQ7bdRzczVaRekMU= github.com/aws/aws-sdk-go-v2 v1.16.14/go.mod h1:s/G+UV29dECbF5rf+RNj1xhlmvoNurGSr+McVSRj59w= github.com/aws/aws-sdk-go-v2/config v1.17.5 h1:+NS1BWvprx7nHcIk5o32LrZgifs/7Pm1V2nWjQgZ2H0= @@ -114,8 +116,17 @@ github.com/bwesterb/go-ristretto v1.2.1 h1:Xd9ZXmjKE2aY8Ub7+4bX7tXsIPsV1pIZaUlJU github.com/bwesterb/go-ristretto v1.2.1/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/census-instrumentation/opencensus-proto v0.2.1 h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/charmbracelet/bubbles v0.14.0 h1:DJfCwnARfWjZLvMglhSQzo76UZ2gucuHPy9jLWX45Og= +github.com/charmbracelet/bubbles v0.14.0/go.mod h1:bbeTiXwPww4M031aGi8UK2HT9RDWoiNibae+1yCMtcc= +github.com/charmbracelet/bubbletea v0.21.0/go.mod h1:GgmJMec61d08zXsOhqRC/AiOx4K4pmz+VIcRIm1FKr4= +github.com/charmbracelet/bubbletea v0.22.1 h1:z66q0LWdJNOWEH9zadiAIXp2GN1AWrwNXU8obVY9X24= +github.com/charmbracelet/bubbletea v0.22.1/go.mod h1:8/7hVvbPN6ZZPkczLiB8YpLkLJ0n7DMho5Wvfd2X1C0= github.com/charmbracelet/glamour v0.5.0 h1:wu15ykPdB7X6chxugG/NNfDUbyyrCLV9XBalj5wdu3g= github.com/charmbracelet/glamour v0.5.0/go.mod h1:9ZRtG19AUIzcTm7FGLGbq3D5WKQ5UyZBbQsMQN0XIqc= +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.5.0 h1:lulQHuVeodSgDez+3rGiuxlPVXSnhth442DATR2/8t8= +github.com/charmbracelet/lipgloss v0.5.0/go.mod h1:EZLha/HbzEt7cYqdFPovlqy5FZPj0xFhg5SaqxScmgs= 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= @@ -131,6 +142,8 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX 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 h1:cqQfy1jclcSy/FwLjemeg3SR1yaINm74aQyupQ0Bl8M= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +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= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534 h1:rtAn27wIbmOGUs7RIbVgPEjb31ehTVniDwPGXyMxm5U= @@ -332,6 +345,8 @@ 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= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= @@ -347,7 +362,10 @@ github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +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.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -366,11 +384,19 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b h1:1XF24mVaiu7u+CFywTdcDo2ie1pzzhwjt6RHqzpMU34= +github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b/go.mod h1:fQuZ0gauxyBcmsdE3ZT4NasjaRdxmbCS0jRHsrWu3Ho= +github.com/muesli/cancelreader v0.2.0/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= +github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= +github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/muesli/combinator v0.3.0 h1:SZDuRzzwmVPLkbOzbhGzBTwd5+Y6aFN4UusOW2azrNA= github.com/muesli/combinator v0.3.0/go.mod h1:ttPegJX0DPQaGDtJKMInIP6Vfp5pN8RX7QntFCcpy18= +github.com/muesli/reflow v0.2.1-0.20210115123740-9e1d0d53df68/go.mod h1:Xk+z4oIWdQqJzsxyjgl3P22oYZnHdZ8FFTHAQQt5BMQ= 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.9.0/go.mod h1:R/LzAKf+suGs4IsO95y7+7DpFHO0KABgnZqtlyx2mBw= +github.com/muesli/termenv v0.11.1-0.20220204035834-5ac8409525e0/go.mod h1:Bd5NYQ7pd+SrtBSrSNoBBmXlcY8+Xj4BMJgh8qcZrvs= +github.com/muesli/termenv v0.11.1-0.20220212125758-44cd13922739/go.mod h1:Bd5NYQ7pd+SrtBSrSNoBBmXlcY8+Xj4BMJgh8qcZrvs= github.com/muesli/termenv v0.12.0 h1:KuQRUE3PgxRFWhq4gHvZtPSLCGDqM5q/cYr1pZ39ytc= github.com/muesli/termenv v0.12.0/go.mod h1:WCCv32tusQ/EEZ5S8oUIIrC/nIuBcxCVqlN4Xfkv+7A= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= @@ -410,6 +436,8 @@ github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6us 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/sagikazarmark/crypt v0.6.0 h1:REOEXCs/NFY/1jOCEouMuT4zEniE5YoXbvpC5X/TLF8= +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/shirou/gopsutil/v3 v3.22.4 h1:srAQaiX6jX/cYL6q29aE0m8lOskT9CurZ9N61YR3yoI= @@ -665,6 +693,7 @@ golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBc 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-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -674,6 +703,7 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2 h1:wM1k/lXfpc5HdkJJyW9GELpd8ERGdnh8sMGL6Gzq3Ho= golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2/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-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 h1:Q5284mrmYTpACcm+eAKjKJH48BBwSyfJqmmGDTtT8Vc= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/pkg/chezmoibubbles/boolinputmodel.go b/pkg/chezmoibubbles/boolinputmodel.go new file mode 100644 index 00000000000..96a4a3eecf2 --- /dev/null +++ b/pkg/chezmoibubbles/boolinputmodel.go @@ -0,0 +1,79 @@ +package chezmoibubbles + +import ( + "strconv" + + "github.com/charmbracelet/bubbles/textinput" + tea "github.com/charmbracelet/bubbletea" + + "github.com/twpayne/chezmoi/v2/pkg/chezmoi" +) + +type BoolInputModel struct { + textInput textinput.Model + defaultValue *bool + canceled bool +} + +func NewBoolInputModel(prompt string, defaultValue *bool) BoolInputModel { + textInput := textinput.New() + textInput.Prompt = prompt + "? " + textInput.Placeholder = "bool" + if defaultValue != nil { + textInput.Placeholder += ", default " + strconv.FormatBool(*defaultValue) + } + textInput.Validate = func(value string) error { + if value == "" && defaultValue != nil { + return nil + } + _, err := chezmoi.ParseBool(value) + return err + } + textInput.Focus() + return BoolInputModel{ + textInput: textInput, + defaultValue: defaultValue, + } +} + +func (m BoolInputModel) Canceled() bool { + return m.canceled +} + +func (m BoolInputModel) Init() tea.Cmd { + return textinput.Blink +} + +func (m BoolInputModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { + if keyMsg, ok := msg.(tea.KeyMsg); ok { + switch keyMsg.Type { + case tea.KeyCtrlC, tea.KeyEsc: + m.canceled = true + return m, tea.Quit + case tea.KeyEnter: + if m.defaultValue != nil { + m.textInput.SetValue(strconv.FormatBool(*m.defaultValue)) + return m, tea.Quit + } + } + } + var cmd tea.Cmd + m.textInput, cmd = m.textInput.Update(msg) + if _, err := chezmoi.ParseBool(m.textInput.Value()); err == nil { + return m, tea.Quit + } + return m, cmd +} + +func (m BoolInputModel) Value() bool { + valueStr := m.textInput.Value() + if valueStr == "" && m.defaultValue != nil { + return *m.defaultValue + } + value, _ := chezmoi.ParseBool(valueStr) + return value +} + +func (m BoolInputModel) View() string { + return m.textInput.View() +} diff --git a/pkg/chezmoibubbles/boolinputmodel_test.go b/pkg/chezmoibubbles/boolinputmodel_test.go new file mode 100644 index 00000000000..f615b52bc9c --- /dev/null +++ b/pkg/chezmoibubbles/boolinputmodel_test.go @@ -0,0 +1,70 @@ +package chezmoibubbles + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestBoolInputModel(t *testing.T) { + for _, tc := range []struct { + name string + defaultValue *bool + input string + expectedCanceled bool + expectedValue bool + }{ + { + name: "empty_with_default", + defaultValue: newBool(true), + input: "\r", + expectedValue: true, + }, + { + name: "cancel_ctrlc", + input: "\x03", + expectedCanceled: true, + }, + { + name: "cancel_esc", + input: "\x1b", + expectedCanceled: true, + }, + { + name: "true", + input: "t", + expectedValue: true, + }, + { + name: "false", + input: "f", + expectedValue: false, + }, + { + name: "yes", + input: "y", + expectedValue: true, + }, + { + name: "no", + input: "n", + expectedValue: false, + }, + { + name: "one", + input: "1", + expectedValue: true, + }, + { + name: "zero", + input: "0", + expectedValue: false, + }, + } { + t.Run(tc.name, func(t *testing.T) { + 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 new file mode 100644 index 00000000000..b123694f057 --- /dev/null +++ b/pkg/chezmoibubbles/chezmoibubbles_test.go @@ -0,0 +1,53 @@ +package chezmoibubbles + +import ( + "testing" + + tea "github.com/charmbracelet/bubbletea" + "github.com/stretchr/testify/require" +) + +var keyTypes = map[tea.KeyType]struct{}{ + tea.KeyCtrlC: {}, + tea.KeyEnter: {}, + tea.KeyEsc: {}, +} + +//nolint:ireturn,nolintlint +func makeKeyMsg(r rune) tea.Msg { + key := tea.Key{ + Type: tea.KeyRunes, + Runes: []rune{r}, + } + if _, ok := keyTypes[tea.KeyType(r)]; ok { + key = tea.Key{ + Type: tea.KeyType(r), + } + } + return tea.KeyMsg(key) +} + +//nolint:ireturn,nolintlint +func makeKeyMsgs(s string) []tea.Msg { + msgs := make([]tea.Msg, 0, len(s)) + for _, r := range s { + msgs = append(msgs, makeKeyMsg(r)) + } + return msgs +} + +//nolint:ireturn,nolintlint +func testRunModelWithInput[M tea.Model](t *testing.T, model M, input string) M { + t.Helper() + for _, msg := range makeKeyMsgs(input) { + m, _ := model.Update(msg) + var ok bool + model, ok = m.(M) + require.True(t, ok) + } + return model +} + +func newBool(b bool) *bool { return &b } +func newInt64(i int64) *int64 { return &i } +func newString(s string) *string { return &s } diff --git a/pkg/chezmoibubbles/choiceinputmodel.go b/pkg/chezmoibubbles/choiceinputmodel.go new file mode 100644 index 00000000000..4e5cd5b078c --- /dev/null +++ b/pkg/chezmoibubbles/choiceinputmodel.go @@ -0,0 +1,94 @@ +package chezmoibubbles + +import ( + "errors" + "strings" + + "github.com/charmbracelet/bubbles/textinput" + tea "github.com/charmbracelet/bubbletea" + + "github.com/twpayne/chezmoi/v2/pkg/chezmoi" +) + +type ChoiceInputModel struct { + textInput textinput.Model + uniqueAbbreviations map[string]string + defaultValue *string + canceled bool +} + +func NewChoiceInputModel(prompt string, choices []string, defaultValue *string) ChoiceInputModel { + textInput := textinput.New() + textInput.Prompt = prompt + "? " + textInput.Placeholder = strings.Join(choices, "/") + if defaultValue != nil { + textInput.Placeholder += ", default " + *defaultValue + } + allAbbreviations := make(map[string]struct{}) + for _, choice := range choices { + for i := range choice { + allAbbreviations[choice[:i+1]] = struct{}{} + } + } + textInput.Validate = func(s string) error { + if s == "" && defaultValue != nil { + return nil + } + if _, ok := allAbbreviations[s]; ok { + return nil + } + return errors.New("unknown or ambiguous choice") + } + textInput.Focus() + return ChoiceInputModel{ + textInput: textInput, + uniqueAbbreviations: chezmoi.UniqueAbbreviations(choices), + defaultValue: defaultValue, + } +} + +func (m ChoiceInputModel) Canceled() bool { + return m.canceled +} + +func (m ChoiceInputModel) Init() tea.Cmd { + return textinput.Blink +} + +func (m ChoiceInputModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { + if keyMsg, ok := msg.(tea.KeyMsg); ok { + switch keyMsg.Type { + case tea.KeyCtrlC, tea.KeyEsc: + m.canceled = true + return m, tea.Quit + case tea.KeyEnter: + value := m.textInput.Value() + if value == "" && m.defaultValue != nil { + m.textInput.SetValue(*m.defaultValue) + return m, tea.Quit + } else if value, ok := m.uniqueAbbreviations[value]; ok { + m.textInput.SetValue(value) + return m, tea.Quit + } + } + } + + var cmd tea.Cmd + m.textInput, cmd = m.textInput.Update(msg) + if _, ok := m.uniqueAbbreviations[m.textInput.Value()]; ok { + return m, tea.Quit + } + return m, cmd +} + +func (m ChoiceInputModel) Value() string { + value := m.textInput.Value() + if value == "" && m.defaultValue != nil { + return *m.defaultValue + } + return m.uniqueAbbreviations[value] +} + +func (m ChoiceInputModel) View() string { + return m.textInput.View() +} diff --git a/pkg/chezmoibubbles/choiceinputmodel_test.go b/pkg/chezmoibubbles/choiceinputmodel_test.go new file mode 100644 index 00000000000..13404c0561d --- /dev/null +++ b/pkg/chezmoibubbles/choiceinputmodel_test.go @@ -0,0 +1,78 @@ +package chezmoibubbles + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestChoiceInputModel(t *testing.T) { + choicesYesNoAll := []string{"yes", "no", "all"} + for _, tc := range []struct { + name string + choices []string + defaultValue *string + input string + expectedCanceled bool + expectedValue string + }{ + { + name: "empty_with_default", + choices: choicesYesNoAll, + defaultValue: newString("all"), + input: "\r", + expectedValue: "all", + }, + { + name: "cancel_ctrlc", + input: "\x03", + expectedCanceled: true, + }, + { + name: "cancel_esc", + input: "\x1b", + expectedCanceled: true, + }, + { + name: "y", + choices: choicesYesNoAll, + input: "y", + expectedValue: "yes", + }, + { + name: "n", + choices: choicesYesNoAll, + input: "n", + expectedValue: "no", + }, + { + name: "a", + choices: choicesYesNoAll, + input: "a", + expectedValue: "all", + }, + { + name: "ambiguous_a", + choices: []string{"aaa", "abb", "bbb"}, + input: "a", + }, + { + name: "unambiguous_b", + choices: []string{"aaa", "abb", "bbb"}, + input: "b", + expectedValue: "bbb", + }, + { + name: "ambiguous_resolved", + choices: []string{"aaa", "abb", "bbb"}, + input: "aa", + expectedValue: "aaa", + }, + } { + t.Run(tc.name, func(t *testing.T) { + 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.go b/pkg/chezmoibubbles/intinputmodel.go new file mode 100644 index 00000000000..20bf462be86 --- /dev/null +++ b/pkg/chezmoibubbles/intinputmodel.go @@ -0,0 +1,77 @@ +package chezmoibubbles + +import ( + "strconv" + + "github.com/charmbracelet/bubbles/textinput" + tea "github.com/charmbracelet/bubbletea" +) + +type IntInputModel struct { + textInput textinput.Model + defaultValue *int64 + canceled bool +} + +func NewIntInputModel(prompt string, defaultValue *int64) IntInputModel { + textInput := textinput.New() + textInput.Prompt = prompt + "? " + textInput.Placeholder = "int" + if defaultValue != nil { + textInput.Placeholder += ", default " + strconv.FormatInt(*defaultValue, 10) + } + textInput.Validate = func(value string) error { + if value == "" && defaultValue != nil { + return nil + } + if value == "-" { + return nil + } + _, err := strconv.ParseInt(value, 10, 64) + return err + } + textInput.Focus() + return IntInputModel{ + textInput: textInput, + defaultValue: defaultValue, + } +} + +func (m IntInputModel) Canceled() bool { + return m.canceled +} + +func (m IntInputModel) Init() tea.Cmd { + return textinput.Blink +} + +func (m IntInputModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { + if keyMsg, ok := msg.(tea.KeyMsg); ok { + switch keyMsg.Type { + case tea.KeyCtrlC, tea.KeyEsc: + m.canceled = true + return m, tea.Quit + case tea.KeyEnter: + if m.textInput.Value() == "" && m.defaultValue != nil { + m.textInput.SetValue(strconv.FormatInt(*m.defaultValue, 10)) + } + return m, tea.Quit + } + } + var cmd tea.Cmd + m.textInput, cmd = m.textInput.Update(msg) + return m, cmd +} + +func (m IntInputModel) Value() int64 { + valueStr := m.textInput.Value() + if valueStr == "" && m.defaultValue != nil { + return *m.defaultValue + } + value, _ := strconv.ParseInt(valueStr, 10, 64) + return value +} + +func (m IntInputModel) View() string { + return m.textInput.View() +} diff --git a/pkg/chezmoibubbles/intinputmodel_test.go b/pkg/chezmoibubbles/intinputmodel_test.go new file mode 100644 index 00000000000..9cac20de3c2 --- /dev/null +++ b/pkg/chezmoibubbles/intinputmodel_test.go @@ -0,0 +1,60 @@ +package chezmoibubbles + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestIntInputModel(t *testing.T) { + for _, tc := range []struct { + name string + defaultValue *int64 + input string + expectedCanceled bool + expectedValue int64 + }{ + { + name: "empty_with_default", + defaultValue: newInt64(1), + input: "\r", + expectedValue: 1, + }, + { + name: "cancel_ctrlc", + input: "\x03", + expectedCanceled: true, + }, + { + name: "cancel_esc", + input: "\x1b", + expectedCanceled: true, + }, + { + name: "one_enter", + input: "1\r", + expectedValue: 1, + }, + { + name: "minus_one_enter", + input: "-1\r", + expectedValue: -1, + }, + { + name: "minus_enter", + input: "-\r", + expectedValue: 0, + }, + { + name: "one_invalid_enter", + input: "1a\r", + expectedValue: 1, + }, + } { + t.Run(tc.name, func(t *testing.T) { + 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/passwordinputmodel.go b/pkg/chezmoibubbles/passwordinputmodel.go new file mode 100644 index 00000000000..af219a1bd20 --- /dev/null +++ b/pkg/chezmoibubbles/passwordinputmodel.go @@ -0,0 +1,53 @@ +package chezmoibubbles + +import ( + "github.com/charmbracelet/bubbles/textinput" + tea "github.com/charmbracelet/bubbletea" +) + +type PasswordInputModel struct { + textInput textinput.Model + canceled bool +} + +func NewPasswordInputModel(prompt string) PasswordInputModel { + textInput := textinput.New() + textInput.Prompt = prompt + textInput.Placeholder = "password" + textInput.EchoMode = textinput.EchoNone + textInput.Focus() + return PasswordInputModel{ + textInput: textInput, + } +} + +func (m PasswordInputModel) Canceled() bool { + return m.canceled +} + +func (m PasswordInputModel) Init() tea.Cmd { + return textinput.Blink +} + +func (m PasswordInputModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { + if keyMsg, ok := msg.(tea.KeyMsg); ok { + switch keyMsg.Type { + case tea.KeyCtrlC, tea.KeyEsc: + m.canceled = true + return m, tea.Quit + case tea.KeyEnter: + return m, tea.Quit + } + } + var cmd tea.Cmd + m.textInput, cmd = m.textInput.Update(msg) + return m, cmd +} + +func (m PasswordInputModel) Value() string { + return m.textInput.Value() +} + +func (m PasswordInputModel) View() string { + return m.textInput.View() +} diff --git a/pkg/chezmoibubbles/passwordinputmodel_test.go b/pkg/chezmoibubbles/passwordinputmodel_test.go new file mode 100644 index 00000000000..61b6daf32c0 --- /dev/null +++ b/pkg/chezmoibubbles/passwordinputmodel_test.go @@ -0,0 +1,48 @@ +package chezmoibubbles + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestPasswordInputModel(t *testing.T) { + for _, tc := range []struct { + name string + input string + expectedCanceled bool + expectedValue string + }{ + { + name: "empty", + input: "\r", + }, + { + name: "cancel_ctrlc", + input: "\x03", + expectedCanceled: true, + }, + { + name: "cancel_esc", + input: "\x1b", + expectedCanceled: true, + }, + { + name: "password_enter", + input: "password\r", + expectedValue: "password", + }, + { + name: "password_ctrlc", + input: "password\x03", + expectedCanceled: true, + expectedValue: "password", + }, + } { + t.Run(tc.name, func(t *testing.T) { + actualModel := testRunModelWithInput(t, NewPasswordInputModel("prompt"), tc.input) + assert.Equal(t, tc.expectedCanceled, actualModel.Canceled()) + assert.Equal(t, tc.expectedValue, actualModel.Value()) + }) + } +} diff --git a/pkg/chezmoibubbles/stringinputmodel.go b/pkg/chezmoibubbles/stringinputmodel.go new file mode 100644 index 00000000000..3c56d77955f --- /dev/null +++ b/pkg/chezmoibubbles/stringinputmodel.go @@ -0,0 +1,61 @@ +package chezmoibubbles + +import ( + "github.com/charmbracelet/bubbles/textinput" + tea "github.com/charmbracelet/bubbletea" +) + +type StringInputModel struct { + textInput textinput.Model + defaultValue *string + canceled bool +} + +func NewStringInputModel(prompt string, defaultValue *string) StringInputModel { + textInput := textinput.New() + textInput.Prompt = prompt + "? " + textInput.Placeholder = "string" + if defaultValue != nil { + textInput.Placeholder += ", default " + *defaultValue + } + textInput.Focus() + return StringInputModel{ + textInput: textInput, + defaultValue: defaultValue, + } +} + +func (m StringInputModel) Canceled() bool { + return m.canceled +} + +func (m StringInputModel) Init() tea.Cmd { + return textinput.Blink +} + +func (m StringInputModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { + if keyMsg, ok := msg.(tea.KeyMsg); ok { + switch keyMsg.Type { + case tea.KeyCtrlC, tea.KeyEsc: + m.canceled = true + return m, tea.Quit + case tea.KeyEnter: + return m, tea.Quit + } + } + var cmd tea.Cmd + m.textInput, cmd = m.textInput.Update(msg) + return m, cmd +} + +func (m StringInputModel) Value() string { + value := m.textInput.Value() + if value == "" && m.defaultValue != nil { + return *m.defaultValue + } + return value +} + +func (m StringInputModel) View() string { + return m.textInput.View() +} diff --git a/pkg/chezmoibubbles/stringinputmodel_test.go b/pkg/chezmoibubbles/stringinputmodel_test.go new file mode 100644 index 00000000000..4da5d079a5b --- /dev/null +++ b/pkg/chezmoibubbles/stringinputmodel_test.go @@ -0,0 +1,55 @@ +package chezmoibubbles + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestStringInputModel(t *testing.T) { + for _, tc := range []struct { + name string + defaultValue *string + input string + expectedCanceled bool + expectedValue string + }{ + { + name: "empty", + input: "\r", + }, + { + name: "empty_with_default", + defaultValue: newString("default"), + input: "\r", + expectedValue: "default", + }, + { + name: "cancel_ctrlc", + input: "\x03", + expectedCanceled: true, + }, + { + name: "cancel_esc", + input: "\x1b", + expectedCanceled: true, + }, + { + name: "value_enter", + input: "value\r", + expectedValue: "value", + }, + { + name: "value_ctrlc", + input: "value\x03", + expectedCanceled: true, + expectedValue: "value", + }, + } { + t.Run(tc.name, func(t *testing.T) { + 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/cmd/config.go b/pkg/cmd/config.go index 5c9d57e12cf..c4a0de5ccca 100644 --- a/pkg/cmd/config.go +++ b/pkg/cmd/config.go @@ -1852,21 +1852,6 @@ func (c *Config) persistentStateFile() (chezmoi.AbsPath, error) { return defaultConfigFileAbsPath.Dir().Join(persistentStateFileRelPath), nil } -// 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 := chezmoi.UniqueAbbreviations(choices) - for { - line, err := c.readLine(promptWithChoices) - if err != nil { - return "", err - } - if value, ok := abbreviations[strings.TrimSpace(line)]; ok { - return value, nil - } - } -} - // readConfig reads the config file, if it exists. func (c *Config) readConfig() error { viper.SetConfigFile(c.configFileAbsPath.String()) @@ -1886,22 +1871,6 @@ func (c *Config) readConfig() error { return nil } -// readLine reads a line from stdin, trimming leading and trailing whitespace. -func (c *Config) readLine(prompt string) (string, error) { - _, err := c.stdout.Write([]byte(prompt)) - if err != nil { - return "", err - } - if c.bufioReader == nil { - c.bufioReader = bufio.NewReader(c.stdin) - } - line, err := c.bufioReader.ReadString('\n') - if err != nil { - return "", err - } - return strings.TrimSpace(line), nil -} - // run runs name with args in dir. func (c *Config) run(dir chezmoi.AbsPath, name string, args []string) error { cmd := exec.Command(name, args...) diff --git a/pkg/cmd/config_unix.go b/pkg/cmd/config_unix.go index fac6138d7d5..f28cbd8044c 100644 --- a/pkg/cmd/config_unix.go +++ b/pkg/cmd/config_unix.go @@ -3,44 +3,6 @@ package cmd -import ( - "errors" - "os" - - "go.uber.org/multierr" - "golang.org/x/term" -) - -// readPassword reads a password. -func (c *Config) readPassword(prompt string) (password string, err error) { - if c.noTTY { - password, err = c.readLine(prompt) - return - } - - if c.PINEntry.Command != "" { - return c.readPINEntry(prompt) - } - - var tty *os.File - if tty, err = os.OpenFile("/dev/tty", os.O_RDWR, 0); err != nil { - return - } - defer multierr.AppendInvoke(&err, multierr.Close(tty)) - if _, err = tty.Write([]byte(prompt)); err != nil { - return - } - var passwordBytes []byte - if passwordBytes, err = term.ReadPassword(int(tty.Fd())); err != nil && !errors.Is(err, term.ErrPasteIndicator) { - return - } - if _, err = tty.Write([]byte{'\n'}); err != nil { - return - } - password = string(passwordBytes) - return -} - func (c *Config) windowsVersion() (map[string]any, error) { return nil, nil } diff --git a/pkg/cmd/config_windows.go b/pkg/cmd/config_windows.go index 2066373abe5..7cbf28af3aa 100644 --- a/pkg/cmd/config_windows.go +++ b/pkg/cmd/config_windows.go @@ -4,49 +4,9 @@ import ( "fmt" "strings" - "go.uber.org/multierr" - "golang.org/x/sys/windows" "golang.org/x/sys/windows/registry" - "golang.org/x/term" ) -// readPassword reads a password. -func (c *Config) readPassword(prompt string) (password string, err error) { - if c.noTTY { - password, err = c.readLine(prompt) - return - } - - if c.PINEntry.Command != "" { - return c.readPINEntry(prompt) - } - - var name *uint16 - name, err = windows.UTF16PtrFromString("CONIN$") - if err != nil { - err = fmt.Errorf("windows.UTF16PtrFromString: %w", err) - return - } - var handle windows.Handle - if handle, err = windows.CreateFile(name, windows.GENERIC_READ|windows.GENERIC_WRITE, windows.FILE_SHARE_READ, nil, windows.OPEN_EXISTING, 0, 0); err != nil { - err = fmt.Errorf("windows.CreateFile: %w", err) - return - } - defer func() { - err = multierr.Append(err, windows.CloseHandle(handle)) - }() - //nolint:forbidigo - fmt.Print(prompt) - var passwordBytes []byte - if passwordBytes, err = term.ReadPassword(int(handle)); err != nil { - return - } - //nolint:forbidigo - fmt.Println("") - password = string(passwordBytes) - return -} - func (c *Config) windowsVersion() (map[string]any, error) { registryKey, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE) if err != nil { diff --git a/pkg/cmd/initcmd.go b/pkg/cmd/initcmd.go index f63a27dbe53..000f01e5edd 100644 --- a/pkg/cmd/initcmd.go +++ b/pkg/cmd/initcmd.go @@ -278,7 +278,7 @@ func (c *Config) builtinGitClone(username, url string, workingTreeRawPath chezmo return err } var basicAuth http.BasicAuth - if basicAuth.Username, err = c.readLine(fmt.Sprintf("Username [default %q]? ", username)); err != nil { + if basicAuth.Username, err = c.readString("Username? ", &username); err != nil { return err } if basicAuth.Username == "" { diff --git a/pkg/cmd/inittemplatefuncs.go b/pkg/cmd/inittemplatefuncs.go index 2f43d15106b..e5314bf97e8 100644 --- a/pkg/cmd/inittemplatefuncs.go +++ b/pkg/cmd/inittemplatefuncs.go @@ -3,8 +3,6 @@ package cmd import ( "fmt" "os" - "strconv" - "strings" "golang.org/x/term" @@ -29,27 +27,11 @@ func (c *Config) promptBoolInitTemplateFunc(prompt string, args ...bool) bool { return value } - switch len(args) { - case 0: - value, err := chezmoi.ParseBool(c.promptString(prompt)) - if err != nil { - panic(err) - } - return value - case 1: - prompt += " (default " + strconv.FormatBool(args[0]) + ")" - valueStr := c.promptString(prompt) - if valueStr == "" { - return args[0] - } - value, err := chezmoi.ParseBool(valueStr) - if err != nil { - panic(err) - } - return value - default: - panic("unreachable") + value, err := c.promptBool(prompt, args...) + if err != nil { + panic(err) } + return value } func (c *Config) promptBoolOnceInitTemplateFunc(m map[string]any, key, prompt string, args ...bool) bool { @@ -79,27 +61,11 @@ func (c *Config) promptIntInitTemplateFunc(prompt string, args ...int64) int64 { return int64(value) } - switch len(args) { - case 0: - value, err := strconv.ParseInt(c.promptString(prompt), 10, 64) - if err != nil { - panic(err) - } - return value - case 1: - promptStr := prompt + " (default " + strconv.FormatInt(args[0], 10) + ")" - valueStr := c.promptString(promptStr) - if valueStr == "" { - return args[0] - } - value, err := strconv.ParseInt(valueStr, 10, 64) - if err != nil { - panic(err) - } - return value - default: - panic("unreachable") + value, err := c.promptInt(prompt, args...) + if err != nil { + panic(err) } + return value } func (c *Config) promptIntOnceInitTemplateFunc(m map[string]any, key, prompt string, args ...int64) int64 { @@ -129,7 +95,11 @@ func (c *Config) promptStringInitTemplateFunc(prompt string, args ...string) str return value } - return c.promptString(prompt, args...) + value, err := c.promptString(prompt, args...) + if err != nil { + panic(err) + } + return value } func (c *Config) promptStringOnceInitTemplateFunc(m map[string]any, key, prompt string, args ...string) string { @@ -149,31 +119,6 @@ func (c *Config) promptStringOnceInitTemplateFunc(m map[string]any, key, prompt return c.promptStringInitTemplateFunc(prompt, args...) } -func (c *Config) promptString(prompt string, args ...string) string { - switch len(args) { - case 0: - value, err := c.readLine(prompt + "? ") - if err != nil { - panic(err) - } - return strings.TrimSpace(value) - case 1: - defaultStr := strings.TrimSpace(args[0]) - promptStr := prompt + " (default " + strconv.Quote(defaultStr) + ")? " - switch value, err := c.readLine(promptStr); { - case err != nil: - panic(err) - case value == "": - return defaultStr - default: - return strings.TrimSpace(value) - } - default: - err := fmt.Errorf("want 0 or 1 arguments, got %d", len(args)) - panic(err) - } -} - func (c *Config) stdinIsATTYInitTemplateFunc() bool { file, ok := c.stdin.(*os.File) if !ok { diff --git a/pkg/cmd/internaltestcmd.go b/pkg/cmd/internaltestcmd.go index f536c3a4a4e..ac11cb292f5 100644 --- a/pkg/cmd/internaltestcmd.go +++ b/pkg/cmd/internaltestcmd.go @@ -1,7 +1,12 @@ package cmd import ( + "strconv" + "strings" + "github.com/spf13/cobra" + + "github.com/twpayne/chezmoi/v2/pkg/chezmoi" ) func (c *Config) newInternalTestCmd() *cobra.Command { @@ -11,8 +16,41 @@ func (c *Config) newInternalTestCmd() *cobra.Command { Hidden: true, } + internalTestPromptBoolCmd := &cobra.Command{ + Use: "prompt-bool", + Args: cobra.MinimumNArgs(1), + Short: "Run promptBool", + RunE: c.runInternalTestPromptBoolCmd, + } + internalTestCmd.AddCommand(internalTestPromptBoolCmd) + + internalTestPromptChoiceCmd := &cobra.Command{ + Use: "prompt-choice", + Args: cobra.MinimumNArgs(2), + Short: "Run promptChoice", + RunE: c.runInternalTestPromptChoiceCmd, + } + internalTestCmd.AddCommand(internalTestPromptChoiceCmd) + + internalTestPromptIntCmd := &cobra.Command{ + Use: "prompt-int", + Args: cobra.MinimumNArgs(1), + Short: "Run promptInt", + RunE: c.runInternalTestPromptIntCmd, + } + internalTestCmd.AddCommand(internalTestPromptIntCmd) + + internalTestPromptStringCmd := &cobra.Command{ + Use: "prompt-string", + Args: cobra.MinimumNArgs(1), + Short: "Run promptString", + RunE: c.runInternalTestPromptStringCmd, + } + internalTestCmd.AddCommand(internalTestPromptStringCmd) + internalTestReadPasswordCmd := &cobra.Command{ Use: "read-password", + Args: cobra.NoArgs, Short: "Read a password", RunE: c.runInternalTestReadPasswordCmd, } @@ -21,6 +59,54 @@ func (c *Config) newInternalTestCmd() *cobra.Command { return internalTestCmd } +func (c *Config) runInternalTestPromptBoolCmd(cmd *cobra.Command, args []string) error { + boolArgs := make([]bool, 0, len(args)-1) + for _, arg := range args[1:] { + boolArg, err := chezmoi.ParseBool(arg) + if err != nil { + return err + } + boolArgs = append(boolArgs, boolArg) + } + value, err := c.promptBool(args[0], boolArgs...) + if err != nil { + return err + } + return c.writeOutputString(strconv.FormatBool(value) + "\n") +} + +func (c *Config) runInternalTestPromptChoiceCmd(cmd *cobra.Command, args []string) error { + value, err := c.promptChoice(args[0], strings.Split(args[1], ","), args[2:]...) + if err != nil { + return err + } + return c.writeOutputString(value + "\n") +} + +func (c *Config) runInternalTestPromptIntCmd(cmd *cobra.Command, args []string) error { + int64Args := make([]int64, 0, len(args)-1) + for _, arg := range args[1:] { + int64Arg, err := strconv.ParseInt(arg, 10, 64) + if err != nil { + return err + } + int64Args = append(int64Args, int64Arg) + } + value, err := c.promptInt(args[0], int64Args...) + if err != nil { + return err + } + return c.writeOutputString(strconv.FormatInt(value, 10) + "\n") +} + +func (c *Config) runInternalTestPromptStringCmd(cmd *cobra.Command, args []string) error { + value, err := c.promptString(args[0], args[1:]...) + if err != nil { + return err + } + return c.writeOutputString(value + "\n") +} + func (c *Config) runInternalTestReadPasswordCmd(cmd *cobra.Command, args []string) error { password, err := c.readPassword("Password? ") if err != nil { diff --git a/pkg/cmd/prompt.go b/pkg/cmd/prompt.go new file mode 100644 index 00000000000..a6450ecb9ce --- /dev/null +++ b/pkg/cmd/prompt.go @@ -0,0 +1,250 @@ +package cmd + +import ( + "bufio" + "fmt" + "strconv" + "strings" + + tea "github.com/charmbracelet/bubbletea" + "golang.org/x/exp/slices" + + "github.com/twpayne/chezmoi/v2/pkg/chezmoi" + "github.com/twpayne/chezmoi/v2/pkg/chezmoibubbles" +) + +// readBool reads a bool. +func (c *Config) readBool(prompt string, defaultValue *bool) (bool, error) { + switch { + case c.noTTY: + fullPrompt := prompt + if defaultValue != nil { + fullPrompt += " (default " + strconv.FormatBool(*defaultValue) + ")" + } + fullPrompt += "? " + for { + valueStr, err := c.readLineRaw(fullPrompt) + if err != nil { + return false, err + } + if valueStr == "" && defaultValue != nil { + return *defaultValue, nil + } + if value, err := chezmoi.ParseBool(valueStr); err == nil { + return value, nil + } + } + default: + initModel := chezmoibubbles.NewBoolInputModel(prompt, defaultValue) + finalModel, err := runCancelableModel(initModel) + if err != nil { + return false, err + } + return finalModel.Value(), nil + } +} + +// readChoice reads a choice. +func (c *Config) readChoice(prompt string, choices []string, defaultValue *string) (string, error) { + switch { + case c.noTTY: + fullPrompt := prompt + " (" + strings.Join(choices, "/") + if defaultValue != nil { + fullPrompt += ", default " + *defaultValue + } + fullPrompt += ")? " + abbreviations := chezmoi.UniqueAbbreviations(choices) + for { + value, err := c.readLineRaw(fullPrompt) + if err != nil { + return "", err + } + if value == "" && defaultValue != nil { + return *defaultValue, nil + } + if value, ok := abbreviations[value]; ok { + return value, nil + } + } + default: + initModel := chezmoibubbles.NewChoiceInputModel(prompt, choices, defaultValue) + finalModel, err := runCancelableModel(initModel) + if err != nil { + return "", err + } + return finalModel.Value(), nil + } +} + +// readInt reads an int. +func (c *Config) readInt(prompt string, defaultValue *int64) (int64, error) { + switch { + case c.noTTY: + fullPrompt := prompt + if defaultValue != nil { + fullPrompt += " (default " + strconv.FormatInt(*defaultValue, 10) + ")" + } + fullPrompt += "? " + for { + valueStr, err := c.readLineRaw(fullPrompt) + if err != nil { + return 0, err + } + if valueStr == "" && defaultValue != nil { + return *defaultValue, nil + } + if value, err := strconv.ParseInt(valueStr, 10, 64); err == nil { + return value, nil + } + } + default: + initModel := chezmoibubbles.NewIntInputModel(prompt, defaultValue) + finalModel, err := runCancelableModel(initModel) + if err != nil { + return 0, err + } + return finalModel.Value(), nil + } +} + +// readLineRaw reads a line, trimming leading and trailing whitespace. +func (c *Config) readLineRaw(prompt string) (string, error) { + _, err := c.stdout.Write([]byte(prompt)) + if err != nil { + return "", err + } + if c.bufioReader == nil { + c.bufioReader = bufio.NewReader(c.stdin) + } + line, err := c.bufioReader.ReadString('\n') + if err != nil { + return "", err + } + return strings.TrimSpace(line), nil +} + +// readPassword reads a password. +func (c *Config) readPassword(prompt string) (string, error) { + switch { + case c.noTTY: + return c.readLineRaw(prompt) + case c.PINEntry.Command != "": + return c.readPINEntry(prompt) + default: + initModel := chezmoibubbles.NewPasswordInputModel(prompt) + finalModel, err := runCancelableModel(initModel) + if err != nil { + return "", err + } + return finalModel.Value(), nil + } +} + +// readString reads a string. +func (c *Config) readString(prompt string, defaultValue *string) (string, error) { + switch { + case c.noTTY: + fullPrompt := prompt + if defaultValue != nil { + fullPrompt += " (default " + strconv.Quote(*defaultValue) + ")" + } + fullPrompt += "? " + value, err := c.readLineRaw(fullPrompt) + if err != nil { + return "", err + } + if value == "" && defaultValue != nil { + return *defaultValue, nil + } + return value, nil + default: + initModel := chezmoibubbles.NewStringInputModel(prompt, defaultValue) + finalModel, err := runCancelableModel(initModel) + if err != nil { + return "", err + } + return strings.TrimSpace(finalModel.Value()), nil + } +} + +func (c *Config) promptBool(prompt string, args ...bool) (bool, error) { + var defaultValue *bool + switch len(args) { + case 0: + // Do nothing. + case 1: + defaultValue = &args[0] + default: + return false, fmt.Errorf("want 1 or 2 arguments, got %d", len(args)+1) + } + return c.readBool(prompt, defaultValue) +} + +// promptChoice prompts the user for one of choices until a valid choice is made. +func (c *Config) promptChoice(prompt string, choices []string, args ...string) (string, error) { + var defaultValue *string + switch len(args) { + case 0: + // Do nothing. + case 1: + if !slices.Contains(choices, args[0]) { + return "", fmt.Errorf("%s: invalid default value", args[0]) + } + defaultValue = &args[0] + default: + return "", fmt.Errorf("want 2 or 3 arguments, got %d", len(args)+2) + } + return c.readChoice(prompt, choices, defaultValue) +} + +func (c *Config) promptInt(prompt string, args ...int64) (int64, error) { + var defaultValue *int64 + switch len(args) { + case 0: + // Do nothing. + case 1: + defaultValue = &args[0] + default: + return 0, fmt.Errorf("want 1 or 2 arguments, got %d", len(args)+1) + } + return c.readInt(prompt, defaultValue) +} + +func (c *Config) promptString(prompt string, args ...string) (string, error) { + var defaultValue *string + switch len(args) { + case 0: + // Do nothing. + case 1: + arg := strings.TrimSpace(args[0]) + defaultValue = &arg + default: + return "", fmt.Errorf("want 1 or 2 arguments, got %d", len(args)+1) + } + return c.readString(prompt, defaultValue) +} + +type cancelableModel interface { + tea.Model + Canceled() bool +} + +//nolint:ireturn,nolintlint +func runCancelableModel[M cancelableModel](initModel M) (M, error) { + switch finalModel, err := runModel(initModel); { + case err != nil: + return finalModel, err + case finalModel.Canceled(): + return finalModel, chezmoi.ExitCodeError(0) + default: + return finalModel, nil + } +} + +//nolint:ireturn,nolintlint +func runModel[M tea.Model](initModel M) (M, error) { + program := tea.NewProgram(initModel) + finalModel, err := program.StartReturningModel() + //nolint:forcetypeassert + return finalModel.(M), err +}
feat
Use bubbletea for user input
b145440ff46e2442e6d7813b6fc90849fd5c9391
2022-12-22 04:32:51
Tom Payne
feat: Allow .chezmoi{external,ignore,remove} files to have a .tmpl suffix
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 e23a886341f..7996dcfb36f 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 @@ -1,9 +1,9 @@ -# `.chezmoiexternal.$FORMAT` +# `.chezmoiexternal.$FORMAT{,.tmpl}` -If a file called `.chezmoiexternal.$FORMAT` exists in the source state (either -`~/.local/share/chezmoi` or directory defined inside `.chezmoiroot`), it is -interpreted as a list of external files and archives to be included as if they -were in the source state. +If a file called `.chezmoiexternal.$FORMAT` (with an optional `.tmpl` extension) +exists in the source state (either `~/.local/share/chezmoi` or directory defined +inside `.chezmoiroot`), it is interpreted as a list of external files and +archives to be included as if they were in the source state. `$FORMAT` must be one of chezmoi's supported configuration file formats, e.g. `json`, `toml`, or `yaml`. diff --git a/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiignore.md b/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiignore.md index 8d1a22b5514..80eb7a72b42 100644 --- a/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiignore.md +++ b/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiignore.md @@ -1,7 +1,8 @@ -# `.chezmoiignore` +# `.chezmoiignore{,.tmpl}` -If a file called `.chezmoiignore` exists in the source state then it is -interpreted as a set of patterns to ignore. Patterns are matched using +If a file called `.chezmoiignore` (with an optional `.tmpl` extension) exists in +the source state then it is interpreted as a set of patterns to ignore. Patterns +are matched using [`doublestar.Match`](https://pkg.go.dev/github.com/bmatcuk/doublestar/v4#Match) and match against the target path, not the source path. @@ -11,8 +12,8 @@ take priority over all includes. Comments are introduced with the `#` character and run until the end of the line. -`.chezmoiignore` is interpreted as a template. This allows different files to -be ignored on different machines. +`.chezmoiignore` is interpreted as a template, whether or not it has a `.tmpl` +extension. This allows different files to be ignored on different machines. `.chezmoiignore` files in subdirectories apply only to that subdirectory. diff --git a/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiremove.md b/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiremove.md index c93ebabbeb3..3312bd4930c 100644 --- a/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiremove.md +++ b/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiremove.md @@ -1,5 +1,6 @@ -# `.chezmoiremove` +# `.chezmoiremove{,.tmpl}` -If a file called `.chezmoiremove` exists in the source state then it is -interpreted as a list of targets to remove. `.chezmoiremove` is interpreted as -a template. +If a file called `.chezmoiremove` (with an optional `.tmpl` extension) exists in +the source state then it is interpreted as a list of targets to remove. +`.chezmoiremove` is interpreted as a template, whether or not it has a `.tmpl` +extension. diff --git a/pkg/chezmoi/abspath.go b/pkg/chezmoi/abspath.go index f63aaa04b89..9b11a58cda0 100644 --- a/pkg/chezmoi/abspath.go +++ b/pkg/chezmoi/abspath.go @@ -159,6 +159,11 @@ func (p AbsPath) TrimDirPrefix(dirPrefixAbsPath AbsPath) (RelPath, error) { return NewRelPath(p.absPath[len(dirAbsPath.absPath):]), nil } +// TrimSuffix returns p with the optional suffix removed. +func (p AbsPath) TrimSuffix(suffix string) AbsPath { + return NewAbsPath(strings.TrimSuffix(p.absPath, suffix)) +} + // Type implements github.com/spf13/pflag.Value.Type. func (p AbsPath) Type() string { return "path" diff --git a/pkg/chezmoi/chezmoi.go b/pkg/chezmoi/chezmoi.go index 8737cbfe42b..50dd4e13960 100644 --- a/pkg/chezmoi/chezmoi.go +++ b/pkg/chezmoi/chezmoi.go @@ -97,10 +97,15 @@ var knownPrefixedFiles = newSet( dataName+".toml", dataName+".yaml", externalName+".json", + externalName+".json"+TemplateSuffix, externalName+".toml", + externalName+".toml"+TemplateSuffix, externalName+".yaml", + externalName+".yaml"+TemplateSuffix, ignoreName, + ignoreName+TemplateSuffix, removeName, + removeName+TemplateSuffix, VersionName, ) diff --git a/pkg/chezmoi/format.go b/pkg/chezmoi/format.go index 544ed65266a..d38879d8da9 100644 --- a/pkg/chezmoi/format.go +++ b/pkg/chezmoi/format.go @@ -126,3 +126,12 @@ func isPrefixDotFormat(name, prefix string) bool { } return false } + +func isPrefixDotFormatDotTmpl(name, prefix string) bool { + for extension := range FormatsByExtension { + if name == prefix+"."+extension+TemplateSuffix { + return true + } + } + return false +} diff --git a/pkg/chezmoi/sourcestate.go b/pkg/chezmoi/sourcestate.go index 0750536f8d9..5974667fcc3 100644 --- a/pkg/chezmoi/sourcestate.go +++ b/pkg/chezmoi/sourcestate.go @@ -844,11 +844,11 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error { return vfs.SkipDir case s.templateDataOnly: return nil - case isPrefixDotFormat(fileInfo.Name(), externalName): + case isPrefixDotFormat(fileInfo.Name(), externalName) || isPrefixDotFormatDotTmpl(fileInfo.Name(), externalName): return s.addExternal(sourceAbsPath) - case fileInfo.Name() == ignoreName: + case fileInfo.Name() == ignoreName || fileInfo.Name() == ignoreName+TemplateSuffix: return s.addPatterns(s.ignore, sourceAbsPath, parentSourceRelPath) - case fileInfo.Name() == removeName: + case fileInfo.Name() == removeName || fileInfo.Name() == removeName+TemplateSuffix: return s.addPatterns(s.remove, sourceAbsPath, parentSourceRelPath) case fileInfo.Name() == scriptsDirName: scriptsDirSourceStateEntries, err := s.readScriptsDir(ctx, sourceAbsPath) @@ -1149,7 +1149,7 @@ func (s *SourceState) addExternal(sourceAbsPath AbsPath) error { parentSourceRelPath := NewSourceRelDirPath(parentRelPath.String()) parentTargetSourceRelPath := parentSourceRelPath.TargetRelPath(s.encryption.EncryptedSuffix()) - format, err := FormatFromAbsPath(sourceAbsPath) + format, err := FormatFromAbsPath(sourceAbsPath.TrimSuffix(TemplateSuffix)) if err != nil { return err } diff --git a/pkg/cmd/testdata/scripts/issue2628.txtar b/pkg/cmd/testdata/scripts/issue2628.txtar new file mode 100644 index 00000000000..e9e985945cb --- /dev/null +++ b/pkg/cmd/testdata/scripts/issue2628.txtar @@ -0,0 +1,34 @@ +httpd www + +# test that .chezmoiexternal.toml.tmpl is read +exec chezmoi apply +cmp $HOME/.file golden/.file + +chhome home2/user + +# test that .chezmoignore.tmpl is read +exec chezmoi apply +! exists $HOME/.file + +chhome home3/user + +# test that .chezmoiremove.tmpl is read +exec chezmoi apply +! exists $HOME/.file + +-- golden/.file -- +# contents of .file +-- home/user/.local/share/chezmoi/.chezmoiexternal.toml.tmpl -- +[".file"] + type = "file" + url = "{{ env "HTTPD_URL" }}/.file" +-- home2/user/.local/share/chezmoi/.chezmoiignore.tmpl -- +.file +-- home2/user/.local/share/chezmoi/dot_file -- +# contents of .file +-- home3/user/.file -- +# contents of .file +-- home3/user/.local/share/chezmoi/.chezmoiremove.tmpl -- +.file +-- www/.file -- +# contents of .file
feat
Allow .chezmoi{external,ignore,remove} files to have a .tmpl suffix
77bdb3c3a5577185b43c7e2f0129d4621338dc01
2021-10-02 17:44:17
Tom Payne
chore: Update dependencies
false
diff --git a/go.mod b/go.mod index ec2afb6dccb..a3c40a7664a 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/google/go-github/v39 v39.1.0 github.com/google/go-querystring v1.1.0 // indirect github.com/google/gops v0.3.20 - github.com/google/renameio v1.0.1 + github.com/google/renameio/v2 v2.0.0 github.com/google/uuid v1.3.0 // indirect github.com/huandu/xstrings v1.3.2 // indirect github.com/kevinburke/ssh_config v1.1.0 // indirect @@ -48,7 +48,7 @@ require ( go.uber.org/multierr v1.7.0 golang.org/x/net v0.0.0-20210929193557-e81a3d93ecf6 // indirect golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f - golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 + golang.org/x/sys v0.0.0-20211001092434-39dca1131b70 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 google.golang.org/protobuf v1.27.1 // indirect gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index 6269e9b464d..5f4e3d8481c 100644 --- a/go.sum +++ b/go.sum @@ -234,9 +234,10 @@ github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/renameio v1.0.1 h1:Lh/jXZmvZxb0BBeSY5VKEfidcbcbenKjZFzM/q0fSeU= -github.com/google/renameio v1.0.1/go.mod h1:t/HQoYBZSsWSNK35C6CO/TpPLDVWvxOHboWUAweKUpk= +github.com/google/renameio/v2 v2.0.0 h1:UifI23ZTGY8Tt29JbYFiuyIU3eX+RNFtUwefq9qAhxg= +github.com/google/renameio/v2 v2.0.0/go.mod h1:BtmJXm5YlszgC+TD4HOEEUFgkJP3nLxehU6hfe7jRt4= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= @@ -675,8 +676,8 @@ golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210903071746-97244b99971b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 h1:foEbQz/B0Oz6YIqu/69kfXPYeFQAuuMYFkjaqXzl5Wo= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211001092434-39dca1131b70 h1:pGleJoyD1yA5HfvuaksHxD0404gsEkNDerKsQ0N0y1s= +golang.org/x/sys v0.0.0-20211001092434-39dca1131b70/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= diff --git a/internal/chezmoi/realsystem_unix.go b/internal/chezmoi/realsystem_unix.go index 462df471fc0..18a6b2f216d 100644 --- a/internal/chezmoi/realsystem_unix.go +++ b/internal/chezmoi/realsystem_unix.go @@ -9,7 +9,7 @@ import ( "os" "syscall" - "github.com/google/renameio" + "github.com/google/renameio/v2" vfs "github.com/twpayne/go-vfs/v4" "go.uber.org/multierr" )
chore
Update dependencies
5a1b598e7fdfe7e8f75bee1284663d4e5c3faf4b
2025-03-17 02:03:14
Tom Payne
chore: Update tools
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fbea35214e7..5c2222e9363 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ env: ACTIONLINT_VERSION: 1.7.7 # https://github.com/rhysd/actionlint/releases AGE_VERSION: 1.2.1 # https://github.com/FiloSottile/age/releases CHOCOLATEY_VERSION: 2.4.3 # https://github.com/chocolatey/choco/releases - EDITORCONFIG_CHECKER_VERSION: 3.2.0 # https://github.com/editorconfig-checker/editorconfig-checker/releases + EDITORCONFIG_CHECKER_VERSION: 3.2.1 # https://github.com/editorconfig-checker/editorconfig-checker/releases FIND_TYPOS_VERSION: 0.0.3 # https://github.com/twpayne/find-typos/tags GO_VERSION: 1.24.1 # https://go.dev/doc/devel/release GOFUMPT_VERSION: 0.7.0 # https://github.com/mvdan/gofumpt/releases
chore
Update tools
3f035a6d96a18cf1e67e696e58d7aef968a718e2
2022-03-14 02:54:19
Tom Payne
feat: Add diff.reverse configuration variable
false
diff --git a/assets/chezmoi.io/docs/reference/configuration-file/variables.md b/assets/chezmoi.io/docs/reference/configuration-file/variables.md index 17dee9cbe11..c71e030aaa0 100644 --- a/assets/chezmoi.io/docs/reference/configuration-file/variables.md +++ b/assets/chezmoi.io/docs/reference/configuration-file/variables.md @@ -38,6 +38,7 @@ The following configuration variables are available: | | `command` | string | *none* | External diff command | | | `exclude` | []string | *none* | Entry types to exclude from diffs | | | `pager` | string | *none* | Diff-specific pager | +| | `reverse` | bool | `false` | Reverse order of arguments to diff | | `edit` | `args` | []string | *none* | Extra args to edit command | | | `command` | string | `$EDITOR` / `$VISUAL` | Edit command | | | `hardlink` | bool | `true` | Invoke editor with a hardlink to the source file | diff --git a/pkg/cmd/diffcmd.go b/pkg/cmd/diffcmd.go index b4b4d312971..167545617f2 100644 --- a/pkg/cmd/diffcmd.go +++ b/pkg/cmd/diffcmd.go @@ -14,10 +14,10 @@ type diffCmdConfig struct { Args []string `mapstructure:"args"` Exclude *chezmoi.EntryTypeSet `mapstructure:"exclude"` Pager string `mapstructure:"pager"` + Reverse bool `mapstructure:"reverse"` include *chezmoi.EntryTypeSet init bool recursive bool - reverse bool useBuiltinDiff bool } @@ -40,7 +40,7 @@ func (c *Config) newDiffCmd() *cobra.Command { flags.VarP(c.Diff.include, "include", "i", "Include entry types") flags.BoolVar(&c.Diff.init, "init", c.update.init, "Recreate config file from template") 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.Reverse, "reverse", c.Diff.Reverse, "Reverse the direction of the diff") flags.StringVar(&c.Diff.Pager, "pager", c.Diff.Pager, "Set pager") flags.BoolVarP(&c.Diff.useBuiltinDiff, "use-builtin-diff", "", c.Diff.useBuiltinDiff, "Use the builtin diff") @@ -55,7 +55,7 @@ func (c *Config) runDiffCmd(cmd *cobra.Command, args []string) (err error) { gitDiffSystem := chezmoi.NewGitDiffSystem(dryRunSystem, &builder, c.DestDirAbsPath, &chezmoi.GitDiffSystemOptions{ Color: color, Include: c.Diff.include.Sub(c.Diff.Exclude), - Reverse: c.Diff.reverse, + Reverse: c.Diff.Reverse, }) if err = c.applyArgs(cmd.Context(), gitDiffSystem, c.DestDirAbsPath, args, applyArgsOptions{ include: c.Diff.include.Sub(c.Diff.Exclude), @@ -70,7 +70,7 @@ func (c *Config) runDiffCmd(cmd *cobra.Command, args []string) (err error) { } diffSystem := chezmoi.NewExternalDiffSystem( dryRunSystem, c.Diff.Command, c.Diff.Args, c.DestDirAbsPath, &chezmoi.ExternalDiffSystemOptions{ - Reverse: c.Diff.reverse, + Reverse: c.Diff.Reverse, }, ) defer func() {
feat
Add diff.reverse configuration variable
76c14a7f86f31c970a1d37ef40ae9667b0dfe757
2024-11-27 00:44:52
Tom Payne
chore: Update tools
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5f075659b5f..f7efde3778a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,9 +21,9 @@ env: FIND_TYPOS_VERSION: 0.0.3 # https://github.com/twpayne/find-typos/tags GO_VERSION: 1.23.3 # https://go.dev/doc/devel/release GOFUMPT_VERSION: 0.7.0 # https://github.com/mvdan/gofumpt/releases - GOLANGCI_LINT_VERSION: 1.62.0 # https://github.com/golangci/golangci-lint/releases + GOLANGCI_LINT_VERSION: 1.62.2 # https://github.com/golangci/golangci-lint/releases GOLINES_VERSION: 0.12.2 # https://github.com/segmentio/golines/releases - GORELEASER_VERSION: 2.4.7 # https://github.com/goreleaser/goreleaser/releases + GORELEASER_VERSION: 2.4.8 # https://github.com/goreleaser/goreleaser/releases GOVERSIONINFO_VERSION: 1.4.1 # https://github.com/josephspurrier/goversioninfo/releases PYTHON_VERSION: '3.10' # https://www.python.org/downloads/ RAGE_VERSION: 0.11.0 # https://github.com/str4d/rage/releases
chore
Update tools
ff9ca7124b10b37de9b126ffb5aad2e94fca13c2
2022-10-12 00:07:35
Tom Payne
docs: Use get.chezmoi.io/ps1 for PowerShell installations
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6481f323125..d6d042d37b3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -315,12 +315,12 @@ jobs: - name: test-install-irm run: | if (Test-Path -Path bin/chezmoi.exe) { Remove-Item -Force bin/chezmoi.exe } - (irm -useb https://chezmoi.io/get.ps1) | powershell -c - + (irm -useb https://get.chezmoi.io/ps1) | powershell -c - bin/chezmoi.exe --version - name: test-install-iwr run: | if (Test-Path -Path bin/chezmoi.exe) { Remove-Item -Force bin/chezmoi.exe } - (iwr -useb https://chezmoi.io/get.ps1).ToString() | powershell -c - + (iwr -useb https://get.chezmoi.io/ps1).ToString() | powershell -c - bin/chezmoi.exe --version check: runs-on: ubuntu-18.04 diff --git a/assets/chezmoi.io/docs/install.md.tmpl b/assets/chezmoi.io/docs/install.md.tmpl index 027cabad739..460b677609c 100644 --- a/assets/chezmoi.io/docs/install.md.tmpl +++ b/assets/chezmoi.io/docs/install.md.tmpl @@ -138,7 +138,7 @@ with a single command: === "PowerShell" ```powershell - (irm -useb https://chezmoi.io/get.ps1) | powershell -c - + (irm -useb https://get.chezmoi.io/ps1) | powershell -c - ``` !!! hint diff --git a/assets/scripts/install.ps1 b/assets/scripts/install.ps1 index 29da35c0f80..273b3b04915 100644 --- a/assets/scripts/install.ps1 +++ b/assets/scripts/install.ps1 @@ -227,8 +227,8 @@ function unpack-file { You can specify a particular git tag using the -Tag option. Examples: - '$params = "-BinDir ~/bindir"', (iwr https://chezmoi.io/get.ps1).Content | powershell -c - - '$params = "-Tag v1.8.10"', (iwr https://chezmoi.io/get.ps1).Content | powershell -c - + '$params = "-BinDir ~/bindir"', (iwr https://get.chezmoi.io/ps1).Content | powershell -c - + '$params = "-Tag v1.8.10"', (iwr https://get.chezmoi.io/ps1).Content | powershell -c - #> function Install-Chezmoi { [CmdletBinding(PositionalBinding=$false)]
docs
Use get.chezmoi.io/ps1 for PowerShell installations
b6d530b72d646d55f42c0208e44ea98f6b59cca6
2021-11-03 18:22:47
Tom Payne
chore: Fix priority order of os-release
false
diff --git a/internal/chezmoi/data.go b/internal/chezmoi/data.go index 9b21c177012..ff30acf46ef 100644 --- a/internal/chezmoi/data.go +++ b/internal/chezmoi/data.go @@ -54,8 +54,8 @@ func Kernel(fileSystem vfs.FS) (map[string]interface{}, error) { // os-release specification. func OSRelease(system System) (map[string]interface{}, error) { for _, filename := range []AbsPath{ - NewAbsPath("/usr/lib/os-release"), NewAbsPath("/etc/os-release"), + NewAbsPath("/usr/lib/os-release"), } { data, err := system.ReadFile(filename) if errors.Is(err, fs.ErrNotExist) {
chore
Fix priority order of os-release
ced09f10b7e015da5b4d8ef8d663d54ff60e1b31
2023-01-23 00:54:48
Tom Payne
chore: Update dependencies
false
diff --git a/go.mod b/go.mod index c83c68d632b..4e4749bf11c 100644 --- a/go.mod +++ b/go.mod @@ -10,10 +10,10 @@ require ( github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.18.1 github.com/bmatcuk/doublestar/v4 v4.6.0 github.com/bradenhilton/mozillainstallhash v1.0.0 - github.com/charmbracelet/bubbles v0.14.0 + github.com/charmbracelet/bubbles v0.15.0 github.com/charmbracelet/bubbletea v0.23.1 github.com/charmbracelet/glamour v0.6.0 - github.com/coreos/go-semver v0.3.0 + github.com/coreos/go-semver v0.3.1 github.com/fsnotify/fsnotify v1.6.0 github.com/go-git/go-git/v5 v5.5.2 github.com/google/go-github/v49 v49.1.0 @@ -38,7 +38,7 @@ require ( go.etcd.io/bbolt v1.3.7-0.20220226045046-fd5535f71f48 go.uber.org/multierr v1.9.0 golang.org/x/crypto v0.5.0 - golang.org/x/exp v0.0.0-20230113213754-f9f960f08ad4 + golang.org/x/exp v0.0.0-20230118134722-a68e582fa157 golang.org/x/oauth2 v0.4.0 golang.org/x/sync v0.1.0 golang.org/x/sys v0.4.0 @@ -53,7 +53,7 @@ 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-20230113180642-068501e20d67 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230117203413-a47887b8f098 // indirect github.com/acomagu/bufpipe v1.0.3 // indirect github.com/alecthomas/chroma v0.10.0 // indirect github.com/alessio/shellescape v1.4.1 // indirect diff --git a/go.sum b/go.sum index e1184d79b36..f05674954e6 100644 --- a/go.sum +++ b/go.sum @@ -12,8 +12,8 @@ github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v 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-20230113180642-068501e20d67 h1:prYO7+yhqRjrP/lryCKZG4ieyeoKE40r8BKokURLd5M= -github.com/ProtonMail/go-crypto v0.0.0-20230113180642-068501e20d67/go.mod h1:UBYPn8k0D56RtnR8RFQMjmh4KrZzWJ5o7Z9SYjossQ8= +github.com/ProtonMail/go-crypto v0.0.0-20230117203413-a47887b8f098 h1:gQT1cLGP56jqbm0ioh/80TgknBT2EyZ5XwnnJsiQQKo= +github.com/ProtonMail/go-crypto v0.0.0-20230117203413-a47887b8f098/go.mod h1:UBYPn8k0D56RtnR8RFQMjmh4KrZzWJ5o7Z9SYjossQ8= 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= github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek= @@ -65,16 +65,14 @@ github.com/bradenhilton/mozillainstallhash v1.0.0 h1:QL9byVGb4FrVOI7MubnME3uPNj5 github.com/bradenhilton/mozillainstallhash v1.0.0/go.mod h1:yVD0OX1izZHYl1lBm2UDojyE/k0xIqKJK78k+tdWV+k= 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.14.0 h1:DJfCwnARfWjZLvMglhSQzo76UZ2gucuHPy9jLWX45Og= -github.com/charmbracelet/bubbles v0.14.0/go.mod h1:bbeTiXwPww4M031aGi8UK2HT9RDWoiNibae+1yCMtcc= -github.com/charmbracelet/bubbletea v0.21.0/go.mod h1:GgmJMec61d08zXsOhqRC/AiOx4K4pmz+VIcRIm1FKr4= +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 h1:CYdteX1wCiCzKNUlwm25ZHBIc1GXlYFyUIte8WPvhck= github.com/charmbracelet/bubbletea v0.23.1/go.mod h1:JAfGK/3/pPKHTnAS8JIE2u9f61BjWTQY57RbT25aMXU= github.com/charmbracelet/glamour v0.6.0 h1:wi8fse3Y7nfcabbbDuwolqTqMQPMnVPeZhDM273bISc= github.com/charmbracelet/glamour v0.6.0/go.mod h1:taqWV4swIMMbWALc0m7AfE9JkPSU8om2538k9ITBxOc= 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.5.0/go.mod h1:EZLha/HbzEt7cYqdFPovlqy5FZPj0xFhg5SaqxScmgs= 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= @@ -82,8 +80,8 @@ github.com/cloudflare/circl v1.3.1 h1:4OVCZRL62ijwEwxnF6I7hLwxvIYi3VaZt8Tflkqtrt 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= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +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.3.3-0.20220203105225-a9a7ef127534 h1:rtAn27wIbmOGUs7RIbVgPEjb31ehTVniDwPGXyMxm5U= github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= @@ -204,7 +202,6 @@ github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b/go.mod h1:fQuZ0gauxyBcmsdE3ZT4NasjaRdxmbCS0jRHsrWu3Ho= github.com/muesli/ansi v0.0.0-20221106050444-61f0cd9a192a h1:jlDOeO5TU0pYlbc/y6PFguab5IjANI0Knrpg3u/ton4= github.com/muesli/ansi v0.0.0-20221106050444-61f0cd9a192a/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= -github.com/muesli/cancelreader v0.2.0/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/muesli/combinator v0.3.0 h1:SZDuRzzwmVPLkbOzbhGzBTwd5+Y6aFN4UusOW2azrNA= @@ -213,7 +210,6 @@ github.com/muesli/reflow v0.2.1-0.20210115123740-9e1d0d53df68/go.mod h1:Xk+z4oIW 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.11.1-0.20220204035834-5ac8409525e0/go.mod h1:Bd5NYQ7pd+SrtBSrSNoBBmXlcY8+Xj4BMJgh8qcZrvs= -github.com/muesli/termenv v0.11.1-0.20220212125758-44cd13922739/go.mod h1:Bd5NYQ7pd+SrtBSrSNoBBmXlcY8+Xj4BMJgh8qcZrvs= github.com/muesli/termenv v0.13.0 h1:wK20DRpJdDX8b7Ek2QfhvqhRQFZ237RGRO0RQ/Iqdy0= github.com/muesli/termenv v0.13.0/go.mod h1:sP1+uffeLaEYpyOTb8pLCUctGcGLnoFjSn4YJK5e2bc= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= @@ -311,8 +307,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.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= -golang.org/x/exp v0.0.0-20230113213754-f9f960f08ad4 h1:CNkDRtCj8otM5CFz5jYvbr8ioXX8flVsLfDWEj0M5kk= -golang.org/x/exp v0.0.0-20230113213754-f9f960f08ad4/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230118134722-a68e582fa157 h1:fiNkyhJPUvxbRPbCqY/D9qdjmPzfHcpK3P4bM4gioSY= +golang.org/x/exp v0.0.0-20230118134722-a68e582fa157/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= @@ -346,7 +342,6 @@ golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBc 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= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
chore
Update dependencies
a0da07b279b8e6e5729b214c352a0d0315c2301c
2022-10-05 18:11:24
Tom Payne
feat: Add shell completion for --include and --exclude flags
false
diff --git a/pkg/chezmoi/entrytypeset.go b/pkg/chezmoi/entrytypeset.go index 1a40efb900f..a9833f44539 100644 --- a/pkg/chezmoi/entrytypeset.go +++ b/pkg/chezmoi/entrytypeset.go @@ -7,6 +7,7 @@ import ( "strings" "github.com/mitchellh/mapstructure" + "github.com/spf13/cobra" ) // An EntryTypeSet is a set of entry types. It parses and prints as a @@ -42,17 +43,38 @@ const ( EntryTypesNone EntryTypeBits = 0 ) -// entryTypeBits is a map from human-readable strings to EntryTypeBits. -var entryTypeBits = map[string]EntryTypeBits{ - "all": EntryTypesAll, - "dirs": EntryTypeDirs, - "files": EntryTypeFiles, - "remove": EntryTypeRemove, - "scripts": EntryTypeScripts, - "symlinks": EntryTypeSymlinks, - "encrypted": EntryTypeEncrypted, - "externals": EntryTypeExternals, -} +var ( + // entryTypeBits is a map from human-readable strings to EntryTypeBits. + entryTypeBits = map[string]EntryTypeBits{ + "all": EntryTypesAll, + "dirs": EntryTypeDirs, + "files": EntryTypeFiles, + "remove": EntryTypeRemove, + "scripts": EntryTypeScripts, + "symlinks": EntryTypeSymlinks, + "encrypted": EntryTypeEncrypted, + "externals": EntryTypeExternals, + } + + entryTypeCompletions = []string{ + "all", + "dirs", + "encrypted", + "externals", + "files", + "nodirs", + "noencrypted", + "noexternals", + "nofiles", + "none", + "noremove", + "noscripts", + "nosymlinks", + "remove", + "scripts", + "symlinks", + } +) // NewEntryTypeSet returns a new IncludeSet. func NewEntryTypeSet(bits EntryTypeBits) *EntryTypeSet { @@ -218,3 +240,22 @@ func StringSliceToEntryTypeSetHookFunc() mapstructure.DecodeHookFunc { return s, nil } } + +// EntryTypeSetFlagCompletionFunc completes EntryTypeSet flags. +func EntryTypeSetFlagCompletionFunc( + cmd *cobra.Command, args []string, toComplete string, +) ([]string, cobra.ShellCompDirective) { + var completions []string + entryTypes := strings.Split(toComplete, ",") + lastEntryType := entryTypes[len(entryTypes)-1] + var prefix string + if len(entryTypes) > 0 { + prefix = toComplete[:len(toComplete)-len(lastEntryType)] + } + for _, completion := range entryTypeCompletions { + if strings.HasPrefix(completion, lastEntryType) { + completions = append(completions, prefix+completion) + } + } + return completions, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp +} diff --git a/pkg/chezmoi/entrytypeset_test.go b/pkg/chezmoi/entrytypeset_test.go index 9871bb26a8e..cb641bc344d 100644 --- a/pkg/chezmoi/entrytypeset_test.go +++ b/pkg/chezmoi/entrytypeset_test.go @@ -3,6 +3,7 @@ package chezmoi import ( "testing" + "github.com/spf13/cobra" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -114,3 +115,37 @@ func TestIncludeMaskStringSlice(t *testing.T) { }) } } + +func TestEntryTypeSetFlagCompletionFunc(t *testing.T) { + for _, tc := range []struct { + toComplete string + expectedCompletions []string + }{ + { + toComplete: "a", + expectedCompletions: []string{ + "all", + }, + }, + { + toComplete: "e", + expectedCompletions: []string{ + "encrypted", + "externals", + }, + }, + { + toComplete: "all,nos", + expectedCompletions: []string{ + "all,noscripts", + "all,nosymlinks", + }, + }, + } { + t.Run(tc.toComplete, func(t *testing.T) { + completions, shellCompDirective := EntryTypeSetFlagCompletionFunc(nil, nil, tc.toComplete) + assert.Equal(t, tc.expectedCompletions, completions) + assert.Equal(t, cobra.ShellCompDirectiveNoSpace|cobra.ShellCompDirectiveNoFileComp, shellCompDirective) + }) + } +} diff --git a/pkg/cmd/addcmd.go b/pkg/cmd/addcmd.go index 17b2d8a6256..d9e4d42f876 100644 --- a/pkg/cmd/addcmd.go +++ b/pkg/cmd/addcmd.go @@ -52,6 +52,8 @@ func (c *Config) newAddCmd() *cobra.Command { 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 + registerExcludeIncludeFlagCompletionFuncs(addCmd) + return addCmd } diff --git a/pkg/cmd/applycmd.go b/pkg/cmd/applycmd.go index c2dcdfaf468..9b734578f46 100644 --- a/pkg/cmd/applycmd.go +++ b/pkg/cmd/applycmd.go @@ -34,6 +34,8 @@ func (c *Config) newApplyCmd() *cobra.Command { flags.BoolVar(&c.apply.init, "init", c.update.init, "Recreate config file from template") flags.BoolVarP(&c.apply.recursive, "recursive", "r", c.apply.recursive, "Recurse into subdirectories") + registerExcludeIncludeFlagCompletionFuncs(applyCmd) + return applyCmd } diff --git a/pkg/cmd/archivecmd.go b/pkg/cmd/archivecmd.go index 6b649077e4d..960a59229b6 100644 --- a/pkg/cmd/archivecmd.go +++ b/pkg/cmd/archivecmd.go @@ -44,6 +44,8 @@ func (c *Config) newArchiveCmd() *cobra.Command { flags.BoolVar(&c.archive.init, "init", c.update.init, "Recreate config file from template") flags.BoolVarP(&c.archive.recursive, "recursive", "r", c.archive.recursive, "Recurse into subdirectories") + registerExcludeIncludeFlagCompletionFuncs(archiveCmd) + return archiveCmd } diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index bcc1501aa0a..20fef3e4477 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -222,6 +222,17 @@ func extractHelp( }, nil } +// registerExcludeIncludeFlagCompletionFuncs registers the flag completion +// functions for the include and exclude flags of cmd. It panics on any error. +func registerExcludeIncludeFlagCompletionFuncs(cmd *cobra.Command) { + if err := multierr.Combine( + cmd.RegisterFlagCompletionFunc("exclude", chezmoi.EntryTypeSetFlagCompletionFunc), + cmd.RegisterFlagCompletionFunc("include", chezmoi.EntryTypeSetFlagCompletionFunc), + ); err != nil { + panic(err) + } +} + // renderLines renders lines, trimming extraneous whitespace. func renderLines(lines []string, termRenderer *glamour.TermRenderer) (string, error) { renderedLines, err := termRenderer.Render(strings.Join(lines, "\n")) diff --git a/pkg/cmd/config.go b/pkg/cmd/config.go index 1417bfc9cee..9f8c79c6ae9 100644 --- a/pkg/cmd/config.go +++ b/pkg/cmd/config.go @@ -1353,7 +1353,7 @@ func (c *Config) newRootCmd() (*cobra.Command, error) { persistentFlags.Lookup("refresh-externals").NoOptDefVal = chezmoi.RefreshExternalsAlways.String() persistentFlags.BoolVar(&c.sourcePath, "source-path", c.sourcePath, "Specify targets by source path") - for _, err := range []error{ + if err := multierr.Combine( rootCmd.MarkPersistentFlagFilename("config"), rootCmd.MarkPersistentFlagFilename("cpu-profile"), persistentFlags.MarkHidden("cpu-profile"), @@ -1367,10 +1367,8 @@ func (c *Config) newRootCmd() (*cobra.Command, error) { rootCmd.RegisterFlagCompletionFunc("refresh-externals", chezmoi.RefreshExternalsFlagCompletionFunc), rootCmd.RegisterFlagCompletionFunc("use-builtin-age", autoBoolFlagCompletionFunc), rootCmd.RegisterFlagCompletionFunc("use-builtin-git", autoBoolFlagCompletionFunc), - } { - if err != nil { - return nil, err - } + ); err != nil { + return nil, err } rootCmd.SetHelpCommand(c.newHelpCmd()) diff --git a/pkg/cmd/diffcmd.go b/pkg/cmd/diffcmd.go index b808e040484..e7e8b6b5651 100644 --- a/pkg/cmd/diffcmd.go +++ b/pkg/cmd/diffcmd.go @@ -43,6 +43,8 @@ func (c *Config) newDiffCmd() *cobra.Command { flags.StringVar(&c.Diff.Pager, "pager", c.Diff.Pager, "Set pager") flags.BoolVarP(&c.Diff.useBuiltinDiff, "use-builtin-diff", "", c.Diff.useBuiltinDiff, "Use the builtin diff") + registerExcludeIncludeFlagCompletionFuncs(diffCmd) + return diffCmd } diff --git a/pkg/cmd/dumpcmd.go b/pkg/cmd/dumpcmd.go index a9278047798..dc96be87aa7 100644 --- a/pkg/cmd/dumpcmd.go +++ b/pkg/cmd/dumpcmd.go @@ -37,6 +37,8 @@ func (c *Config) newDumpCmd() *cobra.Command { panic(err) } + registerExcludeIncludeFlagCompletionFuncs(dumpCmd) + return dumpCmd } diff --git a/pkg/cmd/editcmd.go b/pkg/cmd/editcmd.go index 7454d8731ce..592d7ef2a49 100644 --- a/pkg/cmd/editcmd.go +++ b/pkg/cmd/editcmd.go @@ -48,6 +48,8 @@ func (c *Config) newEditCmd() *cobra.Command { 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") + registerExcludeIncludeFlagCompletionFuncs(editCmd) + return editCmd } diff --git a/pkg/cmd/importcmd.go b/pkg/cmd/importcmd.go index 538339306d7..50876619c9a 100644 --- a/pkg/cmd/importcmd.go +++ b/pkg/cmd/importcmd.go @@ -40,6 +40,8 @@ func (c *Config) newImportCmd() *cobra.Command { 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 + registerExcludeIncludeFlagCompletionFuncs(importCmd) + return importCmd } diff --git a/pkg/cmd/managedcmd.go b/pkg/cmd/managedcmd.go index ca715c9099b..c2aba1ca0cb 100644 --- a/pkg/cmd/managedcmd.go +++ b/pkg/cmd/managedcmd.go @@ -30,6 +30,8 @@ func (c *Config) newManagedCmd() *cobra.Command { flags.VarP(c.managed.exclude, "exclude", "x", "Exclude entry types") flags.VarP(c.managed.include, "include", "i", "Include entry types") + registerExcludeIncludeFlagCompletionFuncs(managedCmd) + return managedCmd } diff --git a/pkg/cmd/readdcmd.go b/pkg/cmd/readdcmd.go index e78f95a2ea1..4966283412a 100644 --- a/pkg/cmd/readdcmd.go +++ b/pkg/cmd/readdcmd.go @@ -35,6 +35,8 @@ func (c *Config) newReAddCmd() *cobra.Command { flags.VarP(c.reAdd.exclude, "exclude", "x", "Exclude entry types") flags.VarP(c.reAdd.include, "include", "i", "Include entry types") + registerExcludeIncludeFlagCompletionFuncs(reAddCmd) + return reAddCmd } diff --git a/pkg/cmd/statuscmd.go b/pkg/cmd/statuscmd.go index 67599be618a..f11ec168db6 100644 --- a/pkg/cmd/statuscmd.go +++ b/pkg/cmd/statuscmd.go @@ -37,6 +37,8 @@ func (c *Config) newStatusCmd() *cobra.Command { flags.BoolVar(&c.Status.init, "init", c.update.init, "Recreate config file from template") flags.BoolVarP(&c.Status.recursive, "recursive", "r", c.Status.recursive, "Recurse into subdirectories") + registerExcludeIncludeFlagCompletionFuncs(statusCmd) + return statusCmd } diff --git a/pkg/cmd/testdata/scripts/completion_unix.txtar b/pkg/cmd/testdata/scripts/completion_unix.txtar index 727dc0f6e18..f2a80401572 100644 --- a/pkg/cmd/testdata/scripts/completion_unix.txtar +++ b/pkg/cmd/testdata/scripts/completion_unix.txtar @@ -1,5 +1,9 @@ [windows] skip 'UNIX only' +# test chezmoi --include completion +exec chezmoi __complete apply --include=d +cmp stdout golden/complete-apply-include-d + # test chezmoi cat completion of targets in a directory exec chezmoi __complete cat $HOME cmpenv stdout golden/complete-target-home @@ -22,6 +26,9 @@ cmp stdout golden/complete-attribute-p exec chezmoi __complete cat private $HOME cmpenv stdout golden/complete-target-home +-- golden/complete-apply-include-d -- +dirs +:6 -- golden/complete-attribute-p -- private :4 diff --git a/pkg/cmd/updatecmd.go b/pkg/cmd/updatecmd.go index 10aa84eecbb..940cb991179 100644 --- a/pkg/cmd/updatecmd.go +++ b/pkg/cmd/updatecmd.go @@ -41,6 +41,8 @@ func (c *Config) newUpdateCmd() *cobra.Command { flags.BoolVar(&c.update.init, "init", c.update.init, "Recreate config file from template") flags.BoolVarP(&c.update.recursive, "recursive", "r", c.update.recursive, "Recurse into subdirectories") + registerExcludeIncludeFlagCompletionFuncs(updateCmd) + return updateCmd } diff --git a/pkg/cmd/verifycmd.go b/pkg/cmd/verifycmd.go index e77dd804ba0..8b3051821b1 100644 --- a/pkg/cmd/verifycmd.go +++ b/pkg/cmd/verifycmd.go @@ -33,6 +33,8 @@ func (c *Config) newVerifyCmd() *cobra.Command { flags.BoolVar(&c.Verify.init, "init", c.update.init, "Recreate config file from template") flags.BoolVarP(&c.Verify.recursive, "recursive", "r", c.Verify.recursive, "Recurse into subdirectories") + registerExcludeIncludeFlagCompletionFuncs(verifyCmd) + return verifyCmd }
feat
Add shell completion for --include and --exclude flags
62a1cf2f48ff41e46da42e608d963e5b6c128cdd
2022-10-25 05:50:37
Tom Payne
docs: Re-order installation instructions to avoid snap being first
false
diff --git a/assets/chezmoi.io/docs/install.md.tmpl b/assets/chezmoi.io/docs/install.md.tmpl index f545fbdab93..8b2a272d609 100644 --- a/assets/chezmoi.io/docs/install.md.tmpl +++ b/assets/chezmoi.io/docs/install.md.tmpl @@ -11,24 +11,6 @@ Install chezmoi with your package manager with a single command: === "Linux" - === "snap" - - ```sh - snap install chezmoi --classic - ``` - - === "Linuxbrew" - - ```sh - brew install chezmoi - ``` - - === "asdf" - - ```sh - asdf plugin add chezmoi && asdf install chezmoi {{ $version }} - ``` - === "Alpine" ```sh @@ -41,7 +23,7 @@ Install chezmoi with your package manager with a single command: pacman -S chezmoi ``` - === "Nix / NixOS" + === "NixOS" ```sh nix-env -i chezmoi @@ -85,12 +67,6 @@ Install chezmoi with your package manager with a single command: nix-env -i chezmoi ``` - === "asdf" - - ```sh - asdf plugin add chezmoi && asdf install chezmoi {{ $version }} - ``` - === "Windows" === "Chocolatey" @@ -117,6 +93,32 @@ Install chezmoi with your package manager with a single command: pkg install application/chezmoi ``` +chezmoi is available in many cross-platform package managers: + +=== "asdf" + + ```sh + asdf plugin add chezmoi && asdf install chezmoi {{ $version }} + ``` + +=== "Linuxbrew" + + ```sh + brew install chezmoi + ``` + +=== "Nix" + + ```sh + nix-env -i chezmoi + ``` + +=== "snap" + + ```sh + snap install chezmoi --classic + ``` + For more packages, see [chezmoi on repology.org](https://repology.org/project/chezmoi/versions). diff --git a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md index dc5324ab385..c1d56ab1e9a 100644 --- a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md +++ b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md @@ -216,19 +216,19 @@ this. However, there are two workarounds: Firstly, you can use alternatives to shell redirection. For standard input: - ```console - $ chezmoi $COMMAND <$FILENAME # fails - $ cat $FILENAME | chezmoi $COMMAND # succeeds - ``` +```console +$ chezmoi $COMMAND <$FILENAME # fails +$ cat $FILENAME | chezmoi $COMMAND # succeeds +``` For standard output: - ```console - $ chezmoi $COMMAND >$FILENAME # fails - $ chezmoi $COMMAND -o $FILENAME # succeeds - $ chezmoi $COMMAND --output=$FILENAME # succeeds - $ chezmoi $COMMAND | tee $FILENAME >/dev/null # succeeds - ``` +```console +$ chezmoi $COMMAND >$FILENAME # fails +$ chezmoi $COMMAND -o $FILENAME # succeeds +$ chezmoi $COMMAND --output=$FILENAME # succeeds +$ chezmoi $COMMAND | tee $FILENAME >/dev/null # succeeds +``` Secondly, you can install chezmoi with any of the [many supported install methods](/install/) instead of snap.
docs
Re-order installation instructions to avoid snap being first
9d4cfc02401a667f06cdafe57fae2753f898b19c
2023-09-01 16:09:49
dependabot[bot]
chore(deps): bump github/codeql-action from 2.21.2 to 2.21.5
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5935bc06856..17768460380 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,10 +51,10 @@ jobs: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 with: fetch-depth: 1 - - uses: github/codeql-action/init@0ba4244466797eb048eb91a6cd43d5c03ca8bd05 + - uses: github/codeql-action/init@00e563ead9f72a8461b24876bee2d0c2e8bd2ee8 with: languages: go - - uses: github/codeql-action/analyze@0ba4244466797eb048eb91a6cd43d5c03ca8bd05 + - uses: github/codeql-action/analyze@00e563ead9f72a8461b24876bee2d0c2e8bd2ee8 misspell: runs-on: ubuntu-22.04 steps:
chore
bump github/codeql-action from 2.21.2 to 2.21.5
9d332c6e1251693ed80e028590f98d5e75e17dd6
2024-04-29 16:11:55
Tom Payne
docs: Add link to article
false
diff --git a/assets/chezmoi.io/docs/links/articles.md.yaml b/assets/chezmoi.io/docs/links/articles.md.yaml index 53286764498..333663fc3d8 100644 --- a/assets/chezmoi.io/docs/links/articles.md.yaml +++ b/assets/chezmoi.io/docs/links/articles.md.yaml @@ -411,3 +411,8 @@ articles: version: 2.47.4 title: 'Chezmoi: Manage Your Dotfiles Across Multiple Linux Systems' url: https://linuxtldr.com/installing-chezmoi/ +- date: '2024-04-27' + version: 2.48.0 + lang: CN + title: '使用 chezmoi & vscode, 管理你的 dotfiles' + url: https://juejin.cn/post/7362028633425608754
docs
Add link to article
5bb87f1df63eda772224dccbf7f136d31d846a82
2024-02-28 23:46:00
Zxhir
fix: a grammar mistake
false
diff --git a/assets/chezmoi.io/docs/user-guide/include-files-from-elsewhere.md b/assets/chezmoi.io/docs/user-guide/include-files-from-elsewhere.md index 8e70be39d48..21f464d9e7d 100644 --- a/assets/chezmoi.io/docs/user-guide/include-files-from-elsewhere.md +++ b/assets/chezmoi.io/docs/user-guide/include-files-from-elsewhere.md @@ -250,7 +250,7 @@ will run git with the `--recurse-submodules` flag by default. chezmoi assumes that all files and directories in its source state are in chezmoi's format, i.e. their filenames include attributes like `private_` and `run_`. Most git submodules are not in chezmoi's format and so files like -`run_test.sh` will be be interpreted by chezmoi as a `run_` script. To avoid +`run_test.sh` will be interpreted by chezmoi as a `run_` script. To avoid this problem, set the `external_` attribute on all subdirectories that contain submodules.
fix
a grammar mistake
ab1b31ce5232296762a7cc25f8ee50cbffe45a55
2024-12-07 22:55:46
Tom Payne
docs: Add link to blog
false
diff --git a/assets/chezmoi.io/docs/links/articles.md.yaml b/assets/chezmoi.io/docs/links/articles.md.yaml index 15b3d0343ba..a5f176b5d9f 100644 --- a/assets/chezmoi.io/docs/links/articles.md.yaml +++ b/assets/chezmoi.io/docs/links/articles.md.yaml @@ -467,3 +467,8 @@ articles: lang: AR title: شيموا (chezmoi) ببساطة url: https://github.com/mohamedhany01/chezmoi-tutorial-arabic +- date: '2024-12-02' + version: 2.55.0 + lang: JP + title: 'chezmoiを使ったローカル環境爆速構築' + url: https://qiita.com/cb400sp2/items/c04ec9472455d9022532
docs
Add link to blog
554ff274a23693db911e8fac6292a005d0dfecca
2024-10-26 19:54:19
Ruslan Sayfutdinov
docs: Replace common flags descriptions with snippets
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 77b2746b6fe..8588ddccdae 100644 --- a/assets/chezmoi.io/docs/reference/command-line-flags/common.md +++ b/assets/chezmoi.io/docs/reference/command-line-flags/common.md @@ -10,7 +10,7 @@ The following flags apply to multiple commands where they are relevant. ### `-f`, `--format` `json`|`yaml` -Set the output format. +--8<-- "common-flags/format.md" ### `-h`, `--help` @@ -22,31 +22,23 @@ Print help. ### `--init` -Regenerate and reread the config file from the config file template before -computing the target state. +--8<-- "common-flags/init.md" ### `-P`, `--parent-dirs` -Also perform command on all parent directories of *target*. +--8<-- "common-flags/parent-dirs.md" ### `-p`, `--path-style` *style* -Print paths in the given style. The default is `relative`. - -| Style | Description | -| ----------------- | ------------------------------------------- | -| `absolute` | Absolute paths in the destination directory | -| `relative` | Relative paths to the destination directory | -| `source-absolute` | Absolute paths in the source tree directory | -| `source-relative` | Relative paths to the source tree directory | +--8<-- "common-flags/path-style.md:all" ### `-r`, `--recursive` -Recurse into subdirectories, `true` by default. +--8<-- "common-flags/recursive.md:default-false" ### `--tree` -Print paths as a tree instead of a list. +--8<-- "common-flags/tree.md" ## Available entry types diff --git a/assets/chezmoi.io/docs/reference/commands/add.md b/assets/chezmoi.io/docs/reference/commands/add.md index d221fd391d5..cf1fabb8f05 100644 --- a/assets/chezmoi.io/docs/reference/commands/add.md +++ b/assets/chezmoi.io/docs/reference/commands/add.md @@ -82,7 +82,7 @@ overwritten. ### `-r`, `--recursive` -Recurse into subdirectories, `true` by default. Can be disabled with `--recursive=false`. +--8<-- "common-flags/recursive.md:default-true" ## Examples diff --git a/assets/chezmoi.io/docs/reference/commands/apply.md b/assets/chezmoi.io/docs/reference/commands/apply.md index 6e6af40cb57..5d64e3b448c 100644 --- a/assets/chezmoi.io/docs/reference/commands/apply.md +++ b/assets/chezmoi.io/docs/reference/commands/apply.md @@ -17,15 +17,15 @@ they want to overwrite the file. ### `--init` -Recreate config file from template. +--8<-- "common-flags/init.md" ### `-P`, `--parent-dirs` -Also perform command on all parent directories of *target*. +--8<-- "common-flags/parent-dirs.md" ### `-r`, `--recursive` -Recurse into subdirectories, `true` by default. Can be disabled with `--recursive=false`. +--8<-- "common-flags/recursive.md:default-true" ### `--source-path` diff --git a/assets/chezmoi.io/docs/reference/commands/archive.md b/assets/chezmoi.io/docs/reference/commands/archive.md index 6601564af3a..586978b2e2b 100644 --- a/assets/chezmoi.io/docs/reference/commands/archive.md +++ b/assets/chezmoi.io/docs/reference/commands/archive.md @@ -39,15 +39,15 @@ Compress the archive with gzip. This is automatically set if the format is ### `--init` -Recreate config file from template. +--8<-- "common-flags/init.md" ### `-P`, `--parent-dirs` -Also perform command on all parent directories of *target*. +--8<-- "common-flags/parent-dirs.md" ### `-r`, `--recursive` -Recurse into subdirectories, `true` by default. Can be disabled with `--recursive=false`. +--8<-- "common-flags/recursive.md:default-true" ## Examples diff --git a/assets/chezmoi.io/docs/reference/commands/chattr.md b/assets/chezmoi.io/docs/reference/commands/chattr.md index 88284965b94..26c9624f3c0 100644 --- a/assets/chezmoi.io/docs/reference/commands/chattr.md +++ b/assets/chezmoi.io/docs/reference/commands/chattr.md @@ -43,7 +43,7 @@ prevent chezmoi from interpreting `-`*modifier* as an option. ### `-r`, `--recursive` -Recurse into subdirectories. +--8<-- "common-flags/recursive.md:default-false" ## Examples diff --git a/assets/chezmoi.io/docs/reference/commands/data.md b/assets/chezmoi.io/docs/reference/commands/data.md index 15279fd4c28..a3f9d3251ad 100644 --- a/assets/chezmoi.io/docs/reference/commands/data.md +++ b/assets/chezmoi.io/docs/reference/commands/data.md @@ -6,7 +6,7 @@ Write the computed template data to stdout. ### `-f`, `--format` `json`|`yaml` -Set the output format, `json` by default. +--8<-- "common-flags/format.md" ## Examples diff --git a/assets/chezmoi.io/docs/reference/commands/destroy.md b/assets/chezmoi.io/docs/reference/commands/destroy.md index 9127170c98a..664313b48a4 100644 --- a/assets/chezmoi.io/docs/reference/commands/destroy.md +++ b/assets/chezmoi.io/docs/reference/commands/destroy.md @@ -20,4 +20,4 @@ Destroy without prompting. ### `-r`, `--recursive` -Recurse into subdirectories. +--8<-- "common-flags/recursive.md:default-false" diff --git a/assets/chezmoi.io/docs/reference/commands/diff.md b/assets/chezmoi.io/docs/reference/commands/diff.md index 0445e373835..b8ce4675aac 100644 --- a/assets/chezmoi.io/docs/reference/commands/diff.md +++ b/assets/chezmoi.io/docs/reference/commands/diff.md @@ -46,15 +46,15 @@ Show script contents, defaults to `true`. ### `--init` -Recreate config file from template. +--8<-- "common-flags/init.md" ### `-P`, `--parent-dirs` -Also perform command on all parent directories of *target*. +--8<-- "common-flags/parent-dirs.md" ### `-r`, `--recursive` -Recurse into subdirectories. +--8<-- "common-flags/recursive.md:default-false" ## Examples diff --git a/assets/chezmoi.io/docs/reference/commands/dump-config.md b/assets/chezmoi.io/docs/reference/commands/dump-config.md index 880deeeb5c3..833b3ffda69 100644 --- a/assets/chezmoi.io/docs/reference/commands/dump-config.md +++ b/assets/chezmoi.io/docs/reference/commands/dump-config.md @@ -6,7 +6,7 @@ Dump the configuration. ### `-f`, `--format` `json`|`yaml` -Set the output format, `json` by default. +--8<-- "common-flags/format.md" ## Examples diff --git a/assets/chezmoi.io/docs/reference/commands/dump.md b/assets/chezmoi.io/docs/reference/commands/dump.md index ba66f6ef2c2..b62aee13a11 100644 --- a/assets/chezmoi.io/docs/reference/commands/dump.md +++ b/assets/chezmoi.io/docs/reference/commands/dump.md @@ -11,7 +11,7 @@ entire target state. ### `-f`, `--format` `json`|`yaml` -Set the output format, default to `json`. +--8<-- "common-flags/format.md" ### `-i`, `--include` *types* @@ -19,15 +19,15 @@ Set the output format, default to `json`. ### `--init` -Recreate config file from template. +--8<-- "common-flags/init.md" ### `-P`, `--parent-dirs` -Also perform command on all parent directories of *target*. +--8<-- "common-flags/parent-dirs.md" ### `-r`, `--recursive` -Recurse into subdirectories, `true` by default. Can be disabled with `--recursive=false`. +--8<-- "common-flags/recursive.md:default-true" ## Examples diff --git a/assets/chezmoi.io/docs/reference/commands/edit.md b/assets/chezmoi.io/docs/reference/commands/edit.md index 187d4cdf1ba..1079507b8a4 100644 --- a/assets/chezmoi.io/docs/reference/commands/edit.md +++ b/assets/chezmoi.io/docs/reference/commands/edit.md @@ -54,7 +54,7 @@ Automatically apply changes when files are saved, with the following limitations ### `--init` -Recreate config file from template. +--8<-- "common-flags/init.md" ## Examples diff --git a/assets/chezmoi.io/docs/reference/commands/ignored.md b/assets/chezmoi.io/docs/reference/commands/ignored.md index a9128d491c8..aca5b0d60c2 100644 --- a/assets/chezmoi.io/docs/reference/commands/ignored.md +++ b/assets/chezmoi.io/docs/reference/commands/ignored.md @@ -6,7 +6,7 @@ Print the list of entries ignored by chezmoi. ### `-t`, `--tree` -Print paths as a tree. +--8<-- "common-flags/tree.md" ## Examples diff --git a/assets/chezmoi.io/docs/reference/commands/managed.md b/assets/chezmoi.io/docs/reference/commands/managed.md index 79bb96bd063..b57f5ad907a 100644 --- a/assets/chezmoi.io/docs/reference/commands/managed.md +++ b/assets/chezmoi.io/docs/reference/commands/managed.md @@ -14,14 +14,13 @@ the destination directory in alphabetical order. --8<-- "common-flags/include.md" -### `-p`, `--path-style` `absolute`|`relative`|`source-absolute`|`source-relative` +### `-p`, `--path-style` *style* -Print paths in the given style. Relative paths are relative to the destination -directory. The default is `relative`. +--8<-- "common-flags/path-style.md:all" ### `-t`, `--tree` -Print paths as a tree. +--8<-- "common-flags/tree.md" ## Examples diff --git a/assets/chezmoi.io/docs/reference/commands/merge-all.md b/assets/chezmoi.io/docs/reference/commands/merge-all.md index ebafd210b40..1321da736e2 100644 --- a/assets/chezmoi.io/docs/reference/commands/merge-all.md +++ b/assets/chezmoi.io/docs/reference/commands/merge-all.md @@ -7,11 +7,11 @@ state. The merge is performed with `chezmoi merge`. ### `--init` -Recreate config file from template. +--8<-- "common-flags/init.md" ### `-r`, `--recursive` -Recurse into subdirectories, `true` by default. Can be disabled with `--recursive=false`. +--8<-- "common-flags/recursive.md:default-true" ## Examples diff --git a/assets/chezmoi.io/docs/reference/commands/re-add.md b/assets/chezmoi.io/docs/reference/commands/re-add.md index 703143c31b3..b726ddee9f4 100644 --- a/assets/chezmoi.io/docs/reference/commands/re-add.md +++ b/assets/chezmoi.io/docs/reference/commands/re-add.md @@ -19,7 +19,7 @@ more *target*s are given then only those targets are re-added. ### `-r`, `--recursive` -Recursively add files in subdirectories, `true` by default. Can be disabled with `--recursive=false`. +--8<-- "common-flags/recursive.md:default-true" ## Examples diff --git a/assets/chezmoi.io/docs/reference/commands/status.md b/assets/chezmoi.io/docs/reference/commands/status.md index 9566aa60d29..a467cdb4c4d 100644 --- a/assets/chezmoi.io/docs/reference/commands/status.md +++ b/assets/chezmoi.io/docs/reference/commands/status.md @@ -28,20 +28,19 @@ running [`chezmoi apply`](apply.md) will have. ### `--init` -Recreate config file from template. +--8<-- "common-flags/init.md" ### `-P`, `--parent-dirs` -Also perform command on all parent directories of *target*. +--8<-- "common-flags/parent-dirs.md" -### `-p`, `--path-style` `absolute`|`relative`|`source-absolute`|`source-relative` +### `-p`, `--path-style` *style* -Print paths in the given style. Relative paths are relative to the destination -directory. The default is `relative`. +--8<-- "common-flags/path-style.md:all" ### `-r`, `--recursive` -Recurse into subdirectories, `true` by default. Can be disabled with `--recursive=false`. +--8<-- "common-flags/recursive.md:default-true" ## Examples diff --git a/assets/chezmoi.io/docs/reference/commands/unmanaged.md b/assets/chezmoi.io/docs/reference/commands/unmanaged.md index 5b9e1ee28fc..02fbd89a3b8 100644 --- a/assets/chezmoi.io/docs/reference/commands/unmanaged.md +++ b/assets/chezmoi.io/docs/reference/commands/unmanaged.md @@ -7,14 +7,13 @@ It is an error to supply *path*s that are not found on the filesystem. ## Common flags -### `-p`, `--path-style` `absolute`|`relative`|`source-absolute`|`source-relative` +### `-p`, `--path-style` *style* -Print paths in the given style. Relative paths are relative to the destination -directory. The default is `relative`. +--8<-- "common-flags/path-style.md:no-source-tree" ### `-t`, `--tree` -Print paths as a tree. +--8<-- "common-flags/tree.md" ## Examples diff --git a/assets/chezmoi.io/docs/reference/commands/update.md b/assets/chezmoi.io/docs/reference/commands/update.md index 258f1bec99e..a5aae6588ce 100644 --- a/assets/chezmoi.io/docs/reference/commands/update.md +++ b/assets/chezmoi.io/docs/reference/commands/update.md @@ -29,15 +29,15 @@ Update submodules recursively. This defaults to `true`. Can be disabled with `-- ### `--init` -Recreate config file from template. +--8<-- "common-flags/init.md" ### `-P`, `--parent-dirs` -Also perform command on all parent directories of *target*. +--8<-- "common-flags/parent-dirs.md" ### `-r`, `--recursive` -Recurse into subdirectories, `true` by default. Can be disabled with `--recursive=false`. +--8<-- "common-flags/recursive.md:default-true" ## Examples diff --git a/assets/chezmoi.io/docs/reference/commands/verify.md b/assets/chezmoi.io/docs/reference/commands/verify.md index a5b319e6e82..cc0c97317b5 100644 --- a/assets/chezmoi.io/docs/reference/commands/verify.md +++ b/assets/chezmoi.io/docs/reference/commands/verify.md @@ -16,15 +16,15 @@ no targets are specified then all targets are checked. ### `--init` -Recreate config file from template. +--8<-- "common-flags/init.md" ### `-P`, `--parent-dirs` -Also perform command on all parent directories of *target*. +--8<-- "common-flags/parent-dirs.md" ### `-r`, `--recursive` -Recurse into subdirectories, `true` by default. Can be disabled with `--recursive=false`. +--8<-- "common-flags/recursive.md:default-true" ## Examples diff --git a/assets/chezmoi.io/snippets/common-flags/format.md b/assets/chezmoi.io/snippets/common-flags/format.md new file mode 100644 index 00000000000..c7dd1a5ce05 --- /dev/null +++ b/assets/chezmoi.io/snippets/common-flags/format.md @@ -0,0 +1 @@ +Set the output format, `json` by default. diff --git a/assets/chezmoi.io/snippets/common-flags/init.md b/assets/chezmoi.io/snippets/common-flags/init.md new file mode 100644 index 00000000000..f2bdc824d80 --- /dev/null +++ b/assets/chezmoi.io/snippets/common-flags/init.md @@ -0,0 +1,2 @@ +Regenerate and reload the config file from its template before computing +the target state. diff --git a/assets/chezmoi.io/snippets/common-flags/parent-dirs.md b/assets/chezmoi.io/snippets/common-flags/parent-dirs.md new file mode 100644 index 00000000000..057e177a6dd --- /dev/null +++ b/assets/chezmoi.io/snippets/common-flags/parent-dirs.md @@ -0,0 +1 @@ +Execute the command on *target* and all its parent directories. diff --git a/assets/chezmoi.io/snippets/common-flags/path-style.md b/assets/chezmoi.io/snippets/common-flags/path-style.md new file mode 100644 index 00000000000..8ccd52380e9 --- /dev/null +++ b/assets/chezmoi.io/snippets/common-flags/path-style.md @@ -0,0 +1,12 @@ +--8<-- [start:all] +--8<-- [start:no-source-tree] +Print paths in the given style. The default is `relative`. + +| Style | Description | +| ----------------- | ------------------------------------------- | +| `absolute` | Absolute paths in the destination directory | +| `relative` | Relative paths to the destination directory | +--8<-- [end:no-source-tree] +| `source-absolute` | Absolute paths in the source tree directory | +| `source-relative` | Relative paths to the source tree directory | +--8<-- [end:all] diff --git a/assets/chezmoi.io/snippets/common-flags/recursive.md b/assets/chezmoi.io/snippets/common-flags/recursive.md new file mode 100644 index 00000000000..e2f5902fc47 --- /dev/null +++ b/assets/chezmoi.io/snippets/common-flags/recursive.md @@ -0,0 +1,6 @@ +--8<-- [start:default-true] +--8<-- [start:default-false] +Recurse into subdirectories. +--8<-- [end:default-false] +Enabled by default. Can be disabled with `--recursive=false`. +--8<-- [end:default-true] diff --git a/assets/chezmoi.io/snippets/common-flags/tree.md b/assets/chezmoi.io/snippets/common-flags/tree.md new file mode 100644 index 00000000000..c9acbd56c65 --- /dev/null +++ b/assets/chezmoi.io/snippets/common-flags/tree.md @@ -0,0 +1 @@ +Print paths as a tree instead of a list.
docs
Replace common flags descriptions with snippets
908f7fba831405bf48671c2c37a022aeb6e18e74
2023-06-29 18:01:59
Ben Woodward
docs: Remove reference to tar and /dev/stdin so code works on Windows
false
diff --git a/assets/chezmoi.io/docs/user-guide/include-files-from-elsewhere.md b/assets/chezmoi.io/docs/user-guide/include-files-from-elsewhere.md index a0da9cbc6c3..e5fc2a1e652 100644 --- a/assets/chezmoi.io/docs/user-guide/include-files-from-elsewhere.md +++ b/assets/chezmoi.io/docs/user-guide/include-files-from-elsewhere.md @@ -124,8 +124,7 @@ and `$ENTRY.filter.args` variables in `.chezmoiexternal.$FORMAT`, for example: executable = true refreshPeriod = "168h" [".local/bin/age".filter] - command = "tar" - args = ["--extract", "--file", "/dev/stdin", "--gzip", "--to-stdout", "age/age"] + args = ["--extract", "--gzip", "--to-stdout", "age/age"] ``` This will extract the single archive member `age/age` from the given URL (which
docs
Remove reference to tar and /dev/stdin so code works on Windows
90068f06cf8b523e407efca35d7bdb2524724172
2022-07-20 01:16:06
Tom Payne
chore: Update dependencies
false
diff --git a/go.mod b/go.mod index 10c3592199d..90b10e3a406 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/rogpeppe/go-internal v1.8.1 github.com/rs/zerolog v1.27.0 github.com/sergi/go-diff v1.1.0 - github.com/spf13/afero v1.9.0 + github.com/spf13/afero v1.9.2 github.com/spf13/cobra v1.5.0 github.com/spf13/viper v1.12.0 github.com/stretchr/testify v1.8.0 @@ -35,7 +35,7 @@ require ( github.com/zalando/go-keyring v0.2.1 go.etcd.io/bbolt v1.3.6 go.uber.org/multierr v1.8.0 - golang.org/x/oauth2 v0.0.0-20220630143837-2104d58473e0 + golang.org/x/oauth2 v0.0.0-20220718184931-c8730f7fcb92 golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 @@ -65,7 +65,7 @@ require ( github.com/bradenhilton/cityhash v1.0.0 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/dlclark/regexp2 v1.4.0 // indirect + github.com/dlclark/regexp2 v1.7.0 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/go-git/gcfg v1.5.0 // indirect diff --git a/go.sum b/go.sum index 0242eff4244..666b6efd528 100644 --- a/go.sum +++ b/go.sum @@ -196,6 +196,8 @@ 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 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E= github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= +github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= @@ -606,6 +608,8 @@ github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/afero v1.9.0 h1:sFSLUHgxdnN32Qy38hK3QkYBFXZj9DKjVjCUCtD7juY= github.com/spf13/afero v1.9.0/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= +github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw= +github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= 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= @@ -835,6 +839,8 @@ golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= golang.org/x/oauth2 v0.0.0-20220630143837-2104d58473e0 h1:VnGaRqoLmqZH/3TMLJwYCEWkR4j1nuIU1U9TvbqsDUw= golang.org/x/oauth2 v0.0.0-20220630143837-2104d58473e0/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.0.0-20220718184931-c8730f7fcb92 h1:oVlhw3Oe+1reYsE2Nqu19PDJfLzwdU3QUUrG86rLK68= +golang.org/x/oauth2 v0.0.0-20220718184931-c8730f7fcb92/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= 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=
chore
Update dependencies
e82aa013a090401f08ce7db64e03c7ed78fcc53d
2022-02-23 02:48:30
Tom Payne
chore: Stop tests failing when GitHub rate limits are exceeded
false
diff --git a/pkg/cmd/doctorcmd.go b/pkg/cmd/doctorcmd.go index 21e6f3613ea..c0d400f78bb 100644 --- a/pkg/cmd/doctorcmd.go +++ b/pkg/cmd/doctorcmd.go @@ -16,6 +16,7 @@ import ( "text/tabwriter" "github.com/coreos/go-semver/semver" + "github.com/google/go-github/v42/github" "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/twpayne/go-shell" @@ -29,12 +30,12 @@ import ( type checkResult int const ( + checkResultFailed checkResult = -2 // The check could not be completed. checkResultSkipped checkResult = -1 // The check was skipped. checkResultOK checkResult = 0 // The check completed and did not find any problems. checkResultInfo checkResult = 1 // The check completed and found something interesting, but not a problem. checkResultWarning checkResult = 2 // The check completed and found something that might indicate a problem. checkResultError checkResult = 3 // The check completed and found a definite problem. - checkResultFailed checkResult = 4 // The check could not be completed. ) // A check is an individual check. @@ -44,12 +45,12 @@ type check interface { } var checkResultStr = map[checkResult]string{ + checkResultFailed: "failed", checkResultSkipped: "skipped", checkResultOK: "ok", checkResultInfo: "info", checkResultWarning: "warning", checkResultError: "error", - checkResultFailed: "failed", } // An argsCheck checks that arguments for a binary. @@ -534,15 +535,24 @@ func (c *latestVersionCheck) Name() string { func (c *latestVersionCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (checkResult, string) { if c.httpClientErr != nil { - return checkResultError, c.httpClientErr.Error() + return checkResultFailed, c.httpClientErr.Error() } ctx := context.Background() gitHubClient := chezmoi.NewGitHubClient(ctx, c.httpClient) rr, _, err := gitHubClient.Repositories.GetLatestRelease(ctx, c.owner, c.repo) - if err != nil { - return checkResultError, err.Error() + var rateLimitErr *github.RateLimitError + var abuseRateLimitErr *github.AbuseRateLimitError + switch { + case err == nil: + // Do nothing. + case errors.As(err, &rateLimitErr): + return checkResultFailed, "GitHub rate limit exceeded" + case errors.As(err, &abuseRateLimitErr): + return checkResultFailed, "GitHub abuse rate limit exceeded" + default: + return checkResultFailed, err.Error() } version, err := semver.NewVersion(strings.TrimPrefix(rr.GetName(), "v"))
chore
Stop tests failing when GitHub rate limits are exceeded
461b175d1bb70657c249194bc95452ca82fc16d9
2023-02-21 15:45:02
Tom Payne
docs: Tidy up tables
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 de6d5767577..c928dc2b3de 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 @@ -22,16 +22,12 @@ Entries may have the following fields: | Variable | Type | Default value | Description | | ----------------- | -------- | ------------- | ------------------------------------------------------------- | | `type` | string | *none* | External type (`file`, `archive`, or `git-repo`) | -| `clone.args` | []string | *none* | Extra args to `git clone` | | `encrypted` | bool | `false` | Whether the external is encrypted | | `exact` | bool | `false` | Add `exact_` attribute to directories in archive | | `exclude` | []string | *none* | Patterns to exclude from archive | | `executable` | bool | `false` | Add `executable_` attribute to file | -| `filter.command` | string | *none* | Command to filter contents | -| `filter.args` | []string | *none* | Extra args to command to filter contents | | `format` | string | *autodetect* | Format of archive | | `include` | []string | *none* | Patterns to include from archive | -| `pull.args` | []string | *none* | Extra args to `git pull` | | `refreshPeriod` | duration | `0` | Refresh period | | `stripComponents` | int | `0` | Number of leading directory components to strip from archives | | `url` | string | *none* | URL | @@ -39,6 +35,10 @@ Entries may have the following fields: | `checksum.sha384` | string | *none* | Expected SHA384 checksum of data | | `checksum.sha512` | string | *none* | Expected SHA512 checksum of data | | `checksum.size` | int | *none* | Expected size of data | +| `clone.args` | []string | *none* | Extra args to `git clone` | +| `filter.command` | string | *none* | Command to filter contents | +| `filter.args` | []string | *none* | Extra args to command to filter contents | +| `pull.args` | []string | *none* | Extra args to `git pull` | If any of the optional `checksum.sha256`, `checksum.sha384`, or `checksum.sha512` fields are set, chezmoi will verify that the downloaded data diff --git a/assets/chezmoi.io/docs/reference/templates/directives.md b/assets/chezmoi.io/docs/reference/templates/directives.md index 4d17eed20a6..5596424078a 100644 --- a/assets/chezmoi.io/docs/reference/templates/directives.md +++ b/assets/chezmoi.io/docs/reference/templates/directives.md @@ -48,11 +48,11 @@ with a template directive: `$VALUE` can be an arbitrary string or one of: -| Value | Effect | -| -------- | --------------------------------------------------------------------- | -| `crlf` | Use Windows line endings (`\r\n`). | -| `lf` | Use UNIX-style line endings (`\n`). | -| `native` | Use platform-native line endings (`crlf` on Windows, `lf` elsewhere). | +| Value | Effect | +| -------- | -------------------------------------------------------------------- | +| `crlf` | Use Windows line endings (`\r\n`) | +| `lf` | Use UNIX-style line endings (`\n`) | +| `native` | Use platform-native line endings (`crlf` on Windows, `lf` elsewhere) | ## Missing keys @@ -64,8 +64,8 @@ that is not present in the map. This behavior can be changed globally with the `$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. | +| 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 |
docs
Tidy up tables
8b2a4352e2f92efd683aab409bf55db348ebc57b
2024-04-02 17:11:24
Tom Payne
docs: Add install.doctor 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 cf251306ff7..5973c26be51 100644 --- a/assets/chezmoi.io/docs/links/related-software.md +++ b/assets/chezmoi.io/docs/links/related-software.md @@ -43,3 +43,7 @@ colorscheme switching using chezmoi templates. An add-on to deal with config files that contain a mix of settings and transient state, such as with GUI program settings files also containing recently used files and window positions. + +### [`install.doctor`](https://install.doctor) + +Desktop provisioning system.
docs
Add install.doctor to related software
4dff1c557eb9d564f1c598567c71b81674199817
2024-12-29 17:28:55
Tom Payne
chore: Refactor template options
false
diff --git a/internal/chezmoi/sourcestate.go b/internal/chezmoi/sourcestate.go index b3ebd31c798..6e971f8a6e1 100644 --- a/internal/chezmoi/sourcestate.go +++ b/internal/chezmoi/sourcestate.go @@ -798,9 +798,10 @@ type ExecuteTemplateDataOptions struct { // ExecuteTemplateData returns the result of executing template data. func (s *SourceState) ExecuteTemplateData(options ExecuteTemplateDataOptions) ([]byte, error) { templateOptions := options.TemplateOptions + templateOptions.Funcs = s.templateFuncs templateOptions.Options = slices.Clone(s.templateOptions) - tmpl, err := ParseTemplate(options.Name, options.Data, s.templateFuncs, templateOptions) + tmpl, err := ParseTemplate(options.Name, options.Data, templateOptions) if err != nil { return nil, err } @@ -1529,7 +1530,8 @@ func (s *SourceState) addTemplatesDir(ctx context.Context, templatesDirAbsPath A templateRelPath := templateAbsPath.MustTrimDirPrefix(templatesDirAbsPath) name := templateRelPath.String() - tmpl, err := ParseTemplate(name, contents, s.templateFuncs, TemplateOptions{ + tmpl, err := ParseTemplate(name, contents, TemplateOptions{ + Funcs: s.templateFuncs, Options: slices.Clone(s.templateOptions), }) if err != nil { @@ -1955,14 +1957,10 @@ func (s *SourceState) newModifyTargetStateEntryFunc( sourceFile := sourceRelPath.String() templateContents := removeMatches(modifierContents, matches) var tmpl *Template - tmpl, err = ParseTemplate( - sourceFile, - templateContents, - s.templateFuncs, - TemplateOptions{ - Options: slices.Clone(s.templateOptions), - }, - ) + tmpl, err = ParseTemplate(sourceFile, templateContents, TemplateOptions{ + Funcs: s.templateFuncs, + Options: slices.Clone(s.templateOptions), + }) if err != nil { return } diff --git a/internal/chezmoi/template.go b/internal/chezmoi/template.go index a13a5cb086b..325df2dd6a7 100644 --- a/internal/chezmoi/template.go +++ b/internal/chezmoi/template.go @@ -17,6 +17,7 @@ type Template struct { // TemplateOptions are template options that can be set with directives. type TemplateOptions struct { + Funcs template.FuncMap LeftDelimiter string LineEnding string RightDelimiter string @@ -25,12 +26,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, options TemplateOptions) (*Template, error) { contents := options.parseAndRemoveDirectives(data) tmpl, err := template.New(name). Option(options.Options...). Delims(options.LeftDelimiter, options.RightDelimiter). - Funcs(funcs). + Funcs(options.Funcs). Parse(string(contents)) if err != nil { return nil, err diff --git a/internal/chezmoi/template_test.go b/internal/chezmoi/template_test.go index ca1c15cdc61..b3fce4efc4d 100644 --- a/internal/chezmoi/template_test.go +++ b/internal/chezmoi/template_test.go @@ -65,7 +65,7 @@ func TestTemplateParseAndExecute(t *testing.T) { }, } { t.Run(tc.name, func(t *testing.T) { - tmpl, err := ParseTemplate(tc.name, []byte(tc.dataStr), nil, TemplateOptions{}) + tmpl, err := ParseTemplate(tc.name, []byte(tc.dataStr), TemplateOptions{}) assert.NoError(t, err) actual, err := tmpl.Execute(nil) assert.NoError(t, err) diff --git a/internal/cmd/config.go b/internal/cmd/config.go index 9c3a6a0744d..d54d0779767 100644 --- a/internal/cmd/config.go +++ b/internal/cmd/config.go @@ -873,7 +873,8 @@ func (c *Config) createConfigFile(filename chezmoi.RelPath, data []byte, cmd *co } chezmoi.RecursiveMerge(c.templateFuncs, initTemplateFuncs) - tmpl, err := chezmoi.ParseTemplate(filename.String(), data, c.templateFuncs, chezmoi.TemplateOptions{ + tmpl, err := chezmoi.ParseTemplate(filename.String(), data, chezmoi.TemplateOptions{ + Funcs: c.templateFuncs, Options: slices.Clone(c.Template.Options), }) if err != nil { @@ -1594,8 +1595,8 @@ func (c *Config) gitAutoPush(status *chezmoigit.Status) error { // gitCommitMessage returns the git commit message for the given status. func (c *Config) gitCommitMessage(cmd *cobra.Command, status *chezmoigit.Status) ([]byte, error) { - funcMap := maps.Clone(c.templateFuncs) - maps.Copy(funcMap, map[string]any{ + templateFuncs := maps.Clone(c.templateFuncs) + maps.Copy(templateFuncs, map[string]any{ "promptBool": c.promptBoolInteractiveTemplateFunc, "promptChoice": c.promptChoiceInteractiveTemplateFunc, "promptInt": c.promptIntInteractiveTemplateFunc, @@ -1625,7 +1626,8 @@ func (c *Config) gitCommitMessage(cmd *cobra.Command, status *chezmoigit.Status) name = "COMMIT_MESSAGE" commitMessageTemplateData = []byte(templates.CommitMessageTmpl) } - commitMessageTmpl, err := chezmoi.ParseTemplate(name, commitMessageTemplateData, funcMap, chezmoi.TemplateOptions{ + commitMessageTmpl, err := chezmoi.ParseTemplate(name, commitMessageTemplateData, chezmoi.TemplateOptions{ + Funcs: templateFuncs, Options: slices.Clone(c.Template.Options), }) if err != nil { diff --git a/internal/cmd/templatefuncs.go b/internal/cmd/templatefuncs.go index 1e838a588e7..901633ac4b0 100644 --- a/internal/cmd/templatefuncs.go +++ b/internal/cmd/templatefuncs.go @@ -237,10 +237,10 @@ func (c *Config) includeTemplateTemplateFunc(filename string, args ...any) strin } contents := mustValue(c.readFile(filename, searchDirAbsPaths)) - templateOptions := chezmoi.TemplateOptions{ + tmpl := mustValue(chezmoi.ParseTemplate(filename, contents, chezmoi.TemplateOptions{ + Funcs: c.templateFuncs, Options: slices.Clone(c.Template.Options), - } - tmpl := mustValue(chezmoi.ParseTemplate(filename, contents, c.templateFuncs, templateOptions)) + })) return string(mustValue(tmpl.Execute(data))) }
chore
Refactor template options
2ff17eb12f9612b69c87813ac5ed29306b75d651
2024-08-01 16:10:49
dependabot[bot]
chore(deps): bump the python group in /assets with 2 updates
false
diff --git a/assets/chezmoi.io/requirements.txt b/assets/chezmoi.io/requirements.txt index d0e21ed2c95..dd0eaf47278 100644 --- a/assets/chezmoi.io/requirements.txt +++ b/assets/chezmoi.io/requirements.txt @@ -1,3 +1,3 @@ mkdocs==1.6.0 -mkdocs-material==9.5.27 +mkdocs-material==9.5.30 mkdocs-mermaid2-plugin==1.1.1 diff --git a/assets/requirements.dev.txt b/assets/requirements.dev.txt index 38ed49bd376..39cf1758cba 100644 --- a/assets/requirements.dev.txt +++ b/assets/requirements.dev.txt @@ -1 +1 @@ -ruff==0.5.0 +ruff==0.5.5
chore
bump the python group in /assets with 2 updates
44814515eb8034b4d153569db86e58e278148e05
2023-07-19 13:32:28
Tom Payne
chore: Pass WinGet GitHub Token to release job
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 935ef6d0eee..bd3fcfedfc4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -422,6 +422,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} SCOOP_GITHUB_TOKEN: ${{ secrets.SCOOP_GITHUB_TOKEN }} SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} + WINGET_GITHUB_TOKEN: ${{ secrets.WINGET_GITHUB_TOKEN }} deploy-website: needs: - release
chore
Pass WinGet GitHub Token to release job
86a20857120da6a20346a33f58844718ad83ab12
2022-05-31 01:58:49
Tom Payne
chore: Tweak coverage target
false
diff --git a/Makefile b/Makefile index bdc8308cf29..ad787c33c40 100644 --- a/Makefile +++ b/Makefile @@ -98,7 +98,7 @@ coverage-html: coverage .PHONY: coverage coverage: - ${GO} test -coverprofile=coverage.out -coverpkg=./... ./... + ${GO} test -coverprofile=coverage.out -coverpkg=github.com/twpayne/chezmoi/... ./... .PHONY: generate generate:
chore
Tweak coverage target
5fb95095669af8e2a3fe063ffa63fa4599eba305
2024-05-31 05:52:21
Tom Payne
chore: Update dependencies
false
diff --git a/go.mod b/go.mod index 0cf8dd2e68c..a34529295ae 100644 --- a/go.mod +++ b/go.mod @@ -10,15 +10,15 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.1.0 github.com/Masterminds/sprig/v3 v3.2.3 github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 - github.com/Shopify/ejson v1.5.1 - github.com/alecthomas/assert/v2 v2.9.0 + github.com/Shopify/ejson v1.5.2 + github.com/alecthomas/assert/v2 v2.10.0 github.com/aws/aws-sdk-go-v2 v1.27.0 github.com/aws/aws-sdk-go-v2/config v1.27.16 github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.29.1 github.com/bmatcuk/doublestar/v4 v4.6.1 github.com/bradenhilton/mozillainstallhash v1.0.1 github.com/charmbracelet/bubbles v0.18.0 - github.com/charmbracelet/bubbletea v0.26.3 + github.com/charmbracelet/bubbletea v0.26.4 github.com/charmbracelet/glamour v0.7.0 github.com/coreos/go-semver v0.3.1 github.com/fsnotify/fsnotify v1.7.0 @@ -88,7 +88,7 @@ require ( github.com/bradenhilton/cityhash v1.0.0 // indirect github.com/charmbracelet/harmonica v0.2.0 // indirect github.com/charmbracelet/lipgloss v0.11.0 // indirect - github.com/charmbracelet/x/ansi v0.1.1 // indirect + github.com/charmbracelet/x/ansi v0.1.2 // indirect github.com/charmbracelet/x/input v0.1.1 // indirect github.com/charmbracelet/x/term v0.1.1 // indirect github.com/charmbracelet/x/windows v0.1.2 // indirect @@ -152,7 +152,7 @@ require ( github.com/yuin/goldmark v1.7.1 // indirect github.com/yuin/goldmark-emoji v1.0.2 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d // indirect + golang.org/x/exp v0.0.0-20240530194437-404ba88c7ed0 // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/text v0.15.0 // indirect golang.org/x/tools v0.21.0 // indirect diff --git a/go.sum b/go.sum index 228d9b189c3..bc1f235d9e6 100644 --- a/go.sum +++ b/go.sum @@ -44,10 +44,10 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78= github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= -github.com/Shopify/ejson v1.5.1 h1:LVphADjSUMao+VPux/2GE5CYVW9U30/XLmStmjKXCQI= -github.com/Shopify/ejson v1.5.1/go.mod h1:bVvQ3MaBCfMOkIp1rWZcot3TruYXCc7qUUbI1tjs/YM= -github.com/alecthomas/assert/v2 v2.9.0 h1:ZcLG8ccMEtlMLkLW4gwGpBWBb0N8MUCmsy1lYBVd1xQ= -github.com/alecthomas/assert/v2 v2.9.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= +github.com/Shopify/ejson v1.5.2 h1:sXUlmNd5MFHfxIvchQqkbksYmKmHb05coSYhMpWpUNs= +github.com/Shopify/ejson v1.5.2/go.mod h1:bVvQ3MaBCfMOkIp1rWZcot3TruYXCc7qUUbI1tjs/YM= +github.com/alecthomas/assert/v2 v2.10.0 h1:jjRCHsj6hBJhkmhznrCzoNpbA3zqy0fYiUcYZP/GkPY= +github.com/alecthomas/assert/v2 v2.10.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= github.com/alecthomas/chroma/v2 v2.14.0 h1:R3+wzpnUArGcQz7fCETQBzO5n9IMNi13iIs46aU4V9E= github.com/alecthomas/chroma/v2 v2.14.0/go.mod h1:QolEbTfmUHIMVpBqxeDnNBj2uoeI4EbYP4i6n68SG4I= github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= @@ -104,16 +104,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.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/39KLfy0= github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw= -github.com/charmbracelet/bubbletea v0.26.3 h1:iXyGvI+FfOWqkB2V07m1DF3xxQijxjY2j8PqiXYqasg= -github.com/charmbracelet/bubbletea v0.26.3/go.mod h1:bpZHfDHTYJC5g+FBK+ptJRCQotRC+Dhh3AoMxa/2+3Q= +github.com/charmbracelet/bubbletea v0.26.4 h1:2gDkkzLZaTjMl/dQBpNVtnvcCxsh/FCkimep7FC9c40= +github.com/charmbracelet/bubbletea v0.26.4/go.mod h1:P+r+RRA5qtI1DOHNFn0otoNwB4rn+zNAzSj/EXz6xU0= 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/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ= github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao= github.com/charmbracelet/lipgloss v0.11.0 h1:UoAcbQ6Qml8hDwSWs0Y1cB5TEQuZkDPH/ZqwWWYTG4g= github.com/charmbracelet/lipgloss v0.11.0/go.mod h1:1UdRTH9gYgpcdNN5oBtjbu/IzNKtzVtb7sqN1t9LNn8= -github.com/charmbracelet/x/ansi v0.1.1 h1:CGAduulr6egay/YVbGc8Hsu8deMg1xZ/bkaXTPi1JDk= -github.com/charmbracelet/x/ansi v0.1.1/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= +github.com/charmbracelet/x/ansi v0.1.2 h1:6+LR39uG8DE6zAmbu023YlqjJHkYXDF1z36ZwzO4xZY= +github.com/charmbracelet/x/ansi v0.1.2/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= github.com/charmbracelet/x/input v0.1.1 h1:YDOJaTUKCqtGnq9PHzx3pkkl4pXDOANUHmhH3DqMtM4= github.com/charmbracelet/x/input v0.1.1/go.mod h1:jvdTVUnNWj/RD6hjC4FsoB0SeZCJ2ZBkiuFP9zXvZI0= github.com/charmbracelet/x/term v0.1.1 h1:3cosVAiPOig+EV4X9U+3LDgtwwAoEzJjNdwbXDjF6yI= @@ -478,8 +478,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.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= -golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d h1:N0hmiNbwsSNwHBAvR3QB5w25pUwH4tK0Y/RltD1j1h4= -golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= +golang.org/x/exp v0.0.0-20240530194437-404ba88c7ed0 h1:Mi0bCswbz+9cXmwFAdxoo5GPFMKONUpua6iUdtQS7lk= +golang.org/x/exp v0.0.0-20240530194437-404ba88c7ed0/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
chore
Update dependencies
f543e2afd0d32fb58af12bca5d6b1c78a89d9d23
2022-10-05 19:06:48
Tom Payne
chore: Bump golangci-lint to version 1.50.0
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e52434d7579..ac5b16126e4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ env: AGE_VERSION: 1.0.0 GO_VERSION: 1.19.2 GOFUMPT_VERSION: 0.4.0 - GOLANGCI_LINT_VERSION: 1.49.0 + GOLANGCI_LINT_VERSION: 1.50.0 TPARSE_VERSION: 0.11.1 jobs: changes: diff --git a/.golangci.yml b/.golangci.yml index 05c78bc9d2b..724ebbc52f8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,6 +8,7 @@ linters: - depguard - dogsled - dupl + - dupword - durationcheck - errcheck - errchkjson @@ -34,7 +35,7 @@ linters: - interfacebloat - ireturn - lll - - logrlint + - loggercheck - makezero - misspell - nilerr @@ -49,6 +50,7 @@ linters: - staticcheck - stylecheck - tagliatelle + - testableexamples - tenv - thelper - typecheck diff --git a/pkg/chezmoi/errors.go b/pkg/chezmoi/errors.go index 792de98e836..1b459d09935 100644 --- a/pkg/chezmoi/errors.go +++ b/pkg/chezmoi/errors.go @@ -8,7 +8,7 @@ import ( "github.com/coreos/go-semver/semver" ) -// An ExitCodeError indicates the the main program should exit with the given +// An ExitCodeError indicates the main program should exit with the given // code. type ExitCodeError int diff --git a/pkg/chezmoi/externaldiffsystem.go b/pkg/chezmoi/externaldiffsystem.go index 6496f32f59f..5a5d8ab5748 100644 --- a/pkg/chezmoi/externaldiffsystem.go +++ b/pkg/chezmoi/externaldiffsystem.go @@ -269,7 +269,7 @@ func (s *ExternalDiffSystem) runDiffCommand(destAbsPath, targetAbsPath AbsPath) // option replaced all arguments to the diff command. // // Work around this by looking for any templates in diff.args. An arg is - // considered a template if, after execution as as template, it is not equal + // considered a template if, after execution as a template, it is not equal // to the original arg. anyTemplateArgs := false for i, arg := range s.args { diff --git a/pkg/cmd/config.go b/pkg/cmd/config.go index 9f8c79c6ae9..efe82a09391 100644 --- a/pkg/cmd/config.go +++ b/pkg/cmd/config.go @@ -413,7 +413,7 @@ func (c *Config) Close() error { return err } -// addTemplateFunc adds the template function with the key key and value value +// addTemplateFunc adds the template function with the given key and value // to c. It panics if there is already an existing template function with the // same key. func (c *Config) addTemplateFunc(key string, value any) { diff --git a/pkg/cmd/mergecmd.go b/pkg/cmd/mergecmd.go index 722e52578f3..2cd0ab3b986 100644 --- a/pkg/cmd/mergecmd.go +++ b/pkg/cmd/mergecmd.go @@ -144,7 +144,7 @@ func (c *Config) doMerge(targetRelPath chezmoi.RelPath, sourceStateEntry chezmoi // merge.args config option replaced all arguments to the merge command. // // Work around this by looking for any templates in merge.args. An arg - // is considered a template if, after execution as as template, it is + // is considered a template if, after execution as a template, it is // not equal to the original arg. anyTemplateArgs := false for i, arg := range c.Merge.Args { diff --git a/pkg/cmd/templatefuncs_test.go b/pkg/cmd/templatefuncs_test.go index 12268661435..10b951c6247 100644 --- a/pkg/cmd/templatefuncs_test.go +++ b/pkg/cmd/templatefuncs_test.go @@ -113,7 +113,7 @@ func TestToIniTemplateFunc(t *testing.T) { "bool": "true", "float": "1.0", "int": "1", - "string": "string string", + "string": "string string", //nolint:dupword }, expected: chezmoitest.JoinLines( `bool = "true"`, diff --git a/pkg/git/status_test.go b/pkg/git/status_test.go index 755f01fdbb7..e45afafb731 100644 --- a/pkg/git/status_test.go +++ b/pkg/git/status_test.go @@ -21,7 +21,7 @@ func TestParseStatusPorcelainV2(t *testing.T) { }, { name: "added", - outputStr: "1 A. N... 000000 100644 100644 0000000000000000000000000000000000000000 cea5c3500651a923bacd80f960dd20f04f71d509 main.go\n", + outputStr: "1 A. N... 000000 100644 100644 0000000000000000000000000000000000000000 cea5c3500651a923bacd80f960dd20f04f71d509 main.go\n", //nolint:dupword expectedStatus: &Status{ Ordinary: []OrdinaryStatus{ { @@ -40,7 +40,7 @@ func TestParseStatusPorcelainV2(t *testing.T) { }, { name: "removed", - outputStr: "1 D. N... 100644 000000 000000 cea5c3500651a923bacd80f960dd20f04f71d509 0000000000000000000000000000000000000000 main.go\n", + outputStr: "1 D. N... 100644 000000 000000 cea5c3500651a923bacd80f960dd20f04f71d509 0000000000000000000000000000000000000000 main.go\n", //nolint:dupword expectedStatus: &Status{ Ordinary: []OrdinaryStatus{ { @@ -59,7 +59,7 @@ func TestParseStatusPorcelainV2(t *testing.T) { }, { name: "update", - outputStr: "1 .M N... 100644 100644 100644 353dbbb3c29a80fb44d4e26dac111739d25294db 353dbbb3c29a80fb44d4e26dac111739d25294db cmd/git.go\n", + outputStr: "1 .M N... 100644 100644 100644 353dbbb3c29a80fb44d4e26dac111739d25294db 353dbbb3c29a80fb44d4e26dac111739d25294db cmd/git.go\n", //nolint:dupword expectedStatus: &Status{ Ordinary: []OrdinaryStatus{ { @@ -78,7 +78,7 @@ func TestParseStatusPorcelainV2(t *testing.T) { }, { name: "renamed", - outputStr: "2 R. N... 100644 100644 100644 9d06c86ecba40e1c695e69b55a40843df6a79cef 9d06c86ecba40e1c695e69b55a40843df6a79cef R100 chezmoi_rename.go\tchezmoi.go\n", + outputStr: "2 R. N... 100644 100644 100644 9d06c86ecba40e1c695e69b55a40843df6a79cef 9d06c86ecba40e1c695e69b55a40843df6a79cef R100 chezmoi_rename.go\tchezmoi.go\n", //nolint:dupword expectedStatus: &Status{ RenamedOrCopied: []RenamedOrCopiedStatus{ { @@ -100,7 +100,7 @@ func TestParseStatusPorcelainV2(t *testing.T) { }, { name: "renamed_2", - outputStr: "2 R. N... 100644 100644 100644 ddbd961d7e4db2bb6615a9e8ce86364fa65e732d ddbd961d7e4db2bb6615a9e8ce86364fa65e732d R100 dot_config/chezmoi/private_chezmoi.toml\tdot_config/chezmoi/chezmoi.toml", + outputStr: "2 R. N... 100644 100644 100644 ddbd961d7e4db2bb6615a9e8ce86364fa65e732d ddbd961d7e4db2bb6615a9e8ce86364fa65e732d R100 dot_config/chezmoi/private_chezmoi.toml\tdot_config/chezmoi/chezmoi.toml", //nolint:dupword expectedStatus: &Status{ RenamedOrCopied: []RenamedOrCopiedStatus{ { @@ -122,7 +122,7 @@ func TestParseStatusPorcelainV2(t *testing.T) { }, { name: "modified_2", - outputStr: "1 .M N... 100644 100644 100644 5716ca5987cbf97d6bb54920bea6adde242d87e6 5716ca5987cbf97d6bb54920bea6adde242d87e6 foo\n", + outputStr: "1 .M N... 100644 100644 100644 5716ca5987cbf97d6bb54920bea6adde242d87e6 5716ca5987cbf97d6bb54920bea6adde242d87e6 foo\n", //nolint:dupword expectedStatus: &Status{ Ordinary: []OrdinaryStatus{ { @@ -141,7 +141,7 @@ func TestParseStatusPorcelainV2(t *testing.T) { }, { name: "unmerged", - outputStr: "u UU N... 100644 100644 100644 100644 78981922613b2afb6025042ff6bd878ac1994e85 0f7bc766052a5a0ee28a393d51d2370f96d8ceb8 422c2b7ab3b3c668038da977e4e93a5fc623169c README.md\n", + outputStr: "u UU N... 100644 100644 100644 100644 78981922613b2afb6025042ff6bd878ac1994e85 0f7bc766052a5a0ee28a393d51d2370f96d8ceb8 422c2b7ab3b3c668038da977e4e93a5fc623169c README.md\n", //nolint:dupword expectedStatus: &Status{ Unmerged: []UnmergedStatus{ {
chore
Bump golangci-lint to version 1.50.0
0acd448e8aa3d8e6f0fba34751561c5cb3cf78e4
2024-03-31 23:42:53
Tom Payne
chore: Update dependencies
false
diff --git a/go.mod b/go.mod index 1e4755ef50e..8d6eba6e11b 100644 --- a/go.mod +++ b/go.mod @@ -12,9 +12,9 @@ require ( github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 github.com/Shopify/ejson v1.5.0 github.com/alecthomas/assert/v2 v2.7.0 - github.com/aws/aws-sdk-go-v2 v1.26.0 - github.com/aws/aws-sdk-go-v2/config v1.27.9 - github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.5 + github.com/aws/aws-sdk-go-v2 v1.26.1 + github.com/aws/aws-sdk-go-v2/config v1.27.10 + github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.6 github.com/bmatcuk/doublestar/v4 v4.6.1 github.com/bradenhilton/mozillainstallhash v1.0.1 github.com/charmbracelet/bubbles v0.18.0 @@ -22,7 +22,7 @@ require ( github.com/charmbracelet/glamour v0.7.0 github.com/coreos/go-semver v0.3.1 github.com/fsnotify/fsnotify v1.7.0 - github.com/go-git/go-git/v5 v5.11.0 + github.com/go-git/go-git/v5 v5.12.0 github.com/google/go-github/v60 v60.0.0 github.com/google/renameio/v2 v2.0.0 github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 @@ -34,14 +34,14 @@ require ( github.com/muesli/termenv v0.15.2 github.com/pelletier/go-toml/v2 v2.2.0 github.com/rogpeppe/go-internal v1.12.0 - github.com/sergi/go-diff v1.1.0 + github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a github.com/twpayne/go-pinentry/v3 v3.0.1 github.com/twpayne/go-shell v0.4.0 github.com/twpayne/go-vfs/v5 v5.0.4 - github.com/twpayne/go-xdg/v6 v6.1.2 + github.com/twpayne/go-xdg/v6 v6.1.3 github.com/ulikunitz/xz v0.5.11 github.com/zalando/go-keyring v0.2.4 github.com/zricethezav/gitleaks/v8 v8.18.2 @@ -72,17 +72,17 @@ require ( github.com/alecthomas/repr v0.4.0 // indirect github.com/alessio/shellescape v1.4.2 // indirect github.com/atotto/clipboard v0.1.4 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.17.9 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.0 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.4 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.4 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.10 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.20.3 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.28.5 // indirect - github.com/aws/smithy-go v1.20.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.20.4 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.4 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.28.6 // indirect + github.com/aws/smithy-go v1.20.2 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/bradenhilton/cityhash v1.0.0 // indirect @@ -158,12 +158,7 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect ) -exclude ( - github.com/microcosm-cc/bluemonday v1.0.26 // https://github.com/microcosm-cc/bluemonday/pull/195 - 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 -) +exclude github.com/microcosm-cc/bluemonday v1.0.26 // https://github.com/microcosm-cc/bluemonday/pull/195 // github.com/Netflix/go-expect is unmaintained. Use a temporary fork. replace github.com/Netflix/go-expect => github.com/twpayne/go-expect v0.0.1 diff --git a/go.sum b/go.sum index 2ed7cb93888..46769375e01 100644 --- a/go.sum +++ b/go.sum @@ -64,34 +64,34 @@ 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.26.0 h1:/Ce4OCiM3EkpW7Y+xUnfAFpchU78K7/Ug01sZni9PgA= -github.com/aws/aws-sdk-go-v2 v1.26.0/go.mod h1:35hUlJVYd+M++iLI3ALmVwMOyRYMmRqUXpTtRGW+K9I= -github.com/aws/aws-sdk-go-v2/config v1.27.9 h1:gRx/NwpNEFSk+yQlgmk1bmxxvQ5TyJ76CWXs9XScTqg= -github.com/aws/aws-sdk-go-v2/config v1.27.9/go.mod h1:dK1FQfpwpql83kbD873E9vz4FyAxuJtR22wzoXn3qq0= -github.com/aws/aws-sdk-go-v2/credentials v1.17.9 h1:N8s0/7yW+h8qR8WaRlPQeJ6czVMNQVNtNdUqf6cItao= -github.com/aws/aws-sdk-go-v2/credentials v1.17.9/go.mod h1:446YhIdmSV0Jf/SLafGZalQo+xr2iw7/fzXGDPTU1yQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.0 h1:af5YzcLf80tv4Em4jWVD75lpnOHSBkPUZxZfGkrI3HI= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.0/go.mod h1:nQ3how7DMnFMWiU1SpECohgC82fpn4cKZ875NDMmwtA= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.4 h1:0ScVK/4qZ8CIW0k8jOeFVsyS/sAiXpYxRBLolMkuLQM= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.4/go.mod h1:84KyjNZdHC6QZW08nfHI6yZgPd+qRgaWcYsyLUo3QY8= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.4 h1:sHmMWWX5E7guWEFQ9SVo6A3S4xpPrWnd77a6y4WM6PU= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.4/go.mod h1:WjpDrhWisWOIoS9n3nk67A3Ll1vfULJ9Kq6h29HTD48= +github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA= +github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= +github.com/aws/aws-sdk-go-v2/config v1.27.10 h1:PS+65jThT0T/snC5WjyfHHyUgG+eBoupSDV+f838cro= +github.com/aws/aws-sdk-go-v2/config v1.27.10/go.mod h1:BePM7Vo4OBpHreKRUMuDXX+/+JWP38FLkzl5m27/Jjs= +github.com/aws/aws-sdk-go-v2/credentials v1.17.10 h1:qDZ3EA2lv1KangvQB6y258OssCHD0xvaGiEDkG4X/10= +github.com/aws/aws-sdk-go-v2/credentials v1.17.10/go.mod h1:6t3sucOaYDwDssHQa0ojH1RpmVmF5/jArkye1b2FKMI= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 h1:FVJ0r5XTHSmIHJV6KuDmdYhEpvlHpiSd38RQWhut5J4= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1/go.mod h1:zusuAeqezXzAB24LGuzuekqMAEgWkVYukBec3kr3jUg= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 h1:aw39xVGeRWlWx9EzGVnhOR4yOjQDHPQ6o6NmBlscyQg= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5/go.mod h1:FSaRudD0dXiMPK2UjknVwwTYyZMRsHv3TtkabsZih5I= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 h1:PG1F3OD1szkuQPzDw3CIQsRIrtTlUC3lP84taWzHlq0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5/go.mod h1:jU1li6RFryMz+so64PpKtudI+QzbKoIEivqdf6LNpOc= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 h1:EyBZibRTVAs6ECHZOw5/wlylS9OcTzwyjeQMudmREjE= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1/go.mod h1:JKpmtYhhPs7D97NL/ltqz7yCkERFW5dOlHyVl66ZYF8= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6 h1:b+E7zIUHMmcB4Dckjpkapoy47W6C9QBv/zoUP+Hn8Kc= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6/go.mod h1:S2fNV0rxrP78NhPbCZeQgY8H9jdDMeGtwcfZIRxzBqU= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.5 h1:1i3Pq5g1NaXI/u8lTHRVMHyCc0HoZzSk2EFmiy14Hbk= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.5/go.mod h1:slgOMs1CQu8UVgwoFqEvCi71L4HVoZgM0r8MtcNP6Mc= -github.com/aws/aws-sdk-go-v2/service/sso v1.20.3 h1:mnbuWHOcM70/OFUlZZ5rcdfA8PflGXXiefU/O+1S3+8= -github.com/aws/aws-sdk-go-v2/service/sso v1.20.3/go.mod h1:5HFu51Elk+4oRBZVxmHrSds5jFXmFj8C3w7DVF2gnrs= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3 h1:uLq0BKatTmDzWa/Nu4WO0M1AaQDaPpwTKAeByEc6WFM= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3/go.mod h1:b+qdhjnxj8GSR6t5YfphOffeoQSQ1KmpoVVuBn+PWxs= -github.com/aws/aws-sdk-go-v2/service/sts v1.28.5 h1:J/PpTf/hllOjx8Xu9DMflff3FajfLxqM5+tepvVXmxg= -github.com/aws/aws-sdk-go-v2/service/sts v1.28.5/go.mod h1:0ih0Z83YDH/QeQ6Ori2yGE2XvWYv/Xm+cZc01LC6oK0= -github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= -github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1xUsUr3I8cHps0G+XM3WWU16lP6yG8qu1GAZAs= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2/go.mod h1:5CsjAbs3NlGQyZNFACh+zztPDI7fU6eW9QsxjfnuBKg= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 h1:ogRAwT1/gxJBcSWDMZlgyFUM962F51A5CRhDLbxLdmo= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7/go.mod h1:YCsIZhXfRPLFFCl5xxY+1T9RKzOKjCut+28JSX2DnAk= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.6 h1:TIOEjw0i2yyhmhRry3Oeu9YtiiHWISZ6j/irS1W3gX4= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.6/go.mod h1:3Ba++UwWd154xtP4FRX5pUK3Gt4up5sDHCve6kVfE+g= +github.com/aws/aws-sdk-go-v2/service/sso v1.20.4 h1:WzFol5Cd+yDxPAdnzTA5LmpHYSWinhmSj4rQChV0ee8= +github.com/aws/aws-sdk-go-v2/service/sso v1.20.4/go.mod h1:qGzynb/msuZIE8I75DVRCUXw3o3ZyBmUvMwQ2t/BrGM= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.4 h1:Jux+gDDyi1Lruk+KHF91tK2KCuY61kzoCpvtvJJBtOE= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.4/go.mod h1:mUYPBhaF2lGiukDEjJX2BLRRKTmoUSitGDUgM4tRxak= +github.com/aws/aws-sdk-go-v2/service/sts v1.28.6 h1:cwIxeBttqPN3qkaAjcEcsh8NYr8n2HZPkcKgPAi1phU= +github.com/aws/aws-sdk-go-v2/service/sts v1.28.6/go.mod h1:FZf1/nKNEkHdGGJP/cI2MoIMquumuRK6ol3QQJNDxmw= +github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= +github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= 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= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= @@ -159,16 +159,16 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/gitleaks/go-gitdiff v0.9.0 h1:SHAU2l0ZBEo8g82EeFewhVy81sb7JCxW76oSPtR/Nqg= github.com/gitleaks/go-gitdiff v0.9.0/go.mod h1:pKz0X4YzCKZs30BL+weqBIG7mx0jl4tF1uXV9ZyNvrA= -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/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-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.11.0 h1:XIZc1p+8YzypNr34itUfSvYJcv+eYdTnTvOZ2vD3cA4= -github.com/go-git/go-git/v5 v5.11.0/go.mod h1:6GFcX2P3NM7FPBfpePbpLd21XxsgdAt+lKqXmCUiUCY= +github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys= +github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -368,8 +368,8 @@ github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6g github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sahilm/fuzzy v0.1.1-0.20230530133925-c48e322e2a8f h1:MvTmaQdww/z0Q4wrYjDSCcZ78NoftLQyHBSLW/Cx79Y= github.com/sahilm/fuzzy v0.1.1-0.20230530133925-c48e322e2a8f/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/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= 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= @@ -421,12 +421,10 @@ github.com/twpayne/go-pinentry/v3 v3.0.1 h1:rop+jK2x2CT5/Bwpf0EYMl0DVpDWc7IQYlNn github.com/twpayne/go-pinentry/v3 v3.0.1/go.mod h1:l8V/3baYFXtN5NLMgFQe2FFPlGdZRUaoCW61Hxs+1oA= github.com/twpayne/go-shell v0.4.0 h1:RAAMbjEj7mcwDdwC7SiFHGUKR+WDAURU6mnyd3r2p2E= github.com/twpayne/go-shell v0.4.0/go.mod h1:MP3aUA0TQ3IGoJc15ahjb+7A7wZH4NeGrvLZ/aFQsHc= -github.com/twpayne/go-vfs/v4 v4.3.0 h1:rTqFzzOQ/6ESKTSiwVubHlCBedJDOhQyVSnw8rQNZhU= -github.com/twpayne/go-vfs/v4 v4.3.0/go.mod h1:tq2UVhnUepesc0lSnPJH/jQ8HruGhzwZe2r5kDFpEIw= github.com/twpayne/go-vfs/v5 v5.0.4 h1:/ne3h+rW7f5YOyOFguz+3ztfUwzOLR0Vts3y0mMAitg= github.com/twpayne/go-vfs/v5 v5.0.4/go.mod h1:zTPFJUbgsEMFNSWnWQlLq9wh4AN83edZzx3VXbxrS1w= -github.com/twpayne/go-xdg/v6 v6.1.2 h1:KbfCsAP4bBR5+dzfTIh/M9onOPCSqlYsIER79IKwt+s= -github.com/twpayne/go-xdg/v6 v6.1.2/go.mod h1:BFHclQaEPLq3jRRYjf1PdFzUEvAfPeLjNymIO/7/7o4= +github.com/twpayne/go-xdg/v6 v6.1.3 h1:viM0S9v4KAc0IRW2xI3Zp8ZkqOCoCxmCmVZ7GTnG0y0= +github.com/twpayne/go-xdg/v6 v6.1.3/go.mod h1:kVT9oShzQ0Cb5r4gzwziZUfluW2sTR72slQC/4N1AXI= 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.14 h1:ebbhrRiGK2i4naQJr+1Xj92HXZCrK7MsyTS/ob3HnAk= @@ -571,7 +569,6 @@ gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRN 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.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
chore
Update dependencies
73731bd45a34b7cd4a7117503416bb090bbd027d
2023-01-12 05:26:24
Tom Payne
chore: Update dependencies
false
diff --git a/assets/chezmoi.io/docs/reference/templates/github-functions/gitHubLatestRelease.md b/assets/chezmoi.io/docs/reference/templates/github-functions/gitHubLatestRelease.md index 23aca919ea6..3ed79b1c98c 100644 --- a/assets/chezmoi.io/docs/reference/templates/github-functions/gitHubLatestRelease.md +++ b/assets/chezmoi.io/docs/reference/templates/github-functions/gitHubLatestRelease.md @@ -3,7 +3,7 @@ `gitHubLatestRelease` calls the GitHub API to retrieve the latest release about the given *owner-repo*, returning structured data as defined by the [GitHub Go API -bindings](https://pkg.go.dev/github.com/google/go-github/v48/github#RepositoryRelease). +bindings](https://pkg.go.dev/github.com/google/go-github/v49/github#RepositoryRelease). Calls to `gitHubLatestRelease` are cached so calling `gitHubLatestRelease` with the same *owner-repo* will only result in one call to the GitHub API. diff --git a/assets/chezmoi.io/docs/reference/templates/github-functions/gitHubLatestTag.md b/assets/chezmoi.io/docs/reference/templates/github-functions/gitHubLatestTag.md index b2bbc5baf09..57f328b5bf8 100644 --- a/assets/chezmoi.io/docs/reference/templates/github-functions/gitHubLatestTag.md +++ b/assets/chezmoi.io/docs/reference/templates/github-functions/gitHubLatestTag.md @@ -2,7 +2,7 @@ `gitHubLatestTag` calls the GitHub API to retrieve the latest tag for the given *owner-repo*, returning structured data as defined by the [GitHub Go API -bindings](https://pkg.go.dev/github.com/google/go-github/v48/github#RepositoryTag). +bindings](https://pkg.go.dev/github.com/google/go-github/v49/github#RepositoryTag). Calls to `gitHubLatestTag` are cached so calling `gitHubLatestTag` with the same *owner-repo* will only result in one call to the GitHub API. diff --git a/go.mod b/go.mod index 84e91680017..c94eb41d439 100644 --- a/go.mod +++ b/go.mod @@ -6,17 +6,17 @@ require ( filippo.io/age v1.1.1 github.com/Masterminds/sprig/v3 v3.2.3 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.17.0 - github.com/bmatcuk/doublestar/v4 v4.4.0 + github.com/aws/aws-sdk-go-v2/config v1.18.8 + github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.18.0 + github.com/bmatcuk/doublestar/v4 v4.6.0 github.com/bradenhilton/mozillainstallhash v1.0.0 github.com/charmbracelet/bubbles v0.14.0 github.com/charmbracelet/bubbletea v0.23.1 github.com/charmbracelet/glamour v0.6.0 github.com/coreos/go-semver v0.3.0 github.com/fsnotify/fsnotify v1.6.0 - github.com/go-git/go-git/v5 v5.5.1 - github.com/google/go-github/v48 v48.2.0 + github.com/go-git/go-git/v5 v5.5.2 + github.com/google/go-github/v49 v49.1.0 github.com/google/renameio/v2 v2.0.0 github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 github.com/mitchellh/mapstructure v1.5.0 @@ -34,15 +34,15 @@ require ( github.com/twpayne/go-xdg/v6 v6.0.0 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 + github.com/zalando/go-keyring v0.2.2 go.etcd.io/bbolt v1.3.7-0.20220226045046-fd5535f71f48 go.uber.org/multierr v1.9.0 - golang.org/x/crypto v0.4.0 - golang.org/x/exp v0.0.0-20221230185412-738e83a70c30 - golang.org/x/oauth2 v0.3.0 + golang.org/x/crypto v0.5.0 + golang.org/x/exp v0.0.0-20230111222715-75897c7a292a + golang.org/x/oauth2 v0.4.0 golang.org/x/sync v0.1.0 - golang.org/x/sys v0.3.0 - golang.org/x/term v0.3.0 + golang.org/x/sys v0.4.0 + golang.org/x/term v0.4.0 gopkg.in/ini.v1 v1.67.0 gopkg.in/yaml.v3 v3.0.1 howett.net/plist v1.0.0 @@ -53,20 +53,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-20221026131551-cf6655e29de4 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230109192245-7efeeb08f296 // indirect github.com/acomagu/bufpipe v1.0.3 // 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.7 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.13.8 // 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/aws-sdk-go-v2/service/sso v1.12.0 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.0 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.18.0 // 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 @@ -118,9 +118,9 @@ require ( github.com/yuin/goldmark-emoji v1.0.1 // indirect go.uber.org/atomic v1.10.0 // indirect golang.org/x/mod v0.7.0 // indirect - golang.org/x/net v0.4.0 // indirect - golang.org/x/text v0.5.0 // indirect - golang.org/x/tools v0.4.0 // indirect + golang.org/x/net v0.5.0 // indirect + golang.org/x/text v0.6.0 // indirect + golang.org/x/tools v0.5.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/go.sum b/go.sum index 0aa0d41cab8..14d7b0c1c10 100644 --- a/go.sum +++ b/go.sum @@ -11,8 +11,9 @@ 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 h1:ra2OtmuW0AE5csawV4YXMNGNQQXvLRps3z2Z59OPO+I= github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4/go.mod h1:UBYPn8k0D56RtnR8RFQMjmh4KrZzWJ5o7Z9SYjossQ8= +github.com/ProtonMail/go-crypto v0.0.0-20230109192245-7efeeb08f296 h1:865LKksDklBvemmkvQ2TO6yArI12PChQJn9R/2S8ov0= +github.com/ProtonMail/go-crypto v0.0.0-20230109192245-7efeeb08f296/go.mod h1:UBYPn8k0D56RtnR8RFQMjmh4KrZzWJ5o7Z9SYjossQ8= 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= github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek= @@ -27,10 +28,10 @@ github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= 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/config v1.18.8 h1:lDpy0WM8AHsywOnVrOHaSMfpaiV2igOw8D7svkFkXVA= +github.com/aws/aws-sdk-go-v2/config v1.18.8/go.mod h1:5XCmmyutmzzgkpk/6NYTjeWb6lgo9N170m1j6pQkIBs= +github.com/aws/aws-sdk-go-v2/credentials v1.13.8 h1:vTrwTvv5qAwjWIGhZDSBH/oQHuIQjGmD232k01FUh6A= +github.com/aws/aws-sdk-go-v2/credentials v1.13.8/go.mod h1:lVa4OHbvgjVot4gmh1uouF1ubgexSCN92P6CJQpT0t8= 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= @@ -41,14 +42,14 @@ github.com/aws/aws-sdk-go-v2/internal/ini v1.3.28 h1:KeTxcGdNnQudb46oOl4d90f2I33 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.17.0 h1:6W6BLZcXytRJsVvc2gGwxKE4wbMSlWqdxZivBP/E+ys= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.17.0/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/aws-sdk-go-v2/service/secretsmanager v1.18.0 h1:UQDiRZyaHQGPXIuCYqKsz/wIVZknCiZdRmPW8buD/xc= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.18.0/go.mod h1:jAeo/PdIJZuDSwsvxJS94G4d6h8tStj7WXVuKwLHWU8= +github.com/aws/aws-sdk-go-v2/service/sso v1.12.0 h1:/2gzjhQowRLarkkBOGPXSRnb8sQ2RVsjdG1C/UliK/c= +github.com/aws/aws-sdk-go-v2/service/sso v1.12.0/go.mod h1:wo/B7uUm/7zw/dWhBJ4FXuw1sySU5lyIhVg1Bu2yL9A= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.0 h1:Jfly6mRxk2ZOSlbCvZfKNS7TukSx1mIzhSsqZ/IGSZI= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.0/go.mod h1:TZSH7xLO7+phDtViY/KUp9WGCJMQkLJ/VpgkTFd5gh8= +github.com/aws/aws-sdk-go-v2/service/sts v1.18.0 h1:kOO++CYo50RcTFISESluhWEi5Prhg+gaSs4whWabiZU= +github.com/aws/aws-sdk-go-v2/service/sts v1.18.0/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= @@ -56,8 +57,8 @@ github.com/aymanbagabas/go-osc52 v1.2.1 h1:q2sWUyDcozPLcLabEMd+a+7Ea2DitxZVN9hTx github.com/aymanbagabas/go-osc52 v1.2.1/go.mod h1:zT8H+Rk4VSabYN90pWyugflM3ZhpTZNC7cASDfUCdT4= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= -github.com/bmatcuk/doublestar/v4 v4.4.0 h1:LmAwNwhjEbYtyVLzjcP/XeVw4nhuScHGkF/XWXnvIic= -github.com/bmatcuk/doublestar/v4 v4.4.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= +github.com/bmatcuk/doublestar/v4 v4.6.0 h1:HTuxyug8GyFbRkrffIpzNCSK4luc0TY3wzXvzIZhEXc= +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= @@ -89,7 +90,6 @@ 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/danieljoos/wincred v1.1.0/go.mod h1:XYlo+eRTsVA9aHGp7NGjFkPla4m+DCL7hqDjlFjiygg= 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/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -112,10 +112,9 @@ github.com/go-git/go-billy/v5 v5.4.0 h1:Vaw7LaSTRJOUric7pe4vnzBSgyuf2KrLsu2Y4ZpQ github.com/go-git/go-billy/v5 v5.4.0/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.5.1 h1:5vtv2TB5PM/gPM+EvsHJ16hJh4uAkdGcKilcwY7FYwo= -github.com/go-git/go-git/v5 v5.5.1/go.mod h1:uz5PQ3d0gz7mSgzZhSJToM6ALPaKCdSnl58/Xb5hzr8= +github.com/go-git/go-git/v5 v5.5.2 h1:v8lgZa5k9ylUw+OR/roJHTxR4QItsNFI5nKtAXFuynw= +github.com/go-git/go-git/v5 v5.5.2/go.mod h1:BE5hUJ5yaV2YMxhmaP4l6RBQ08kMxKSPD4BlxtH7OjI= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= 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/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= @@ -130,8 +129,8 @@ 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/v48 v48.2.0 h1:68puzySE6WqUY9KWmpOsDEQfDZsso98rT6pZcz9HqcE= -github.com/google/go-github/v48 v48.2.0/go.mod h1:dDlehKBDo850ZPvCTK0sEqTCVWcrGl2LcDiajkYi89Y= +github.com/google/go-github/v49 v49.1.0 h1:LFkMgawGQ8dfzWLH/rNE0b3u1D3n6/dw7ZmrN3b+YFY= +github.com/google/go-github/v49 v49.1.0/go.mod h1:MUUzHPrhGniB6vUKa27y37likpipzG+BXXJbG04J334= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/renameio/v2 v2.0.0 h1:UifI23ZTGY8Tt29JbYFiuyIU3eX+RNFtUwefq9qAhxg= @@ -296,8 +295,8 @@ github.com/yuin/goldmark v1.5.3 h1:3HUJmBFbQW9fhQOzMgseU134xfi6hU+mjWywx5Ty+/M= github.com/yuin/goldmark v1.5.3/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= 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= +github.com/zalando/go-keyring v0.2.2 h1:f0xmpYiSrHtSNAVgwip93Cg8tuF45HJM6rHq/A5RI/4= +github.com/zalando/go-keyring v0.2.2/go.mod h1:sI3evg9Wvpw3+n4SqplGSJUMwtDeROfD4nsFz4z9PG0= 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.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= @@ -310,10 +309,10 @@ golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 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-20221230185412-738e83a70c30 h1:m9O6OTJ627iFnN2JIWfdqlZCzneRO6EEBsHXI25P8ws= -golang.org/x/exp v0.0.0-20221230185412-738e83a70c30/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= +golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= +golang.org/x/exp v0.0.0-20230111222715-75897c7a292a h1:/YWeLOBWYV5WAQORVPkZF3Pq9IppkcT72GKnWjNf5W8= +golang.org/x/exp v0.0.0-20230111222715-75897c7a292a/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= @@ -325,10 +324,10 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/oauth2 v0.3.0 h1:6l90koy8/LaBLmLu8jpHeHexzMwEita0zFfYlggy2F8= -golang.org/x/oauth2 v0.3.0/go.mod h1:rQrIauxkUhJ6CuwEXwymO2/eh4xz2ZWF1nBkcxS+tGk= +golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/oauth2 v0.4.0 h1:NF0gk8LVPg1Ml7SSbGyySuoxdsXitj7TvgvuRxIMc/M= +golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec= 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 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= @@ -356,27 +355,28 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= +golang.org/x/sys v0.4.0/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-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI= -golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= +golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg= +golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 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.4.0 h1:7mTAgkunk3fr4GAloyyCasadO6h9zSsQZbwvcaIciV4= -golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= +golang.org/x/tools v0.5.0 h1:+bSpV5HIeWkuvgaMfI3UmKRThoTA5ODJTUd8T17NO+4= +golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= 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= @@ -400,9 +400,8 @@ gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa 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.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 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= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/cmds/execute-template/main.go b/internal/cmds/execute-template/main.go index 1a2a56cc5e3..e60f313bfda 100644 --- a/internal/cmds/execute-template/main.go +++ b/internal/cmds/execute-template/main.go @@ -16,7 +16,7 @@ import ( "text/template" "github.com/Masterminds/sprig/v3" - "github.com/google/go-github/v48/github" + "github.com/google/go-github/v49/github" "github.com/google/renameio/v2/maybe" "gopkg.in/yaml.v3" diff --git a/pkg/chezmoi/github.go b/pkg/chezmoi/github.go index 90b96f7774f..650e95ef4f7 100644 --- a/pkg/chezmoi/github.go +++ b/pkg/chezmoi/github.go @@ -5,7 +5,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v48/github" + "github.com/google/go-github/v49/github" "golang.org/x/oauth2" ) diff --git a/pkg/chezmoi/glob.go b/pkg/chezmoi/glob.go index d0dbd73498f..79c413a98aa 100644 --- a/pkg/chezmoi/glob.go +++ b/pkg/chezmoi/glob.go @@ -28,7 +28,12 @@ func (s lstatFS) Stat(name string) (fs.FileInfo, error) { // Glob is like github.com/bmatcuk/doublestar/v4.Glob except that it does not // follow symlinks. func Glob(fileSystem vfs.FS, prefix string) ([]string, error) { - return doublestar.Glob(lstatFS{ - wrapped: fileSystem, - }, prefix, doublestar.WithFailOnIOErrors()) + return doublestar.Glob( + lstatFS{ + wrapped: fileSystem, + }, + prefix, + doublestar.WithFailOnIOErrors(), + doublestar.WithNoFollow(), + ) } diff --git a/pkg/cmd/doctorcmd.go b/pkg/cmd/doctorcmd.go index 352e16160dc..3e758eb7738 100644 --- a/pkg/cmd/doctorcmd.go +++ b/pkg/cmd/doctorcmd.go @@ -19,7 +19,7 @@ import ( "time" "github.com/coreos/go-semver/semver" - "github.com/google/go-github/v48/github" + "github.com/google/go-github/v49/github" "github.com/spf13/cobra" "github.com/twpayne/go-xdg/v6" diff --git a/pkg/cmd/githubtemplatefuncs.go b/pkg/cmd/githubtemplatefuncs.go index 382796063df..99f20215f9c 100644 --- a/pkg/cmd/githubtemplatefuncs.go +++ b/pkg/cmd/githubtemplatefuncs.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/google/go-github/v48/github" + "github.com/google/go-github/v49/github" "github.com/twpayne/chezmoi/v2/pkg/chezmoi" ) diff --git a/pkg/cmd/upgradecmd.go b/pkg/cmd/upgradecmd.go index 9352d1e5233..59e489dc27f 100644 --- a/pkg/cmd/upgradecmd.go +++ b/pkg/cmd/upgradecmd.go @@ -21,7 +21,7 @@ import ( "strings" "github.com/coreos/go-semver/semver" - "github.com/google/go-github/v48/github" + "github.com/google/go-github/v49/github" "github.com/spf13/cobra" vfs "github.com/twpayne/go-vfs/v4"
chore
Update dependencies
ee0047f36efc919dd33ee7e0d595de88baa34f25
2024-09-01 16:42:42
Tom Payne
chore: Update dependencies
false
diff --git a/go.mod b/go.mod index 8b1e43e88a0..0a7f60df42e 100644 --- a/go.mod +++ b/go.mod @@ -7,22 +7,22 @@ require ( github.com/1password/onepassword-sdk-go v0.1.1 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 + 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 github.com/alecthomas/assert/v2 v2.10.0 github.com/aws/aws-sdk-go-v2 v1.30.4 - github.com/aws/aws-sdk-go-v2/config v1.27.30 + github.com/aws/aws-sdk-go-v2/config v1.27.31 github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.32.6 github.com/bmatcuk/doublestar/v4 v4.6.1 github.com/bradenhilton/mozillainstallhash v1.0.1 github.com/charmbracelet/bubbles v0.19.0 - github.com/charmbracelet/bubbletea v0.27.1 + github.com/charmbracelet/bubbletea v1.1.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 - github.com/google/go-github/v63 v63.0.0 + github.com/google/go-github/v64 v64.0.0 github.com/google/renameio/v2 v2.0.0 github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 github.com/itchyny/gojq v0.12.16 @@ -65,14 +65,14 @@ require ( 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 - github.com/Masterminds/semver/v3 v3.2.1 // indirect + github.com/Masterminds/semver/v3 v3.3.0 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/ProtonMail/go-crypto v1.0.0 // indirect github.com/alecthomas/chroma/v2 v2.14.0 // indirect github.com/alecthomas/repr v0.4.0 // indirect github.com/alessio/shellescape v1.4.2 // indirect github.com/atotto/clipboard v0.1.4 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.17.29 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.30 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16 // indirect github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16 // indirect @@ -115,7 +115,6 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect github.com/huandu/xstrings v1.5.0 // indirect - github.com/imdario/mergo v0.3.16 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/itchyny/timefmt-go v0.1.6 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect diff --git a/go.sum b/go.sum index 4a27af11899..67320c325ea 100644 --- a/go.sum +++ b/go.sum @@ -40,11 +40,10 @@ github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE= 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= -github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= -github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= -github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= +github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0= +github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= +github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs= +github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= @@ -70,10 +69,10 @@ github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= github.com/aws/aws-sdk-go-v2 v1.30.4 h1:frhcagrVNrzmT95RJImMHgabt99vkXGslubDaDagTk8= github.com/aws/aws-sdk-go-v2 v1.30.4/go.mod h1:CT+ZPWXbYrci8chcARI3OmI/qgd+f6WtuLOoaIA8PR0= -github.com/aws/aws-sdk-go-v2/config v1.27.30 h1:AQF3/+rOgeJBQP3iI4vojlPib5X6eeOYoa/af7OxAYg= -github.com/aws/aws-sdk-go-v2/config v1.27.30/go.mod h1:yxqvuubha9Vw8stEgNiStO+yZpP68Wm9hLmcm+R/Qk4= -github.com/aws/aws-sdk-go-v2/credentials v1.17.29 h1:CwGsupsXIlAFYuDVHv1nnK0wnxO0wZ/g1L8DSK/xiIw= -github.com/aws/aws-sdk-go-v2/credentials v1.17.29/go.mod h1:BPJ/yXV92ZVq6G8uYvbU0gSl8q94UB63nMT5ctNO38g= +github.com/aws/aws-sdk-go-v2/config v1.27.31 h1:kxBoRsjhT3pq0cKthgj6RU6bXTm/2SgdoUMyrVw0rAI= +github.com/aws/aws-sdk-go-v2/config v1.27.31/go.mod h1:z04nZdSWFPaDwK3DdJOG2r+scLQzMYuJeW0CujEm9FM= +github.com/aws/aws-sdk-go-v2/credentials v1.17.30 h1:aau/oYFtibVovr2rDt8FHlU17BTicFEMAi29V1U+L5Q= +github.com/aws/aws-sdk-go-v2/credentials v1.17.30/go.mod h1:BPJ/yXV92ZVq6G8uYvbU0gSl8q94UB63nMT5ctNO38g= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12 h1:yjwoSyDZF8Jth+mUk5lSPJCkMC0lMy6FaCD51jm6ayE= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12/go.mod h1:fuR57fAgMk7ot3WcNQfb6rSEn+SUffl7ri+aa8uKysI= github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16 h1:TNyt/+X43KJ9IJJMjKfa3bNTiZbUP7DeCxfbTROESwY= @@ -112,8 +111,8 @@ 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.19.0 h1:gKZkKXPP6GlDk6EcfujDK19PCQqRjaJZQ7QRERx1UF0= github.com/charmbracelet/bubbles v0.19.0/go.mod h1:WILteEqZ+krG5c3ntGEMeG99nCupcuIk7V0/zOP0tOA= -github.com/charmbracelet/bubbletea v0.27.1 h1:/yhaJKX52pxG4jZVKCNWj/oq0QouPdXycriDRA6m6r8= -github.com/charmbracelet/bubbletea v0.27.1/go.mod h1:xc4gm5yv+7tbniEvQ0naiG9P3fzYhk16cTgDZQQW6YE= +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/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= @@ -215,15 +214,14 @@ github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl76 github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v63 v63.0.0 h1:13xwK/wk9alSokujB9lJkuzdmQuVn2QCPeck76wR3nE= -github.com/google/go-github/v63 v63.0.0/go.mod h1:IqbcrgUmIcEaioWrGYei/09o+ge5vhffGOcxrO0AfmA= +github.com/google/go-github/v64 v64.0.0 h1:4G61sozmY3eiPAjjoOHponXDBONm+utovTKbyUb2Qdg= +github.com/google/go-github/v64 v64.0.0/go.mod h1:xB3vqMQNdHzilXBiO2I+M7iEFtHf+DP/omBOv6tQzVo= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/renameio/v2 v2.0.0 h1:UifI23ZTGY8Tt29JbYFiuyIU3eX+RNFtUwefq9qAhxg= github.com/google/renameio/v2 v2.0.0/go.mod h1:BtmJXm5YlszgC+TD4HOEEUFgkJP3nLxehU6hfe7jRt4= github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= @@ -262,12 +260,8 @@ github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= -github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= github.com/huandu/xstrings v1.5.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.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= -github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/itchyny/gojq v0.12.16 h1:yLfgLxhIr/6sJNVmYfQjTIv0jGctu6/DgDoivmxTr7g= @@ -319,14 +313,12 @@ github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6T github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk= github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -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= @@ -394,7 +386,6 @@ github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA= github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= -github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= @@ -410,7 +401,6 @@ github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9yS github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= @@ -426,7 +416,6 @@ github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 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.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= @@ -497,7 +486,6 @@ go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= 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-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= @@ -602,7 +590,6 @@ gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRN 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.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/chezmoi/github.go b/internal/chezmoi/github.go index 7ddce9f9573..7d98dba1cf4 100644 --- a/internal/chezmoi/github.go +++ b/internal/chezmoi/github.go @@ -5,7 +5,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v63/github" + "github.com/google/go-github/v64/github" "golang.org/x/oauth2" ) diff --git a/internal/cmd/doctorcmd.go b/internal/cmd/doctorcmd.go index b29692788c3..d0f4c72c83d 100644 --- a/internal/cmd/doctorcmd.go +++ b/internal/cmd/doctorcmd.go @@ -20,7 +20,7 @@ import ( "time" "github.com/coreos/go-semver/semver" - "github.com/google/go-github/v63/github" + "github.com/google/go-github/v64/github" "github.com/spf13/cobra" "github.com/twpayne/go-shell" "github.com/twpayne/go-xdg/v6" diff --git a/internal/cmd/githubtemplatefuncs.go b/internal/cmd/githubtemplatefuncs.go index 686e4d50ff4..18a4f7d0c3e 100644 --- a/internal/cmd/githubtemplatefuncs.go +++ b/internal/cmd/githubtemplatefuncs.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/google/go-github/v63/github" + "github.com/google/go-github/v64/github" "github.com/twpayne/chezmoi/v2/internal/chezmoi" ) diff --git a/internal/cmd/upgradecmd.go b/internal/cmd/upgradecmd.go index 6f07df693c0..bbd8c17bb8f 100644 --- a/internal/cmd/upgradecmd.go +++ b/internal/cmd/upgradecmd.go @@ -21,7 +21,7 @@ import ( "strings" "github.com/coreos/go-semver/semver" - "github.com/google/go-github/v63/github" + "github.com/google/go-github/v64/github" "github.com/spf13/cobra" "github.com/twpayne/chezmoi/v2/internal/chezmoi" diff --git a/internal/cmd/upgradecmd_unix.go b/internal/cmd/upgradecmd_unix.go index d6ec6075898..cd251b87f25 100644 --- a/internal/cmd/upgradecmd_unix.go +++ b/internal/cmd/upgradecmd_unix.go @@ -15,7 +15,7 @@ import ( "strings" "github.com/coreos/go-semver/semver" - "github.com/google/go-github/v63/github" + "github.com/google/go-github/v64/github" vfs "github.com/twpayne/go-vfs/v5" "github.com/twpayne/chezmoi/v2/internal/chezmoi" diff --git a/internal/cmd/upgradecmd_windows.go b/internal/cmd/upgradecmd_windows.go index 1f14c235cf9..d18b02376b7 100644 --- a/internal/cmd/upgradecmd_windows.go +++ b/internal/cmd/upgradecmd_windows.go @@ -10,7 +10,7 @@ import ( "path/filepath" "github.com/coreos/go-semver/semver" - "github.com/google/go-github/v63/github" + "github.com/google/go-github/v64/github" vfs "github.com/twpayne/go-vfs/v5" "github.com/twpayne/chezmoi/v2/internal/chezmoi" diff --git a/internal/cmds/execute-template/main.go b/internal/cmds/execute-template/main.go index 4c01cf91132..a2e1ff71ea5 100644 --- a/internal/cmds/execute-template/main.go +++ b/internal/cmds/execute-template/main.go @@ -16,7 +16,7 @@ import ( "text/template" "github.com/Masterminds/sprig/v3" - "github.com/google/go-github/v63/github" + "github.com/google/go-github/v64/github" "github.com/google/renameio/v2/maybe" "gopkg.in/yaml.v3"
chore
Update dependencies
39be95dfed18c0ae25d1ce62b0435f8bd245f9b7
2024-03-08 21:47:50
Tom Payne
chore: Space scheduled CI runs to avoid exceeding GitHub API quotas
false
diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index ebf8540ea07..8e6e4c81f8b 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -2,7 +2,7 @@ name: lock-threads on: schedule: - - cron: 2 2 * * * + - cron: 17 2 * * * workflow_dispatch: {} permissions: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9457a2e52f6..e79fa5ef378 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,7 @@ on: tags: - v* schedule: - - cron: 2 2 * * * + - cron: 32 2 * * * env: ACTIONLINT_VERSION: 1.6.26 AGE_VERSION: 1.1.1
chore
Space scheduled CI runs to avoid exceeding GitHub API quotas
61135287a195923e1b15820e52fbf94b9c091570
2021-10-31 02:39:18
Tom Payne
feat: Create parent directories for externals if needed
false
diff --git a/internal/chezmoi/sourcestate.go b/internal/chezmoi/sourcestate.go index baa3e322133..e462e618656 100644 --- a/internal/chezmoi/sourcestate.go +++ b/internal/chezmoi/sourcestate.go @@ -894,6 +894,27 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error { s.root.Set(targetRelPath, sourceEntries[0]) } + // Generate directory entries for any missing directories. + generatedDirEntries := make(map[RelPath]*SourceStateDir) + _ = s.root.ForEachNode(EmptyRelPath, func(targetRelPath RelPath, node *sourceStateEntryTreeNode) error { + if targetRelPath.Empty() { + return nil + } + if node.sourceStateEntry != nil { + return nil + } + var sourceRelPath SourceRelPath + _, targetNameRelPath := targetRelPath.Split() + sourceStateDir := s.newSourceStateDir(sourceRelPath, DirAttr{ + TargetName: targetNameRelPath.String(), + }) + generatedDirEntries[targetRelPath] = sourceStateDir + return nil + }) + for targetRelPath, sourceStateDir := range generatedDirEntries { + s.root.Set(targetRelPath, sourceStateDir) + } + return nil } diff --git a/internal/cmd/testdata/scripts/external.txt b/internal/cmd/testdata/scripts/external.txt index 05fc9acfbf8..a1a681748dd 100644 --- a/internal/cmd/testdata/scripts/external.txt +++ b/internal/cmd/testdata/scripts/external.txt @@ -51,6 +51,14 @@ chhome home7/user # test that .chezmoiignore applies to entire externals chezmoi apply --force +chhome home8/user + +# test that parent directories are created if needed +chezmoi apply --force +cmp $HOME/.dir1/file golden/dir/file +cmp $HOME/.dir2/dir2/file golden/dir/file +cmp $HOME/.dir3/dir3/dir3/file golden/dir/file + -- archive/dir/file -- # contents of dir/file -- golden/.file -- @@ -99,5 +107,18 @@ subdir: url: {{ env "HTTPD_URL" }}/non-existent-archive.tar.gz -- home7/user/.local/share/chezmoi/.chezmoiignore -- .dir +-- home8/user/.local/share/chezmoi/.chezmoiexternal.toml -- +[".dir1"] + type = "archive" + url = "{{ env "HTTPD_URL" }}/archive.tar.gz" + stripComponents = 2 +[".dir2/dir2"] + type = "archive" + url = "{{ env "HTTPD_URL" }}/archive.tar.gz" + stripComponents = 2 +[".dir3/dir3/dir3"] + type = "archive" + url = "{{ env "HTTPD_URL" }}/archive.tar.gz" + stripComponents = 2 -- www/.file -- # contents of .file
feat
Create parent directories for externals if needed
520e4a6d0663aeb6eeafb4352906fdffecbd6702
2022-10-06 04:30:04
Tom Payne
chore: Sort functions
false
diff --git a/pkg/cmd/config.go b/pkg/cmd/config.go index d3a90d57dda..15834612f47 100644 --- a/pkg/cmd/config.go +++ b/pkg/cmd/config.go @@ -329,6 +329,7 @@ func newConfig(options ...configOption) (*Config, error) { "comment": c.commentTemplateFunc, "decrypt": c.decryptTemplateFunc, "encrypt": c.encryptTemplateFunc, + "eqFold": c.eqFoldTemplateFunc, "fromIni": c.fromIniTemplateFunc, "fromToml": c.fromTomlTemplateFunc, "fromYaml": c.fromYamlTemplateFunc, @@ -368,7 +369,6 @@ func newConfig(options ...configOption) (*Config, error) { "secret": c.secretTemplateFunc, "secretJSON": c.secretJSONTemplateFunc, "stat": c.statTemplateFunc, - "eqFold": c.eqFoldTemplateFunc, "toIni": c.toIniTemplateFunc, "toToml": c.toTomlTemplateFunc, "toYaml": c.toYamlTemplateFunc,
chore
Sort functions
f4ae097412bfd041b825808fac494c7f318a3ee1
2021-11-14 23:58:18
Tom Payne
chore: Use conventional subdirectory for source archives
false
diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 09aced58821..ea728748c73 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -198,3 +198,4 @@ snapcrafts: source: enabled: true + prefix_template: '{{ .ProjectName }}-{{ .Version }}/'
chore
Use conventional subdirectory for source archives
19b92d2f32442a5870583b5ac2b5d8ae6d2d4f78
2023-10-09 04:42:18
Tom Payne
chore: Update dependencies
false
diff --git a/go.mod b/go.mod index d4acb65d853..40502e6b9ae 100644 --- a/go.mod +++ b/go.mod @@ -8,10 +8,10 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.0.1 github.com/Masterminds/sprig/v3 v3.2.3 github.com/Shopify/ejson v1.4.1 - github.com/alecthomas/assert/v2 v2.3.0 - github.com/aws/aws-sdk-go-v2 v1.21.0 - github.com/aws/aws-sdk-go-v2/config v1.18.42 - github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.21.3 + github.com/alecthomas/assert/v2 v2.4.0 + github.com/aws/aws-sdk-go-v2 v1.21.1 + github.com/aws/aws-sdk-go-v2/config v1.18.44 + github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.21.4 github.com/bmatcuk/doublestar/v4 v4.6.0 github.com/bradenhilton/mozillainstallhash v1.0.1 github.com/charmbracelet/bubbles v0.16.1 @@ -44,12 +44,12 @@ require ( github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1 github.com/zalando/go-keyring v0.2.3 go.etcd.io/bbolt v1.3.7 - golang.org/x/crypto v0.13.0 - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 - golang.org/x/oauth2 v0.12.0 - golang.org/x/sync v0.3.0 - golang.org/x/sys v0.12.0 - golang.org/x/term v0.12.0 + golang.org/x/crypto v0.14.0 + golang.org/x/exp v0.0.0-20231006140011-7918f672742d + golang.org/x/oauth2 v0.13.0 + golang.org/x/sync v0.4.0 + golang.org/x/sys v0.13.0 + golang.org/x/term v0.13.0 gopkg.in/ini.v1 v1.67.0 gopkg.in/yaml.v3 v3.0.1 howett.net/plist v1.0.0 @@ -58,7 +58,7 @@ require ( require ( dario.cat/mergo v1.0.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.2 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // 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.0 // indirect @@ -68,19 +68,19 @@ require ( github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c // indirect github.com/acomagu/bufpipe v1.0.4 // indirect github.com/alecthomas/chroma v0.10.0 // indirect - github.com/alecthomas/repr v0.2.0 // indirect + github.com/alecthomas/repr v0.3.0 // indirect github.com/alessio/shellescape v1.4.2 // indirect github.com/atotto/clipboard v0.1.4 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.13.40 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.43 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.14.1 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.22.0 // indirect - github.com/aws/smithy-go v1.14.2 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.13.42 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.12 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.42 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.36 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.3.44 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.36 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.15.1 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.23.1 // indirect + github.com/aws/smithy-go v1.15.0 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/bradenhilton/cityhash v1.0.0 // indirect @@ -133,10 +133,10 @@ require ( github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/yuin/goldmark v1.5.6 // indirect github.com/yuin/goldmark-emoji v1.0.2 // indirect - golang.org/x/mod v0.12.0 // indirect - golang.org/x/net v0.15.0 // indirect + golang.org/x/mod v0.13.0 // indirect + golang.org/x/net v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect - golang.org/x/tools v0.13.0 // indirect + golang.org/x/tools v0.14.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/go.sum b/go.sum index 1cb34c07c1a..5be2316f06f 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,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.7.2 h1:t5+QXLCK9SVi0PPdaY0PrFvYUo24KwA0QwxnaHRSVd4= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.2/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 h1:9kDVnTz3vbfweTqAUmk/a/pH5pWFCHtvRpHYC0G/dcA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0/go.mod h1:3Ug6Qzto9anB6mGlEdgYMDF5zHQ+wwhEaYR4s17PHMw= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 h1:LNHhpdK7hzUcx/k1LIcuh5k7k1LGIWLQfCjaneSj7Fc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1/go.mod h1:uE9zaUfEQT/nbQjVi2IblCG9iaLtZsuYZ8ne+PuQ02M= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= @@ -36,12 +36,12 @@ github.com/Shopify/ejson v1.4.1 h1:zGGojGJNTdIWza/kOT8gd2HKCg3ZkSi3CZ1ZX70NHsw= github.com/Shopify/ejson v1.4.1/go.mod h1:VZMUtDzvBW/PAXRUF5fzp1ffb1ucT8MztrZXXLYZurw= 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/assert/v2 v2.3.0 h1:mAsH2wmvjsuvyBvAmCtm7zFsBlb8mIHx5ySLVdDZXL0= -github.com/alecthomas/assert/v2 v2.3.0/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= +github.com/alecthomas/assert/v2 v2.4.0 h1:/ZiZ0NnriAWPYYO+4eOjgzNELrFQLaHNr92mHSHFj9U= +github.com/alecthomas/assert/v2 v2.4.0/go.mod h1:fw5suVxB+wfYJ3291t0hRTqtGzFYdSwstnRQdaQx2DM= github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek= github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s= -github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk= -github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= +github.com/alecthomas/repr v0.3.0 h1:NeYzUPfjjlqHY4KtzgKJiWd6sVq2eNUPTi34PiFGjY8= +github.com/alecthomas/repr v0.3.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/alessio/shellescape v1.4.2 h1:MHPfaU+ddJ0/bYWpgIeUnQUqKrlJ1S7BfEYPM4uEoM0= github.com/alessio/shellescape v1.4.2/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= @@ -50,32 +50,32 @@ 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.21.0 h1:gMT0IW+03wtYJhRqTVYn0wLzwdnK9sRMcxmtfGzRdJc= -github.com/aws/aws-sdk-go-v2 v1.21.0/go.mod h1:/RfNgGmRxI+iFOB1OeJUyxiU+9s88k3pfHvDagGEp0M= -github.com/aws/aws-sdk-go-v2/config v1.18.42 h1:28jHROB27xZwU0CB88giDSjz7M1Sba3olb5JBGwina8= -github.com/aws/aws-sdk-go-v2/config v1.18.42/go.mod h1:4AZM3nMMxwlG+eZlxvBKqwVbkDLlnN2a4UGTL6HjaZI= -github.com/aws/aws-sdk-go-v2/credentials v1.13.40 h1:s8yOkDh+5b1jUDhMBtngF6zKWLDs84chUk2Vk0c38Og= -github.com/aws/aws-sdk-go-v2/credentials v1.13.40/go.mod h1:VtEHVAAqDWASwdOqj/1huyT6uHbs5s8FUHfDQdky/Rs= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 h1:uDZJF1hu0EVT/4bogChk8DyjSF6fof6uL/0Y26Ma7Fg= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11/go.mod h1:TEPP4tENqBGO99KwVpV9MlOX4NSrSLP8u3KRy2CDwA8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 h1:22dGT7PneFMx4+b3pz7lMTRyN8ZKH7M2cW4GP9yUS2g= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41/go.mod h1:CrObHAuPneJBlfEJ5T3szXOUkLEThaGfvnhTf33buas= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 h1:SijA0mgjV8E+8G45ltVHs0fvKpTj8xmZJ3VwhGKtUSI= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35/go.mod h1:SJC1nEVVva1g3pHAIdCp7QsRIkMmLAgoDquQ9Rr8kYw= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.43 h1:g+qlObJH4Kn4n21g69DjspU0hKTjWtq7naZ9OLCv0ew= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.43/go.mod h1:rzfdUlfA+jdgLDmPKjd3Chq9V7LVLYo1Nz++Wb91aRo= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35 h1:CdzPW9kKitgIiLV1+MHobfR5Xg25iYnyzWZhyQuSlDI= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35/go.mod h1:QGF2Rs33W5MaN9gYdEQOBBFPLwTZkEhRwI33f7KIG0o= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.21.3 h1:H6ZipEknzu7RkJW3w2PP75zd8XOdR35AEY5D57YrJtA= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.21.3/go.mod h1:5W2cYXDPabUmwULErlC92ffLhtTuyv4ai+5HhdbhfNo= -github.com/aws/aws-sdk-go-v2/service/sso v1.14.1 h1:YkNzx1RLS0F5qdf9v1Q8Cuv9NXCL2TkosOxhzlUPV64= -github.com/aws/aws-sdk-go-v2/service/sso v1.14.1/go.mod h1:fIAwKQKBFu90pBxx07BFOMJLpRUGu8VOzLJakeY+0K4= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.1 h1:8lKOidPkmSmfUtiTgtdXWgaKItCZ/g75/jEk6Ql6GsA= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.1/go.mod h1:yygr8ACQRY2PrEcy3xsUI357stq2AxnFM6DIsR9lij4= -github.com/aws/aws-sdk-go-v2/service/sts v1.22.0 h1:s4bioTgjSFRwOoyEFzAVCmFmoowBgjTR8gkrF/sQ4wk= -github.com/aws/aws-sdk-go-v2/service/sts v1.22.0/go.mod h1:VC7JDqsqiwXukYEDjoHh9U0fOJtNWh04FPQz4ct4GGU= -github.com/aws/smithy-go v1.14.2 h1:MJU9hqBGbvWZdApzpvoF2WAIJDbtjK2NDJSiJP7HblQ= -github.com/aws/smithy-go v1.14.2/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/aws-sdk-go-v2 v1.21.1 h1:wjHYshtPpYOZm+/mu3NhVgRRc0baM6LJZOmxPZ5Cwzs= +github.com/aws/aws-sdk-go-v2 v1.21.1/go.mod h1:ErQhvNuEMhJjweavOYhxVkn2RUx7kQXVATHrjKtxIpM= +github.com/aws/aws-sdk-go-v2/config v1.18.44 h1:U10NQ3OxiY0dGGozmVIENIDnCT0W432PWxk2VO8wGnY= +github.com/aws/aws-sdk-go-v2/config v1.18.44/go.mod h1:pHxnQBldd0heEdJmolLBk78D1Bf69YnKLY3LOpFImlU= +github.com/aws/aws-sdk-go-v2/credentials v1.13.42 h1:KMkjpZqcMOwtRHChVlHdNxTUUAC6NC/b58mRZDIdcRg= +github.com/aws/aws-sdk-go-v2/credentials v1.13.42/go.mod h1:7ltKclhvEB8305sBhrpls24HGxORl6qgnQqSJ314Uw8= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.12 h1:3j5lrl9kVQrJ1BU4O0z7MQ8sa+UXdiLuo4j0V+odNI8= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.12/go.mod h1:JbFpcHDBdsex1zpIKuVRorZSQiZEyc3MykNCcjgz174= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.42 h1:817VqVe6wvwE46xXy6YF5RywvjOX6U2zRQQ6IbQFK0s= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.42/go.mod h1:oDfgXoBBmj+kXnqxDDnIDnC56QBosglKp8ftRCTxR+0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.36 h1:7ZApaXzWbo8slc+W5TynuUlB4z66g44h7uqa3/d/BsY= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.36/go.mod h1:rwr4WnmFi3RJO0M4dxbJtgi9BPLMpVBMX1nUte5ha9U= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.44 h1:quOJOqlbSfeJTboXLjYXM1M9T52LBXqLoTPlmsKLpBo= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.44/go.mod h1:LNy+P1+1LiRcCsVYr/4zG5n8zWFL0xsvZkOybjbftm8= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.36 h1:YXlm7LxwNlauqb2OrinWlcvtsflTzP8GaMvYfQBhoT4= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.36/go.mod h1:ou9ffqJ9hKOVZmjlC6kQ6oROAyG1M4yBKzR+9BKbDwk= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.21.4 h1:LUtjmUxYPkiFkiVyvLmHVcuthVPnEKd0hEprTOVRTS0= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.21.4/go.mod h1:Bph0xA97xjEciochtR3JKrgGHt1psILMtFgu3KAbiBE= +github.com/aws/aws-sdk-go-v2/service/sso v1.15.1 h1:ZN3bxw9OYC5D6umLw6f57rNJfGfhg1DIAAcKpzyUTOE= +github.com/aws/aws-sdk-go-v2/service/sso v1.15.1/go.mod h1:PieckvBoT5HtyB9AsJRrYZFY2Z+EyfVM/9zG6gbV8DQ= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.2 h1:fSCCJuT5i6ht8TqGdZc5Q5K9pz/atrf7qH4iK5C9XzU= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.2/go.mod h1:5eNtr+vNc5vVd92q7SJ+U/HszsIdhZBEyi9dkMRKsp8= +github.com/aws/aws-sdk-go-v2/service/sts v1.23.1 h1:ASNYk1ypWAxRhJjKS0jBnTUeDl7HROOpeSMu1xDA/I8= +github.com/aws/aws-sdk-go-v2/service/sts v1.23.1/go.mod h1:2cnsAhVT3mqusovc2stUSUrSBGTcX9nh8Tu6xh//2eI= +github.com/aws/smithy-go v1.15.0 h1:PS/durmlzvAFpQHDs4wi4sNNP9ExsqZh6IlfdHXgKK8= +github.com/aws/smithy-go v1.15.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/aymanbagabas/go-osc52 v1.0.3 h1:DTwqENW7X9arYimJrPeGZcV0ln14sGMt3pHZspWD+Mg= github.com/aymanbagabas/go-osc52 v1.0.3/go.mod h1:zT8H+Rk4VSabYN90pWyugflM3ZhpTZNC7cASDfUCdT4= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= @@ -368,14 +368,14 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -384,15 +384,15 @@ golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= 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.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= -golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= +golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= +golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= +golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= 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.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= 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= @@ -411,15 +411,16 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/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-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -434,8 +435,8 @@ 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.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= +golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= 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= diff --git a/internal/chezmoi/sourcestate_test.go b/internal/chezmoi/sourcestate_test.go index b90be7bbda2..dc4a57ccfcb 100644 --- a/internal/chezmoi/sourcestate_test.go +++ b/internal/chezmoi/sourcestate_test.go @@ -1508,11 +1508,9 @@ func TestSourceStateRead(t *testing.T) { "/home/user/.local/share/chezmoi", ) requireEvaluateAll(t, tc.expectedSourceState, system) - s.baseSystem = nil - s.system = nil s.templateData = nil s.version = semver.Version{} - assert.Equal(t, tc.expectedSourceState, s) + assert.Equal(t, tc.expectedSourceState, s, assert.Exclude[System]()) }) }) }
chore
Update dependencies
c8f113ff11ddefb40fd4c889e4c6ff4673b8af73
2021-10-09 18:39:54
Tom Payne
feat: Add onchange_ attribute for scripts
false
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 6f45f96f706..8f1248e5701 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -9,7 +9,7 @@ * [Path handling](#path-handling) * [Persistent state](#persistent-state) * [Encryption](#encryption) -* [`run_once_` scripts](#run_once_-scripts) +* [`run_once_` and `run_onchange_` scripts](#run_once_-and-run_onchange_-scripts) * [Testing](#testing) --- @@ -174,12 +174,17 @@ wraps an `Encryption` interface and logs the methods called. --- -## `run_once_` scripts +## `run_once_` and `run_onchange_` scripts -The execution of `run_once_` scripts is recorded by storing the SHA256 of their -contents in the persistent state. `run_once_` scripts are only run if no -`run_once_` script with the same contents has been run before, for example if -the script's contents change. +The execution of a `run_once_` script is recorded by storing the SHA256 of its +contents in the `scriptState` bucket in the persistent state. On future +invocations the script is only run if no matching contents SHA256 is found in +the persistent state. + +The execution of a `run_onchange_` script is recorded by storing its target name +in the `entryState` bucket along with its contents SHA256 sum. On future +invocations the script is only run if its contents SHA256 sum has changed, and +its contents SHA256 sum is then updated in the persistent state. --- diff --git a/docs/HOWTO.md b/docs/HOWTO.md index 2572f9fade3..f98072f816a 100644 --- a/docs/HOWTO.md +++ b/docs/HOWTO.md @@ -1320,10 +1320,12 @@ 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 only be run if they have not -been run before have the prefix `run_once_`. +been run before have the prefix `run_once_`. Scripts that should be run whenever +their contents change have the `run_onchange_` prefix. Scripts break chezmoi's declarative approach, and as such should be used -sparingly. Any script should be idempotent, even `run_once_` scripts. +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 diff --git a/docs/REFERENCE.md b/docs/REFERENCE.md index 7e310dc432f..f37ed8caf72 100644 --- a/docs/REFERENCE.md +++ b/docs/REFERENCE.md @@ -435,24 +435,25 @@ names. The following prefixes and suffixes are special, and are collectively referred to as "attributes": -| Prefix | Effect | -| ------------ | ------------------------------------------------------------------------------ | -| `after_` | Run script after updating the destination. | -| `before_` | Run script before updating the destination. | -| `create_` | Ensure that the file exists, and create it with contents if it does not. | -| `dot_` | Rename to use a leading dot, e.g. `dot_foo` becomes `.foo`. | -| `empty_` | Ensure the file exists, even if is empty. By default, empty files are removed. | -| `encrypted_` | Encrypt the file in the source state. | -| `exact_` | Remove anything not managed by chezmoi. | -| `executable_`| Add executable permissions to the target file. | -| `literal_` | Stop parsing prefix attributes. | -| `modify_` | Treat the contents as a script that modifies an existing file. | -| `once_` | Only run the script if it has not been run before. | -| `private_` | Remove all group and world permissions from the target file or directory. | -| `readonly_` | Remove all write permissions from the target file or directory. | -| `remove_` | Remove the entry if it exists. | -| `run_` | Treat the contents as a script to run. | -| `symlink_` | Create a symlink instead of a regular file. | +| Prefix | Effect | +| ------------ | ------------------------------------------------------------------------------- | +| `after_` | Run script after updating the destination. | +| `before_` | Run script before updating the destination. | +| `create_` | Ensure that the file exists, and create it with contents if it does not. | +| `dot_` | Rename to use a leading dot, e.g. `dot_foo` becomes `.foo`. | +| `empty_` | Ensure the file exists, even if is empty. By default, empty files are removed. | +| `encrypted_` | Encrypt the file in the source state. | +| `exact_` | Remove anything not managed by chezmoi. | +| `executable_`| Add executable permissions to the target file. | +| `literal_` | Stop parsing prefix attributes. | +| `modify_` | Treat the contents as a script that modifies an existing file. | +| `once_` | Only run the script if it has not been run before. | +| `onchange_` | Only run the script if its contents have changed from the last time it was run. | +| `private_` | Remove all group and world permissions from the target file or directory. | +| `readonly_` | Remove all write permissions from the target file or directory. | +| `remove_` | Remove the entry if it exists. | +| `run_` | Treat the contents as a script to run. | +| `symlink_` | Create a symlink instead of a regular file. | | Suffix | Effect | | ---------- | ---------------------------------------------------- | @@ -469,7 +470,7 @@ prefixes is important. | Create file | File | `create_`, `encrypted_`, `private_`, `readonly_`, `executable_`, `dot_` | `.tmpl` | | Modify file | File | `modify_`, `encrypted_`, `private_`, `readonly_`, `executable_`, `dot_` | `.tmpl` | | Remove | File | `remove_`, `dot_` | *none* | -| Script | File | `run_`, `once_`, `before_` or `after_` | `.tmpl` | +| Script | File | `run_`, `once_` or `onchange_`, `before_` or `after_` | `.tmpl` | | Symbolic link | File | `symlink_`, `dot_`, | `.tmpl` | The `literal_` prefix and `.literal` suffix can appear anywhere and stop @@ -556,10 +557,13 @@ whitespace, then the target is removed. Scripts are represented as regular files in the source state with prefix `run_`. The file's contents (after being interpreted as a template if it has a `.tmpl` -suffix) are executed. Scripts are executed on every `chezmoi apply`, unless they -have the `once_` attribute, in which case they are only executed if a script -with the same contents has not been run before, for example if its contents has -changed. +suffix) are executed. + +Scripts are executed on every `chezmoi apply`, unless they have the `once_` or +`onchange_` attribute. `run_once_` scripts are only executed if a script with +the same contents has not been run before, for example if its contents has +changed. `run_onchange_` scripts are executed whenever their contents change, +even if a script with the same contents has run before. Scripts with the `before_` attribute are executed before any files, directories, or symlinks are updated. Scripts with the `after_` attribute are executed after diff --git a/internal/chezmoi/attr.go b/internal/chezmoi/attr.go index 3c0f839ad61..28fcf69b8e9 100644 --- a/internal/chezmoi/attr.go +++ b/internal/chezmoi/attr.go @@ -46,8 +46,9 @@ type ScriptCondition string // Script conditions. const ( - ScriptConditionAlways ScriptCondition = "" - ScriptConditionOnce ScriptCondition = "once" + ScriptConditionAlways ScriptCondition = "" + ScriptConditionOnce ScriptCondition = "once" + ScriptConditionOnChange ScriptCondition = "onchange" ) // DirAttr holds attributes parsed from a source directory name. @@ -190,9 +191,13 @@ func parseFileAttr(sourceName, encryptedSuffix string) FileAttr { case strings.HasPrefix(name, runPrefix): sourceFileType = SourceFileTypeScript name = mustTrimPrefix(name, runPrefix) - if strings.HasPrefix(name, oncePrefix) { + switch { + case strings.HasPrefix(name, oncePrefix): name = mustTrimPrefix(name, oncePrefix) condition = ScriptConditionOnce + case strings.HasPrefix(name, onChangePrefix): + name = mustTrimPrefix(name, onChangePrefix) + condition = ScriptConditionOnChange } switch { case strings.HasPrefix(name, beforePrefix): @@ -343,8 +348,11 @@ func (fa FileAttr) SourceName(encryptedSuffix string) string { sourceName = removePrefix case SourceFileTypeScript: sourceName = runPrefix - if fa.Condition == ScriptConditionOnce { + switch fa.Condition { + case ScriptConditionOnce: sourceName += oncePrefix + case ScriptConditionOnChange: + sourceName += onChangePrefix } switch fa.Order { case ScriptOrderBefore: diff --git a/internal/chezmoi/attr_test.go b/internal/chezmoi/attr_test.go index 581f854d138..6b454ddacd1 100644 --- a/internal/chezmoi/attr_test.go +++ b/internal/chezmoi/attr_test.go @@ -156,7 +156,7 @@ func TestFileAttr(t *testing.T) { Order []ScriptOrder }{ Type: SourceFileTypeScript, - Condition: []ScriptCondition{ScriptConditionAlways, ScriptConditionOnce}, + Condition: []ScriptCondition{ScriptConditionAlways, ScriptConditionOnce, ScriptConditionOnChange}, TargetName: targetNames, Order: []ScriptOrder{ScriptOrderBefore, ScriptOrderDuring, ScriptOrderAfter}, })) diff --git a/internal/chezmoi/chezmoi.go b/internal/chezmoi/chezmoi.go index 779b622df5f..e47ed870dc5 100644 --- a/internal/chezmoi/chezmoi.go +++ b/internal/chezmoi/chezmoi.go @@ -36,6 +36,7 @@ const ( literalPrefix = "literal_" modifyPrefix = "modify_" oncePrefix = "once_" + onChangePrefix = "onchange_" privatePrefix = "private_" readOnlyPrefix = "readonly_" removePrefix = "remove_" diff --git a/internal/chezmoi/hexbytes.go b/internal/chezmoi/hexbytes.go index 80ae8cf92cf..0986f00441a 100644 --- a/internal/chezmoi/hexbytes.go +++ b/internal/chezmoi/hexbytes.go @@ -7,6 +7,11 @@ import ( // A HexBytes is a []byte which is marshaled as a hex string. type HexBytes []byte +// Bytes returns h as a []byte. +func (h HexBytes) Bytes() []byte { + return []byte(h) +} + // MarshalText implements encoding.TextMarshaler.MarshalText. func (h HexBytes) MarshalText() ([]byte, error) { if len(h) == 0 { diff --git a/internal/chezmoi/targetstateentry.go b/internal/chezmoi/targetstateentry.go index 3a6a5d82073..b9272e30e3b 100644 --- a/internal/chezmoi/targetstateentry.go +++ b/internal/chezmoi/targetstateentry.go @@ -197,15 +197,33 @@ func (t *TargetStateScript) Apply(system System, persistentState PersistentState if err != nil { return false, err } - key := []byte(hex.EncodeToString(contentsSHA256)) - if t.condition == ScriptConditionOnce { - switch scriptState, err := persistentState.Get(scriptStateBucket, key); { + + scriptStateKey := []byte(hex.EncodeToString(contentsSHA256)) + entryStateKey := actualStateEntry.Path().Bytes() + switch t.condition { + case ScriptConditionAlways: + case ScriptConditionOnce: + switch scriptState, err := persistentState.Get(scriptStateBucket, scriptStateKey); { case err != nil: return false, err case scriptState != nil: return false, nil } + case ScriptConditionOnChange: + switch entryStateBytes, err := persistentState.Get(EntryStateBucket, entryStateKey); { + case err != nil: + return false, err + case entryStateBytes != nil: + var entryState EntryState + if err := stateFormat.Unmarshal(entryStateBytes, &entryState); err != nil { + return false, err + } + if bytes.Equal(entryState.ContentsSHA256.Bytes(), contentsSHA256) { + return false, nil + } + } } + contents, err := t.Contents() if err != nil { return false, err @@ -216,10 +234,21 @@ func (t *TargetStateScript) Apply(system System, persistentState PersistentState return false, err } } - return true, persistentStateSet(persistentState, scriptStateBucket, key, &scriptState{ + + if err := persistentStateSet(persistentState, scriptStateBucket, scriptStateKey, &scriptState{ Name: string(t.name), RunAt: runAt, - }) + }); err != nil { + return false, err + } + if err := persistentStateSet(persistentState, EntryStateBucket, entryStateKey, &EntryState{ + Type: EntryStateTypeScript, + ContentsSHA256: HexBytes(contentsSHA256), + }); err != nil { + return false, err + } + + return true, nil } // EntryState returns t's entry state. diff --git a/internal/cmd/chattrcmd.go b/internal/cmd/chattrcmd.go index c5f4f8318d2..55d306a1f28 100644 --- a/internal/cmd/chattrcmd.go +++ b/internal/cmd/chattrcmd.go @@ -24,6 +24,8 @@ const ( conditionModifierLeaveUnchanged conditionModifier = iota conditionModifierClearOnce conditionModifierSetOnce + conditionModifierClearOnChange + conditionModifierSetOnChange ) type orderModifier int @@ -57,6 +59,7 @@ func (c *Config) newChattrCmd() *cobra.Command { "exact", "executable", "x", "once", "o", + "onchange", "private", "p", "readonly", "r", "template", "t", @@ -155,9 +158,19 @@ func (m conditionModifier) modify(condition chezmoi.ScriptCondition) chezmoi.Scr case conditionModifierLeaveUnchanged: return condition case conditionModifierClearOnce: - return chezmoi.ScriptConditionAlways + if condition == chezmoi.ScriptConditionOnce { + return chezmoi.ScriptConditionAlways + } + return condition case conditionModifierSetOnce: return chezmoi.ScriptConditionOnce + case conditionModifierClearOnChange: + if condition == chezmoi.ScriptConditionOnChange { + return chezmoi.ScriptConditionAlways + } + return condition + case conditionModifierSetOnChange: + return chezmoi.ScriptConditionOnChange default: panic(fmt.Sprintf("%d: unknown order modifier", m)) } @@ -245,6 +258,13 @@ func parseAttrModifier(s string) (*attrModifier, error) { case boolModifierSet: am.condition = conditionModifierSetOnce } + case "onchange": + switch bm { + case boolModifierClear: + am.condition = conditionModifierClearOnChange + case boolModifierSet: + am.condition = conditionModifierSetOnChange + } case "private", "p": am.private = bm case "readonly", "r": diff --git a/internal/cmd/testdata/scripts/chattr.txt b/internal/cmd/testdata/scripts/chattr.txt index 3694051e736..47c19351de4 100644 --- a/internal/cmd/testdata/scripts/chattr.txt +++ b/internal/cmd/testdata/scripts/chattr.txt @@ -79,9 +79,14 @@ chezmoi chattr -- after $HOME/script ! exists $CHEZMOISOURCEDIR/run_once_before_script exists $CHEZMOISOURCEDIR/run_once_after_script -# test that chezmoi chattr -- -o removes the once attribute on a script -chezmoi chattr -- -o $HOME/script +# test that chezmoi chattr onchange sets the onchange attribute on a script and removes the only attribute +chezmoi chattr -- onchange $HOME/script ! exists $CHEZMOISOURCEDIR/run_once_after_script +exists $CHEZMOISOURCEDIR/run_onchange_after_script + +# test that chezmoi chattr -- -onchange removes the onchange attribute on a script +chezmoi chattr -- -onchange $HOME/script +! exists $CHEZMOISOURCEDIR/run_onchange_after_script exists $CHEZMOISOURCEDIR/run_after_script # test that chezmoi chattr -- -a removes the after attribute on a script diff --git a/internal/cmd/testdata/scripts/scriptonchange_unix.txt b/internal/cmd/testdata/scripts/scriptonchange_unix.txt new file mode 100644 index 00000000000..347603e4a05 --- /dev/null +++ b/internal/cmd/testdata/scripts/scriptonchange_unix.txt @@ -0,0 +1,46 @@ +[windows] skip 'UNIX only' + +# test that chezmoi apply runs onchange scripts the first time +mkdir $CHEZMOISOURCEDIR +cp golden/script-one.sh $CHEZMOISOURCEDIR/run_onchange_script.sh +chezmoi apply +stdout one +chezmoi state get --bucket=entryState --key=$HOME/script.sh +cmp stdout golden/script-one-state.json + +# test that chezmoi apply does not run onchange scripts when their contents are not changed +chezmoi apply +! stdout . + +# test that chezmoi apply runs onchange scripts when their contents are changed +cp golden/script-two.sh $CHEZMOISOURCEDIR/run_onchange_script.sh +chezmoi apply +stdout two +chezmoi state get --bucket=entryState --key=$HOME/script.sh +cmp stdout golden/script-two-state.json + +# test that chezmoi apply runs onchange scripts when their contents are reverted to a previous state +cp golden/script-one.sh $CHEZMOISOURCEDIR/run_onchange_script.sh +chezmoi apply +stdout one +chezmoi state get --bucket=entryState --key=$HOME/script.sh +cmp stdout golden/script-one-state.json + +-- golden/script-one-state.json -- +{ + "type": "script", + "contentsSHA256": "a07f0271151ee0271ed379ebbddc5ef49d0f625417c8fe23254179e56f98d2df" +} +-- golden/script-two-state.json -- +{ + "type": "script", + "contentsSHA256": "7c8d714586cecf4f0ffb735ad10334df98428bc5282c0d0a6b78f5c074365159" +} +-- golden/script-one.sh -- +#!/bin/sh + +echo one +-- golden/script-two.sh -- +#!/bin/sh + +echo two
feat
Add onchange_ attribute for scripts
db63abbc07db77be63725a5cc249f96a74584e97
2023-05-14 16:25:29
Tom Payne
chore: Add missing newline in warning message
false
diff --git a/pkg/cmd/addcmd.go b/pkg/cmd/addcmd.go index 9d64eecb249..a8fcbcbafe6 100644 --- a/pkg/cmd/addcmd.go +++ b/pkg/cmd/addcmd.go @@ -58,7 +58,7 @@ func (c *Config) newAddCmd() *cobra.Command { func (c *Config) defaultOnIgnoreFunc(targetRelPath chezmoi.RelPath) { if !c.Add.quiet { - c.errorf("warning: ignoring %s", targetRelPath) + c.errorf("warning: ignoring %s\n", targetRelPath) } }
chore
Add missing newline in warning message
d0290b595b3f217b07819d63fb584f2778a4a025
2022-12-05 03:39:41
Tom Payne
chore: Update dependencies
false
diff --git a/go.mod b/go.mod index 9be44499c6d..0a8f0319c8d 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.1 - github.com/aws/aws-sdk-go-v2/config v1.18.3 - github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.8 + 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/bmatcuk/doublestar/v4 v4.4.0 github.com/bradenhilton/mozillainstallhash v1.0.0 github.com/charmbracelet/bubbles v0.14.0 @@ -15,7 +15,7 @@ require ( github.com/charmbracelet/glamour v0.6.0 github.com/coreos/go-semver v0.3.0 github.com/fsnotify/fsnotify v1.6.0 - github.com/go-git/go-git/v5 v5.4.2 + github.com/go-git/go-git/v5 v5.5.0 github.com/google/go-github/v48 v48.1.0 github.com/google/renameio/v2 v2.0.0 github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 @@ -37,10 +37,10 @@ require ( 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 - golang.org/x/exp v0.0.0-20221114191408-850992195362 + golang.org/x/exp v0.0.0-20221204150635-6dcec336b2bb golang.org/x/oauth2 v0.2.0 golang.org/x/sync v0.1.0 - golang.org/x/sys v0.2.0 + golang.org/x/sys v0.3.0 golang.org/x/term v0.2.0 gopkg.in/ini.v1 v1.67.0 gopkg.in/yaml.v3 v3.0.1 @@ -57,16 +57,16 @@ 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.3 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.19 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.26 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.11.25 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.8 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.17.5 // indirect - github.com/aws/smithy-go v1.13.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/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 @@ -86,9 +86,9 @@ require ( github.com/google/go-querystring v1.1.0 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gorilla/css v1.0.0 // indirect - github.com/huandu/xstrings v1.3.3 // indirect + github.com/huandu/xstrings v1.4.0 // indirect github.com/imdario/mergo v0.3.13 // indirect - github.com/inconshreveable/mousetrap v1.0.1 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // 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 @@ -98,18 +98,19 @@ require ( github.com/mattn/go-runewidth v0.0.14 // indirect github.com/microcosm-cc/bluemonday v1.0.21 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect - github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/muesli/ansi v0.0.0-20221106050444-61f0cd9a192a // 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.2.3 // indirect github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rivo/uniseg v0.4.3 // 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/xanzy/ssh-agent v0.3.3 // indirect github.com/yuin/goldmark v1.5.3 // indirect @@ -118,7 +119,7 @@ require ( golang.org/x/crypto v0.3.0 // indirect golang.org/x/mod v0.7.0 // indirect golang.org/x/net v0.2.0 // indirect - golang.org/x/text v0.4.0 // indirect + golang.org/x/text v0.5.0 // indirect golang.org/x/tools v0.3.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.28.1 // indirect diff --git a/go.sum b/go.sum index 9b628747a51..6ecf953c19d 100644 --- a/go.sum +++ b/go.sum @@ -1,17 +1,16 @@ +cloud.google.com/go/compute/metadata v0.2.0 h1:nBbNSZyDpkNlo3DepaaLKVuO7ClyifSAmNloSCZrHnQ= 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= 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 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= -github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= -github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= 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-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4 h1:ra2OtmuW0AE5csawV4YXMNGNQQXvLRps3z2Z59OPO+I= github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4/go.mod h1:UBYPn8k0D56RtnR8RFQMjmh4KrZzWJ5o7Z9SYjossQ8= github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= @@ -20,38 +19,38 @@ github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbf github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s= 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-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= +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.17.1 h1:02c72fDJr87N8RAC2s3Qu0YuvMRZKNZJ9F+lAehCazk= -github.com/aws/aws-sdk-go-v2 v1.17.1/go.mod h1:JLnGeGONAyi2lWXI1p0PCIOIy333JMVK1U7Hf0aRFLw= -github.com/aws/aws-sdk-go-v2/config v1.18.3 h1:3kfBKcX3votFX84dm00U8RGA1sCCh3eRMOGzg5dCWfU= -github.com/aws/aws-sdk-go-v2/config v1.18.3/go.mod h1:BYdrbeCse3ZnOD5+2/VE/nATOK8fEUpBtmPMdKSyhMU= -github.com/aws/aws-sdk-go-v2/credentials v1.13.3 h1:ur+FHdp4NbVIv/49bUjBW+FE7e57HOo03ELodttmagk= -github.com/aws/aws-sdk-go-v2/credentials v1.13.3/go.mod h1:/rOMmqYBcFfNbRPU0iN9IgGqD5+V2yp3iWNmIlz0wI4= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.19 h1:E3PXZSI3F2bzyj6XxUXdTIfvp425HHhwKsFvmzBwHgs= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.19/go.mod h1:VihW95zQpeKQWVPGkwT+2+WJNQV8UXFfMTWdU6VErL8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25 h1:nBO/RFxeq/IS5G9Of+ZrgucRciie2qpLy++3UGZ+q2E= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25/go.mod h1:Zb29PYkf42vVYQY6pvSyJCJcFHlPIiY+YKdPtwnvMkY= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19 h1:oRHDrwCTVT8ZXi4sr9Ld+EXk7N/KGssOr2ygNeojEhw= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19/go.mod h1:6Q0546uHDp421okhmmGfbxzq2hBqbXFNpi4k+Q1JnQA= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.26 h1:Mza+vlnZr+fPKFKRq/lKGVvM6B/8ZZmNdEopOwSQLms= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.26/go.mod h1:Y2OJ+P+MC1u1VKnavT+PshiEuGPyh/7DqxoDNij4/bg= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19 h1:GE25AWCdNUPh9AOJzI9KIJnja7IwUc1WyUqz/JTyJ/I= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19/go.mod h1:02CP6iuYP+IVnBX5HULVdSAku/85eHB2Y9EsFhrkEwU= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.8 h1:Zw48FHykP40fKMxPmagkuzklpEuDPLhvUjKP8Ygrds0= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.8/go.mod h1:k6CPuxyzO247nYEM1baEwHH1kRtosRCvgahAepaaShw= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.25 h1:GFZitO48N/7EsFDt8fMa5iYdmWqkUDDB3Eje6z3kbG0= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.25/go.mod h1:IARHuzTXmj1C0KS35vboR0FeJ89OkEy1M9mWbK2ifCI= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.8 h1:jcw6kKZrtNfBPJkaHrscDOZoe5gvi9wjudnxvozYFJo= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.8/go.mod h1:er2JHN+kBY6FcMfcBBKNGCT3CarImmdFzishsqBmSRI= -github.com/aws/aws-sdk-go-v2/service/sts v1.17.5 h1:60SJ4lhvn///8ygCzYy2l53bFW/Q15bVfyjyAWo6zuw= -github.com/aws/aws-sdk-go-v2/service/sts v1.17.5/go.mod h1:bXcN3koeVYiJcdDU89n3kCYILob7Y34AeLopUbZgLT4= -github.com/aws/smithy-go v1.13.4 h1:/RN2z1txIJWeXeOkzX+Hk/4Uuvv7dWtCjbmVJcrskyk= -github.com/aws/smithy-go v1.13.4/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +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/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= @@ -64,6 +63,7 @@ github.com/bradenhilton/cityhash v1.0.0/go.mod h1:Wmb8yW1egA9ulrsRX4mxfYx5zq4nBW 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/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.14.0 h1:DJfCwnARfWjZLvMglhSQzo76UZ2gucuHPy9jLWX45Og= github.com/charmbracelet/bubbles v0.14.0/go.mod h1:bbeTiXwPww4M031aGi8UK2HT9RDWoiNibae+1yCMtcc= github.com/charmbracelet/bubbletea v0.21.0/go.mod h1:GgmJMec61d08zXsOhqRC/AiOx4K4pmz+VIcRIm1FKr4= @@ -83,9 +83,12 @@ 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.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.3-0.20220203105225-a9a7ef127534 h1:rtAn27wIbmOGUs7RIbVgPEjb31ehTVniDwPGXyMxm5U= github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/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/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI= github.com/danieljoos/wincred v1.1.0/go.mod h1:XYlo+eRTsVA9aHGp7NGjFkPla4m+DCL7hqDjlFjiygg= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= @@ -95,24 +98,21 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= 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.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= -github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +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.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= -github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34= github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-git-fixtures/v4 v4.2.1 h1:n9gGL1Ct/yIw+nfsfr8s4+sbhT+Ncu2SubfXjIWgci8= -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-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.5.0 h1:StO/ASRvk1Pp74tr7XQ0pQwKlCFignzzTF/NLKdQzUE= +github.com/go-git/go-git/v5 v5.5.0/go.mod h1:g456XI30HAdt7GQtIf8JR6GDAdULGaR4KtfFtQa0uTg= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= @@ -124,15 +124,16 @@ github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 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/v48 v48.1.0 h1:nqPqq+0oRY2AMR/SRskGrrP4nnewPB7e/m2+kbT/UvM= github.com/google/go-github/v48 v48.1.0/go.mod h1:dDlehKBDo850ZPvCTK0sEqTCVWcrGl2LcDiajkYi89Y= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/google/renameio v1.0.1 h1:Lh/jXZmvZxb0BBeSY5VKEfidcbcbenKjZFzM/q0fSeU= github.com/google/renameio/v2 v2.0.0 h1:UifI23ZTGY8Tt29JbYFiuyIU3eX+RNFtUwefq9qAhxg= github.com/google/renameio/v2 v2.0.0/go.mod h1:BtmJXm5YlszgC+TD4HOEEUFgkJP3nLxehU6hfe7jRt4= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -142,31 +143,35 @@ 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/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +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.12/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/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= 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= 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/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/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/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 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.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +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= @@ -191,8 +196,6 @@ github.com/microcosm-cc/bluemonday v1.0.21/go.mod h1:ytNkv4RrDrLJ2pqlsSI46O6IVXm github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= @@ -213,6 +216,7 @@ github.com/muesli/termenv v0.11.1-0.20220204035834-5ac8409525e0/go.mod h1:Bd5NYQ github.com/muesli/termenv v0.11.1-0.20220212125758-44cd13922739/go.mod h1:Bd5NYQ7pd+SrtBSrSNoBBmXlcY8+Xj4BMJgh8qcZrvs= github.com/muesli/termenv v0.13.0 h1:wK20DRpJdDX8b7Ek2QfhvqhRQFZ237RGRO0RQ/Iqdy0= github.com/muesli/termenv v0.13.0/go.mod h1:sP1+uffeLaEYpyOTb8pLCUctGcGLnoFjSn4YJK5e2bc= +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= @@ -220,9 +224,11 @@ github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvI github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/pjbgf/sha1cd v0.2.0/go.mod h1:HOK9QrgzdHpbc2Kzip0Q1yi3M2MFGPADtR6HjG65m5M= +github.com/pjbgf/sha1cd v0.2.3 h1:uKQP/7QOzNtKYH7UTohZLcjF5/55EnTw0jO/Ru4jZwI= +github.com/pjbgf/sha1cd v0.2.3/go.mod h1:HOK9QrgzdHpbc2Kzip0Q1yi3M2MFGPADtR6HjG65m5M= 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.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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= @@ -233,18 +239,23 @@ github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +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.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY= github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= +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/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/skeema/knownhosts v1.1.0 h1:Wvr9V0MxhjRbl3f9nMnKnFfiWTJmtECJ9Njkea3ysW0= +github.com/skeema/knownhosts v1.1.0/go.mod h1:sKFq3RD6/TKZkSWn8boUbDC7Qkgcv+8XXijpFO6roag= 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= @@ -253,7 +264,6 @@ github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUq github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -278,7 +288,7 @@ 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/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.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= +github.com/xanzy/ssh-agent v0.3.2/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -297,25 +307,24 @@ 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= -golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= 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= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/exp v0.0.0-20221114191408-850992195362 h1:NoHlPRbyl1VFI6FjwHtPQCN7wAMXI6cKcqrmXhOOfBQ= -golang.org/x/exp v0.0.0-20221114191408-850992195362/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20221204150635-6dcec336b2bb h1:QIsP/NmClBICkqnJ4rSIhnrGiGR7Yv9ZORGGnmmLTPk= +golang.org/x/exp v0.0.0-20221204150635-6dcec336b2bb/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= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= @@ -325,18 +334,13 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/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-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -350,11 +354,14 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/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-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -362,8 +369,9 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 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= @@ -371,6 +379,7 @@ golang.org/x/tools v0.3.0 h1:SrNbZl6ECOS1qFzgTdQfWXZM9XBkiA6tkFrH9YSTPHM= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= 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= @@ -382,10 +391,12 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8= 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= @@ -400,5 +411,6 @@ 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.5.1 h1:hmP3UOw4f+EYexsJjFxvU38+kn+V/s2CclXHanIBkmQ= mvdan.cc/sh/v3 v3.5.1/go.mod h1:1JcoyAKm1lZw/2bZje/iYKWicU/KMd0rsyJeKHnsK4E=
chore
Update dependencies
6dcbf754de52ea4632f130f70c170db7b1b8118e
2022-10-10 02:28:44
Felipe Santos
chore: Add workflow to push get.chezmoi.io files
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 041dc518678..3828f1209eb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -416,3 +416,17 @@ jobs: gh release upload v${VERSION} dist/checksums.txt env: GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} + - name: prepare-get.chezmoi.io + run: | + cp assets/scripts/install.sh assets/get.chezmoi.io/index.html + cp LICENSE assets/get.chezmoi.io/LICENSE + - name: push-get.chezmoi.io + uses: cpina/github-action-push-to-another-repository@9e487f29582587eeb4837c0552c886bb0644b6b9 + env: + SSH_DEPLOY_KEY: ${{ secrets.GET_CHEZMOI_IO_SSH_DEPLOY_KEY }} + with: + source-directory: assets/get.chezmoi.io + destination-github-username: chezmoi + destination-repository-name: get.chezmoi.io + target-branch: gh-pages + commit-message: 'chore: Update from ORIGIN_COMMIT' diff --git a/assets/get.chezmoi.io/.nojekyll b/assets/get.chezmoi.io/.nojekyll new file mode 100644 index 00000000000..e69de29bb2d diff --git a/assets/get.chezmoi.io/CNAME b/assets/get.chezmoi.io/CNAME new file mode 100644 index 00000000000..f86f0345fe7 --- /dev/null +++ b/assets/get.chezmoi.io/CNAME @@ -0,0 +1 @@ +get.chezmoi.io
chore
Add workflow to push get.chezmoi.io files
65a5aefec6ed9162f76d2b6bd92fe6a305c4c857
2024-01-25 19:54:29
Tom Payne
chore: Update GitHub Actions
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7cc2a8f8b8b..b6197e53069 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: filter - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 + uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd with: filters: | code: @@ -190,31 +190,31 @@ jobs: args: release --skip=sign --snapshot --timeout=1h - name: upload-artifact-chezmoi-darwin-amd64 if: github.event_name == 'push' || needs.changes.outputs.code == 'true' - uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595 + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 with: name: chezmoi-darwin-amd64 path: dist/chezmoi-nocgo_darwin_amd64_v1/chezmoi - name: upload-artifact-chezmoi-darwin-arm64 if: github.event_name == 'push' || needs.changes.outputs.code == 'true' - uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595 + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 with: name: chezmoi-darwin-arm64 path: dist/chezmoi-nocgo_darwin_arm64/chezmoi - name: upload-artifact-chezmoi-linux-amd64 if: github.event_name == 'push' || needs.changes.outputs.code == 'true' - uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595 + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 with: name: chezmoi-linux-amd64 path: dist/chezmoi-cgo-glibc_linux_amd64_v1/chezmoi - name: upload-artifact-chezmoi-linux-musl-amd64 if: github.event_name == 'push' || needs.changes.outputs.code == 'true' - uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595 + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 with: name: chezmoi-linux-amd64-musl path: dist/chezmoi-cgo-musl_linux_amd64_v1/chezmoi - name: upload-artifact-chezmoi-windows-amd64.exe if: github.event_name == 'push' || needs.changes.outputs.code == 'true' - uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595 + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 with: name: chezmoi-windows-amd64 path: dist/chezmoi-nocgo_windows_amd64_v1/chezmoi.exe @@ -288,7 +288,7 @@ jobs: - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 with: go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c + - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
chore
Update GitHub Actions
0d38b65cb1025ca9bb8806936aaa5cdfe7d6bd22
2021-12-26 05:41:22
Tom Payne
docs: Add link to blog post
false
diff --git a/docs/MEDIA.md b/docs/MEDIA.md index f4cf5aa3c96..9adaa02482a 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-12-23 | 2.9.3 | Text | [Use Chezmoi to guarantee idempotency of terminal](https://www.wazaterm.com/blog/advent-calendar-2021/use-chezmoi-to-guarantee-idempotency-of-terminal) | | 2021-12-20 | 2.9.3 | Text | [How chezmoi Implements Cross-Platform CI](https://gopheradvent.com/calendar/2021/how-chezmoi-implements-cross-platform-ci/) | | 2021-12-08 | 2.9.3 | Video | [How Go makes chezmoi possible](https://www.youtube.com/watch?v=5XiewS8ZbH8&t=1044s) | | 2021-12-04 | 2.9.2 | Text | [Advanced features of Chezmoi](https://zerokspot.com/weblog/2021/12/04/advanced-chezmoi/) |
docs
Add link to blog post
94f00d11d79581d5bc755574861a22b7716d81b0
2025-01-05 07:39:41
Tom Payne
chore: Update tools
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 95df9a080dd..60ec798d00c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,14 +14,14 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true env: - ACTIONLINT_VERSION: 1.7.5 # https://github.com/rhysd/actionlint/releases + ACTIONLINT_VERSION: 1.7.6 # https://github.com/rhysd/actionlint/releases AGE_VERSION: 1.2.1 # https://github.com/FiloSottile/age/releases CHOCOLATEY_VERSION: 2.4.1 # 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.4 # https://go.dev/doc/devel/release GOFUMPT_VERSION: 0.7.0 # https://github.com/mvdan/gofumpt/releases - GOLANGCI_LINT_VERSION: 1.63.3 # https://github.com/golangci/golangci-lint/releases + GOLANGCI_LINT_VERSION: 1.63.4 # https://github.com/golangci/golangci-lint/releases GOLINES_VERSION: 0.12.2 # https://github.com/segmentio/golines/releases GORELEASER_VERSION: 2.5.1 # https://github.com/goreleaser/goreleaser/releases GOVERSIONINFO_VERSION: 1.4.1 # https://github.com/josephspurrier/goversioninfo/releases
chore
Update tools
0670bb9f5cdce3f9ee71de9e7383c20d3a71cd61
2021-12-23 02:11:54
Tom Payne
chore: Fix install script for 386 architecture
false
diff --git a/assets/scripts/install.sh b/assets/scripts/install.sh index b3172106400..48f5e79661c 100644 --- a/assets/scripts/install.sh +++ b/assets/scripts/install.sh @@ -65,9 +65,13 @@ main() { FORMAT=zip ;; esac + case "${GOARCH}" in + 386) arch=i386 ;; + *) arch="${GOARCH}" ;; + esac # download tarball - NAME="chezmoi_${VERSION}_${GOOS}${GOOS_EXTRA}_${GOARCH}" + NAME="chezmoi_${VERSION}_${GOOS}${GOOS_EXTRA}_${arch}" TARBALL="${NAME}.${FORMAT}" TARBALL_URL="${GITHUB_DOWNLOAD}/${TAG}/${TARBALL}" http_download "${tmpdir}/${TARBALL}" "${TARBALL_URL}" || exit 1 @@ -132,13 +136,12 @@ get_goos() { get_goarch() { arch=$(uname -m) case "${arch}" in - 386) goarch="i386" ;; aarch64) goarch="arm64" ;; armv*) goarch="arm" ;; - i386) goarch="i386" ;; - i686) goarch="i386" ;; + i386) goarch="386" ;; + i686) goarch="386" ;; i86pc) goarch="amd64" ;; - x86) goarch="i386" ;; + x86) goarch="386" ;; x86_64) goarch="amd64" ;; *) goarch="${arch}" ;; esac diff --git a/internal/cmds/generate-install.sh/install.sh.tmpl b/internal/cmds/generate-install.sh/install.sh.tmpl index 459e0429f8a..9e95209c1e0 100644 --- a/internal/cmds/generate-install.sh/install.sh.tmpl +++ b/internal/cmds/generate-install.sh/install.sh.tmpl @@ -65,9 +65,13 @@ main() { FORMAT=zip ;; esac + case "${GOARCH}" in + 386) arch=i386 ;; + *) arch="${GOARCH}" ;; + esac # download tarball - NAME="chezmoi_${VERSION}_${GOOS}${GOOS_EXTRA}_${GOARCH}" + NAME="chezmoi_${VERSION}_${GOOS}${GOOS_EXTRA}_${arch}" TARBALL="${NAME}.${FORMAT}" TARBALL_URL="${GITHUB_DOWNLOAD}/${TAG}/${TARBALL}" http_download "${tmpdir}/${TARBALL}" "${TARBALL_URL}" || exit 1 @@ -132,13 +136,12 @@ get_goos() { get_goarch() { arch=$(uname -m) case "${arch}" in - 386) goarch="i386" ;; aarch64) goarch="arm64" ;; armv*) goarch="arm" ;; - i386) goarch="i386" ;; - i686) goarch="i386" ;; + i386) goarch="386" ;; + i686) goarch="386" ;; i86pc) goarch="amd64" ;; - x86) goarch="i386" ;; + x86) goarch="386" ;; x86_64) goarch="amd64" ;; *) goarch="${arch}" ;; esac
chore
Fix install script for 386 architecture
a61cead73bb4ca2210d1cc154604f5cfdf998ca3
2022-07-20 01:16:06
Tom Payne
chore: Update golangci-lint to v1.47.1
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b2bbc857250..f08f25ca5b2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ env: AGE_VERSION: 1.0.0 GO_VERSION: 1.18.4 GOFUMPT_VERSION: 0.3.1 - GOLANGCI_LINT_VERSION: 1.46.2 + GOLANGCI_LINT_VERSION: 1.47.1 TPARSE_VERSION: 0.11.1 jobs: changes: diff --git a/.golangci.yml b/.golangci.yml index 9b4a8f00164..0dd10a26b89 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -62,6 +62,7 @@ linters: - wastedassign - whitespace disable: + - asasalint - cyclop - exhaustive - exhaustivestruct @@ -82,6 +83,7 @@ linters: - nilnil - nlreturn - nonamedreturns + - nosnakecase - paralleltest - testpackage - tparallel
chore
Update golangci-lint to v1.47.1
c4177981af985b5a696d591d3443f95ab249b806
2024-08-01 05:31:14
Tom Payne
chore: Don't assume that bzip2 is installed in tests
false
diff --git a/internal/cmd/testdata/scripts/externalguess.txtar b/internal/cmd/testdata/scripts/externalguess.txtar index f33e9e4b802..8a6ee3b8793 100644 --- a/internal/cmd/testdata/scripts/externalguess.txtar +++ b/internal/cmd/testdata/scripts/externalguess.txtar @@ -9,10 +9,10 @@ exec chezmoi apply --force --refresh-externals cmp $HOME/.dir/dir/file golden/dir/file # test that chezmoi sniffs the format of tar.bz2 files -exec tar -cjf www/archive.tar.bz2 archive/ -cp www/archive.tar.bz2 www/archive -exec chezmoi apply --force --refresh-externals -cmp $HOME/.dir/dir/file golden/dir/file +[exec:bzip2] exec tar -cjf www/archive.tar.bz2 archive/ +[exec:bzip2] cp www/archive.tar.bz2 www/archive +[exec:bzip2] exec chezmoi apply --force --refresh-externals +[exec:bzip2] cmp $HOME/.dir/dir/file golden/dir/file # test that chezmoi sniffs the format of tar.gz files exec tar -czf www/archive.tar.gz archive/
chore
Don't assume that bzip2 is installed in tests
8645544b2c1b3ee9b7e7035a76d7c6cf41d3c26d
2023-11-05 01:33:11
Tom Payne
chore: Bump golangci-lint to v1.55.2
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4d1830a159e..82a0929c383 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ env: CHOCOLATEY_VERSION: 2.2.2 GO_VERSION: 1.21.3 GOFUMPT_VERSION: 0.5.0 - GOLANGCI_LINT_VERSION: 1.55.1 + GOLANGCI_LINT_VERSION: 1.55.2 GOLINES_VERSION: 0.11.0 GOVERSIONINFO_VERSION: 1.4.0 FIND_TYPOS_VERSION: 0.0.3
chore
Bump golangci-lint to v1.55.2
1abcfa5f771ae26a2b17c9036e806b9290ef1495
2024-02-22 23:34:58
Tom Payne
fix: Fix panic when merging unmanaged file
false
diff --git a/internal/cmd/catcmd.go b/internal/cmd/catcmd.go index 0d93a2c24b3..0014943424b 100644 --- a/internal/cmd/catcmd.go +++ b/internal/cmd/catcmd.go @@ -27,9 +27,7 @@ func (c *Config) newCatCmd() *cobra.Command { } func (c *Config) runCatCmd(cmd *cobra.Command, args []string, sourceState *chezmoi.SourceState) error { - targetRelPaths, err := c.targetRelPaths(sourceState, args, targetRelPathsOptions{ - mustBeManaged: true, - }) + targetRelPaths, err := c.targetRelPaths(sourceState, args, nil) if err != nil { return err } diff --git a/internal/cmd/chattrcmd.go b/internal/cmd/chattrcmd.go index 057f2d94ac9..689b3f1dc22 100644 --- a/internal/cmd/chattrcmd.go +++ b/internal/cmd/chattrcmd.go @@ -150,9 +150,8 @@ func (c *Config) runChattrCmd(cmd *cobra.Command, args []string, sourceState *ch return err } - targetRelPaths, err := c.targetRelPaths(sourceState, args[1:], targetRelPathsOptions{ - mustBeManaged: true, - recursive: c.chattr.recursive, + targetRelPaths, err := c.targetRelPaths(sourceState, args[1:], &targetRelPathsOptions{ + recursive: c.chattr.recursive, }) if err != nil { return err diff --git a/internal/cmd/config.go b/internal/cmd/config.go index ea779703f08..ae496cf0de5 100644 --- a/internal/cmd/config.go +++ b/internal/cmd/config.go @@ -631,9 +631,8 @@ func (c *Config) applyArgs( return err } default: - targetRelPaths, err = c.targetRelPaths(sourceState, args, targetRelPathsOptions{ - mustBeManaged: true, - recursive: options.recursive, + targetRelPaths, err = c.targetRelPaths(sourceState, args, &targetRelPathsOptions{ + recursive: options.recursive, }) if err != nil { return err @@ -2437,9 +2436,8 @@ func (c *Config) setEnvironmentVariables() 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) { - targetRelPaths, err := c.targetRelPaths(sourceState, args, targetRelPathsOptions{ + targetRelPaths, err := c.targetRelPaths(sourceState, args, &targetRelPathsOptions{ mustBeInSourceState: true, - mustBeManaged: true, }) if err != nil { return nil, err @@ -2462,7 +2460,6 @@ func (c *Config) targetRelPath(absPath chezmoi.AbsPath) (chezmoi.RelPath, error) type targetRelPathsOptions struct { mustBeInSourceState bool - mustBeManaged bool recursive bool } @@ -2471,7 +2468,7 @@ type targetRelPathsOptions struct { func (c *Config) targetRelPaths( sourceState *chezmoi.SourceState, args []string, - options targetRelPathsOptions, + options *targetRelPathsOptions, ) (chezmoi.RelPaths, error) { targetRelPaths := make(chezmoi.RelPaths, 0, len(args)) for _, arg := range args { @@ -2484,16 +2481,16 @@ func (c *Config) targetRelPaths( return nil, err } sourceStateEntry := sourceState.Get(targetRelPath) - if options.mustBeManaged && sourceStateEntry == nil { + if sourceStateEntry == nil { return nil, fmt.Errorf("%s: not managed", arg) } - if options.mustBeInSourceState { + if options != nil && options.mustBeInSourceState { if _, ok := sourceStateEntry.(*chezmoi.SourceStateRemove); ok { return nil, fmt.Errorf("%s: not in source state", arg) } } targetRelPaths = append(targetRelPaths, targetRelPath) - if options.recursive { + if options != nil && options.recursive { parentRelPath := targetRelPath // FIXME we should not call s.TargetRelPaths() here - risk of // accidentally quadratic diff --git a/internal/cmd/editcmd.go b/internal/cmd/editcmd.go index 8a55bb38511..8a9ad256418 100644 --- a/internal/cmd/editcmd.go +++ b/internal/cmd/editcmd.go @@ -76,9 +76,8 @@ func (c *Config) runEditCmd(cmd *cobra.Command, args []string) error { return err } - targetRelPaths, err := c.targetRelPaths(sourceState, args, targetRelPathsOptions{ + targetRelPaths, err := c.targetRelPaths(sourceState, args, &targetRelPathsOptions{ mustBeInSourceState: true, - mustBeManaged: true, }) if err != nil { return err diff --git a/internal/cmd/forgetcmd.go b/internal/cmd/forgetcmd.go index 62d1e737185..7ce64f4e9a8 100644 --- a/internal/cmd/forgetcmd.go +++ b/internal/cmd/forgetcmd.go @@ -28,9 +28,7 @@ func (c *Config) newForgetCmd() *cobra.Command { } func (c *Config) runForgetCmd(cmd *cobra.Command, args []string, sourceState *chezmoi.SourceState) error { - targetRelPaths, err := c.targetRelPaths(sourceState, args, targetRelPathsOptions{ - mustBeManaged: true, - }) + targetRelPaths, err := c.targetRelPaths(sourceState, args, nil) if err != nil { return err } diff --git a/internal/cmd/mergecmd.go b/internal/cmd/mergecmd.go index 3ed2a4a739f..17d95663477 100644 --- a/internal/cmd/mergecmd.go +++ b/internal/cmd/mergecmd.go @@ -37,9 +37,8 @@ func (c *Config) newMergeCmd() *cobra.Command { } func (c *Config) runMergeCmd(cmd *cobra.Command, args []string, sourceState *chezmoi.SourceState) error { - targetRelPaths, err := c.targetRelPaths(sourceState, args, targetRelPathsOptions{ + targetRelPaths, err := c.targetRelPaths(sourceState, args, &targetRelPathsOptions{ mustBeInSourceState: true, - mustBeManaged: false, recursive: true, }) if err != nil { diff --git a/internal/cmd/readdcmd.go b/internal/cmd/readdcmd.go index 92b899939ea..544d1b9c1e0 100644 --- a/internal/cmd/readdcmd.go +++ b/internal/cmd/readdcmd.go @@ -52,9 +52,8 @@ func (c *Config) runReAddCmd(cmd *cobra.Command, args []string, sourceState *che ) } else { var err error - targetRelPaths, err = c.targetRelPaths(sourceState, args, targetRelPathsOptions{ - mustBeManaged: true, - recursive: c.reAdd.recursive, + targetRelPaths, err = c.targetRelPaths(sourceState, args, &targetRelPathsOptions{ + recursive: c.reAdd.recursive, }) if err != nil { return err diff --git a/internal/cmd/removecmd.go b/internal/cmd/removecmd.go index 88f2e806ae0..1c0df4a875b 100644 --- a/internal/cmd/removecmd.go +++ b/internal/cmd/removecmd.go @@ -37,9 +37,8 @@ func (c *Config) newRemoveCmd() *cobra.Command { } 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, + targetRelPaths, err := c.targetRelPaths(sourceState, args, &targetRelPathsOptions{ + recursive: c.remove.recursive, }) if err != nil { return err
fix
Fix panic when merging unmanaged file
cfe232bc671fd8b3146e00acc6be42abc16da956
2024-10-25 01:19:07
Tom Payne
chore: Update dependencies
false
diff --git a/go.mod b/go.mod index a46449d0909..a9b2675fa40 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/bmatcuk/doublestar/v4 v4.7.1 github.com/bradenhilton/mozillainstallhash v1.0.1 github.com/charmbracelet/bubbles v0.20.0 - github.com/charmbracelet/bubbletea v1.1.1 + github.com/charmbracelet/bubbletea v1.1.2 github.com/charmbracelet/glamour v0.8.0 github.com/coreos/go-semver v0.3.1 github.com/fsnotify/fsnotify v1.7.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.1 // indirect - github.com/charmbracelet/x/ansi v0.3.2 // indirect + github.com/charmbracelet/x/ansi v0.4.0 // indirect github.com/charmbracelet/x/term v0.2.0 // indirect github.com/cloudflare/circl v1.5.0 // indirect github.com/creack/pty/v2 v2.0.0-20231209135443-03db72c7b76c // indirect diff --git a/go.sum b/go.sum index 0d462172e35..52308430e68 100644 --- a/go.sum +++ b/go.sum @@ -119,16 +119,16 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 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.1 h1:KJ2/DnmpfqFtDNVTvYZ6zpPFL9iRCRr0qqKOCvppbPY= -github.com/charmbracelet/bubbletea v1.1.1/go.mod h1:9Ogk0HrdbHolIKHdjfFpyXJmiCzGwy+FesYkZr7hYU4= +github.com/charmbracelet/bubbletea v1.1.2 h1:naQXF2laRxyLyil/i7fxdpiz1/k06IKquhm4vBfHsIc= +github.com/charmbracelet/bubbletea v1.1.2/go.mod h1:9HIU/hBV24qKjlehyj8z1r/tR9TYTQEag+cWZnuXo8E= 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.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/ansi v0.4.0 h1:NqwHA4B23VwsDn4H3VcNX1W1tOmgnvY1NDx5tOXdnOU= +github.com/charmbracelet/x/ansi v0.4.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=
chore
Update dependencies
b18b769fb75b7d2f89df651dc4076501ce6ebe6b
2024-08-15 18:20:53
Tom Payne
chore: Update GitHub Actions
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c59bcf3c24e..fa068b311ab 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -202,31 +202,31 @@ jobs: args: release --skip=sign --snapshot --timeout=1h - name: upload-artifact-chezmoi-darwin-amd64 if: github.event_name == 'push' || needs.changes.outputs.code == 'true' - uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a with: name: chezmoi-darwin-amd64 path: dist/chezmoi-nocgo_darwin_amd64_v1/chezmoi - name: upload-artifact-chezmoi-darwin-arm64 if: github.event_name == 'push' || needs.changes.outputs.code == 'true' - uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a with: name: chezmoi-darwin-arm64 path: dist/chezmoi-nocgo_darwin_arm64/chezmoi - name: upload-artifact-chezmoi-linux-amd64 if: github.event_name == 'push' || needs.changes.outputs.code == 'true' - uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a with: name: chezmoi-linux-amd64 path: dist/chezmoi-cgo-glibc_linux_amd64_v1/chezmoi - name: upload-artifact-chezmoi-linux-musl-amd64 if: github.event_name == 'push' || needs.changes.outputs.code == 'true' - uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a with: name: chezmoi-linux-amd64-musl path: dist/chezmoi-cgo-musl_linux_amd64_v1/chezmoi - name: upload-artifact-chezmoi-windows-amd64.exe if: github.event_name == 'push' || needs.changes.outputs.code == 'true' - uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a with: name: chezmoi-windows-amd64 path: dist/chezmoi-nocgo_windows_amd64_v1/chezmoi.exe @@ -422,7 +422,7 @@ jobs: - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 with: go-version: ${{ env.GO_VERSION }} - - uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 + - uses: sigstore/cosign-installer@4959ce089c160fddf62f7b42464195ba1a56d382 - name: create-syso run: | make create-syso
chore
Update GitHub Actions
6066035b3353acd16af68b8f3e7b2c6aa66740f5
2025-02-08 01:54:24
Tom Payne
chore: Update goreleaser config
false
diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 9ae26a03e55..b3fc29b8983 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -102,7 +102,8 @@ archives: {{- else }}{{ .Arch }}{{ end -}} format_overrides: - goos: windows - format: zip + formats: + - zip - id: glibc builds: - chezmoi-cgo-glibc
chore
Update goreleaser config
8d052c0fce305c97a5bc9c960929cbdc1094c5a9
2022-03-24 13:54:52
Austin Ziegler
fix: Fix op signin for 1Password CLI 2.0.0
false
diff --git a/pkg/cmd/onepasswordtemplatefuncs.go b/pkg/cmd/onepasswordtemplatefuncs.go index 127e9ff05a8..feea0bd13d7 100644 --- a/pkg/cmd/onepasswordtemplatefuncs.go +++ b/pkg/cmd/onepasswordtemplatefuncs.go @@ -241,12 +241,22 @@ func (c *Config) onepasswordGetOrRefreshSessionToken(args *onepasswordArgs) (str } var commandArgs []string + if args.account == "" { commandArgs = []string{"signin", "--raw"} } else { sessionToken = os.Getenv("OP_SESSION_" + args.account) - commandArgs = []string{"signin", args.account, "--raw"} + + switch { + case c.Onepassword.version.Major < 2: + commandArgs = []string{"signin", args.account, "--raw"} + case c.Onepassword.version.Major < 3: + commandArgs = []string{"signin", "--account", args.account, "--raw"} + default: + return "", fmt.Errorf("unsupported version of op, got %s", c.Onepassword.version.String()) + } } + if sessionToken != "" { commandArgs = append([]string{"--session", sessionToken}, commandArgs...) } diff --git a/pkg/cmd/testdata/scripts/onepassword.txt b/pkg/cmd/testdata/scripts/onepassword.txt index 8dea39c3b2b..c170f1ced50 100644 --- a/pkg/cmd/testdata/scripts/onepassword.txt +++ b/pkg/cmd/testdata/scripts/onepassword.txt @@ -5,6 +5,14 @@ chezmoi execute-template '{{ (onepassword "ExampleLogin").uuid }}' stdout '^wxcplh5udshnonkzg2n4qx262y$' +# test onepassword template function with vault and account +chezmoi execute-template '{{ (onepassword "ExampleLogin" "vault" "account").uuid }}' +stdout '^wxcplh5udshnonkzg2n4qx262y$' + +# test onepassword template function with empty vault and account +chezmoi execute-template '{{ (onepassword "ExampleLogin" "" "account").uuid }}' +stdout '^wxcplh5udshnonkzg2n4qx262y$' + # test onepasswordDetailsFields template function chezmoi execute-template '{{ (onepasswordDetailsFields "ExampleLogin").password.value }}' stdout '^L8rm1JXJIE1b8YUDWq7h$' @@ -20,10 +28,10 @@ case "$*" in "--version") echo 1.3.0 ;; -"get item ExampleLogin" | "--session thisIsAFakeSessionToken get item ExampleLogin") +"get item ExampleLogin" | "get item ExampleLogin --vault vault --account account" | "--session thisIsAFakeSessionToken get item ExampleLogin" | "--session thisIsAFakeSessionToken get item ExampleLogin --vault vault --account account" | "--session thisIsAFakeSessionToken get item ExampleLogin --vault --account account") echo '{"uuid":"wxcplh5udshnonkzg2n4qx262y","templateUuid":"001","trashed":"N","createdAt":"2020-07-28T13:44:57Z","updatedAt":"2020-07-28T14:27:46Z","changerUuid":"VBDXOA4MPVHONK5IIJVKUQGLXM","itemVersion":2,"vaultUuid":"tscpxgi6s7c662jtqn3vmw4n5a","details":{"fields":[{"designation":"username","name":"username","type":"T","value":"exampleuser"},{"designation":"password","name":"password","type":"P","value":"L8rm1JXJIE1b8YUDWq7h"}],"notesPlain":"","passwordHistory":[],"sections":[{"name":"linked items","title":"Related Items"},{"fields":[{"k":"string","n":"D4328E0846D2461E8E455D7A07B93397","t":"exampleLabel","v":"exampleValue"}],"name":"Section_20E0BD380789477D8904F830BFE8A121","title":""}]},"overview":{"URLs":[{"l":"website","u":"https://www.example.com/"}],"ainfo":"exampleuser","pbe":119.083926,"pgrng":true,"ps":100,"tags":[],"title":"ExampleLogin","url":"https://www.example.com/"}}' ;; -"signin --raw") +"signin --raw" | "signin account --raw") echo 'thisIsAFakeSessionToken' ;; *) @@ -36,10 +44,20 @@ IF "%*" == "--version" ( echo 1.3.0 ) ELSE IF "%*" == "get item ExampleLogin" ( echo.{"uuid":"wxcplh5udshnonkzg2n4qx262y","templateUuid":"001","trashed":"N","createdAt":"2020-07-28T13:44:57Z","updatedAt":"2020-07-28T14:27:46Z","changerUuid":"VBDXOA4MPVHONK5IIJVKUQGLXM","itemVersion":2,"vaultUuid":"tscpxgi6s7c662jtqn3vmw4n5a","details":{"fields":[{"designation":"username","name":"username","type":"T","value":"exampleuser"},{"designation":"password","name":"password","type":"P","value":"L8rm1JXJIE1b8YUDWq7h"}],"notesPlain":"","passwordHistory":[],"sections":[{"name":"linked items","title":"Related Items"},{"fields":[{"k":"string","n":"D4328E0846D2461E8E455D7A07B93397","t":"exampleLabel","v":"exampleValue"}],"name":"Section_20E0BD380789477D8904F830BFE8A121","title":""}]},"overview":{"URLs":[{"l":"website","u":"https://www.example.com/"}],"ainfo":"exampleuser","pbe":119.083926,"pgrng":true,"ps":100,"tags":[],"title":"ExampleLogin","url":"https://www.example.com/"}} +) ELSE IF "%*" == "get item ExampleLogin --vault vault --account account" ( + echo.{"uuid":"wxcplh5udshnonkzg2n4qx262y","templateUuid":"001","trashed":"N","createdAt":"2020-07-28T13:44:57Z","updatedAt":"2020-07-28T14:27:46Z","changerUuid":"VBDXOA4MPVHONK5IIJVKUQGLXM","itemVersion":2,"vaultUuid":"tscpxgi6s7c662jtqn3vmw4n5a","details":{"fields":[{"designation":"username","name":"username","type":"T","value":"exampleuser"},{"designation":"password","name":"password","type":"P","value":"L8rm1JXJIE1b8YUDWq7h"}],"notesPlain":"","passwordHistory":[],"sections":[{"name":"linked items","title":"Related Items"},{"fields":[{"k":"string","n":"D4328E0846D2461E8E455D7A07B93397","t":"exampleLabel","v":"exampleValue"}],"name":"Section_20E0BD380789477D8904F830BFE8A121","title":""}]},"overview":{"URLs":[{"l":"website","u":"https://www.example.com/"}],"ainfo":"exampleuser","pbe":119.083926,"pgrng":true,"ps":100,"tags":[],"title":"ExampleLogin","url":"https://www.example.com/"}} +) ELSE IF "%*" == "get item ExampleLogin --vault '''' --account account" ( + echo.{"uuid":"wxcplh5udshnonkzg2n4qx262y","templateUuid":"001","trashed":"N","createdAt":"2020-07-28T13:44:57Z","updatedAt":"2020-07-28T14:27:46Z","changerUuid":"VBDXOA4MPVHONK5IIJVKUQGLXM","itemVersion":2,"vaultUuid":"tscpxgi6s7c662jtqn3vmw4n5a","details":{"fields":[{"designation":"username","name":"username","type":"T","value":"exampleuser"},{"designation":"password","name":"password","type":"P","value":"L8rm1JXJIE1b8YUDWq7h"}],"notesPlain":"","passwordHistory":[],"sections":[{"name":"linked items","title":"Related Items"},{"fields":[{"k":"string","n":"D4328E0846D2461E8E455D7A07B93397","t":"exampleLabel","v":"exampleValue"}],"name":"Section_20E0BD380789477D8904F830BFE8A121","title":""}]},"overview":{"URLs":[{"l":"website","u":"https://www.example.com/"}],"ainfo":"exampleuser","pbe":119.083926,"pgrng":true,"ps":100,"tags":[],"title":"ExampleLogin","url":"https://www.example.com/"}} ) ELSE IF "%*" == "--session thisIsAFakeSessionToken get item ExampleLogin" ( echo.{"uuid":"wxcplh5udshnonkzg2n4qx262y","templateUuid":"001","trashed":"N","createdAt":"2020-07-28T13:44:57Z","updatedAt":"2020-07-28T14:27:46Z","changerUuid":"VBDXOA4MPVHONK5IIJVKUQGLXM","itemVersion":2,"vaultUuid":"tscpxgi6s7c662jtqn3vmw4n5a","details":{"fields":[{"designation":"username","name":"username","type":"T","value":"exampleuser"},{"designation":"password","name":"password","type":"P","value":"L8rm1JXJIE1b8YUDWq7h"}],"notesPlain":"","passwordHistory":[],"sections":[{"name":"linked items","title":"Related Items"},{"fields":[{"k":"string","n":"D4328E0846D2461E8E455D7A07B93397","t":"exampleLabel","v":"exampleValue"}],"name":"Section_20E0BD380789477D8904F830BFE8A121","title":""}]},"overview":{"URLs":[{"l":"website","u":"https://www.example.com/"}],"ainfo":"exampleuser","pbe":119.083926,"pgrng":true,"ps":100,"tags":[],"title":"ExampleLogin","url":"https://www.example.com/"}} +) ELSE IF "%*" == "--session thisIsAFakeSessionToken get item ExampleLogin --vault vault --account account" ( + echo.{"uuid":"wxcplh5udshnonkzg2n4qx262y","templateUuid":"001","trashed":"N","createdAt":"2020-07-28T13:44:57Z","updatedAt":"2020-07-28T14:27:46Z","changerUuid":"VBDXOA4MPVHONK5IIJVKUQGLXM","itemVersion":2,"vaultUuid":"tscpxgi6s7c662jtqn3vmw4n5a","details":{"fields":[{"designation":"username","name":"username","type":"T","value":"exampleuser"},{"designation":"password","name":"password","type":"P","value":"L8rm1JXJIE1b8YUDWq7h"}],"notesPlain":"","passwordHistory":[],"sections":[{"name":"linked items","title":"Related Items"},{"fields":[{"k":"string","n":"D4328E0846D2461E8E455D7A07B93397","t":"exampleLabel","v":"exampleValue"}],"name":"Section_20E0BD380789477D8904F830BFE8A121","title":""}]},"overview":{"URLs":[{"l":"website","u":"https://www.example.com/"}],"ainfo":"exampleuser","pbe":119.083926,"pgrng":true,"ps":100,"tags":[],"title":"ExampleLogin","url":"https://www.example.com/"}} +) ELSE IF "%*" == "--session thisIsAFakeSessionToken get item ExampleLogin --vault '''' --account account" ( + echo.{"uuid":"wxcplh5udshnonkzg2n4qx262y","templateUuid":"001","trashed":"N","createdAt":"2020-07-28T13:44:57Z","updatedAt":"2020-07-28T14:27:46Z","changerUuid":"VBDXOA4MPVHONK5IIJVKUQGLXM","itemVersion":2,"vaultUuid":"tscpxgi6s7c662jtqn3vmw4n5a","details":{"fields":[{"designation":"username","name":"username","type":"T","value":"exampleuser"},{"designation":"password","name":"password","type":"P","value":"L8rm1JXJIE1b8YUDWq7h"}],"notesPlain":"","passwordHistory":[],"sections":[{"name":"linked items","title":"Related Items"},{"fields":[{"k":"string","n":"D4328E0846D2461E8E455D7A07B93397","t":"exampleLabel","v":"exampleValue"}],"name":"Section_20E0BD380789477D8904F830BFE8A121","title":""}]},"overview":{"URLs":[{"l":"website","u":"https://www.example.com/"}],"ainfo":"exampleuser","pbe":119.083926,"pgrng":true,"ps":100,"tags":[],"title":"ExampleLogin","url":"https://www.example.com/"}} ) ELSE IF "%*" == "signin --raw" ( echo thisIsAFakeSessionToken +) ELSE IF "%*" == "signin account --raw" ( + echo thisIsAFakeSessionToken ) ELSE ( echo.[ERROR] 2020/01/01 00:00:00 unknown command "%*" for "op" 1>&2 exit /b 1 diff --git a/pkg/cmd/testdata/scripts/onepassword2.txt b/pkg/cmd/testdata/scripts/onepassword2.txt index c122574504a..68dc6fa259d 100644 --- a/pkg/cmd/testdata/scripts/onepassword2.txt +++ b/pkg/cmd/testdata/scripts/onepassword2.txt @@ -5,6 +5,14 @@ chezmoi execute-template '{{ (onepassword "ExampleLogin").id }}' stdout '^wxcplh5udshnonkzg2n4qx262y$' +# test onepassword template function with vault and account +chezmoi execute-template '{{ (onepassword "ExampleLogin" "vault" "account").id }}' +stdout '^wxcplh5udshnonkzg2n4qx262y$' + +# test onepassword template function with empty vault and account +! chezmoi execute-template '{{ (onepassword "ExampleLogin" "" "account").id }}' +stderr 'error calling onepassword' + # test onepasswordDetailsFields template function chezmoi execute-template '{{ (onepasswordDetailsFields "ExampleLogin").password.value }}' stdout '^L8rm1JXJIE1b8YUDWq7h$' @@ -18,12 +26,16 @@ stdout exampleValue case "$*" in "--version") - echo 2.0.0-beta.8 + echo 2.0.0 ;; -"item get --format json ExampleLogin" | "--session thisIsAFakeSessionToken item get --format json ExampleLogin") +"item get --format json ExampleLogin" | "item get --format json ExampleLogin --vault vault --account account" | "--session thisIsAFakeSessionToken item get --format json ExampleLogin" | "--session thisIsAFakeSessionToken item get --format json ExampleLogin --vault vault --account account") echo '{"id":"wxcplh5udshnonkzg2n4qx262y","title":"ExampleLogin","version":1,"vault":{"id":"tscpxgi6s7c662jtqn3vmw4n5a"},"category":"LOGIN","last_edited_by":"YO4UTYPAD3ZFBNZG5DVAZFBNZM","created_at":"2022-01-17T01:53:50Z","updated_at":"2022-01-17T01:55:35Z","sections":[{"id":"Section_cdzjhg2jo7jylpyin2f5mbfnhm","label":"Related Items"}],"fields":[{"id":"username","type":"STRING","purpose":"USERNAME","label":"username","value":"exampleuser "},{"id":"password","type":"CONCEALED","purpose":"PASSWORD","label":"password","value":"L8rm1JXJIE1b8YUDWq7h","password_details":{"strength":"EXCELLENT"}},{"id":"notesPlain","type":"STRING","purpose":"NOTES","label":"notesPlain"},{"id":"cqn7oda7wkcsar7rzcr52i2m3u","section":{"id":"Section_cdzjhg2jo7jylpyin2f5mbfnhm","label":"Related Items"},"type":"STRING","label":"exampleLabel","value":"exampleValue"}],"urls":[{"primary":true,"href":"https://www.example.com/"}]}' ;; -"signin --raw") +"item get --format json ExampleLogin --vault --account account" | "--session thisIsAFakeSessionToken item get --format json ExampleLogin --vault --account account") + echo "[ERROR] 2020/01/01 00:00:00 invalid argument \"\" for \"--vault\" flag: it\'s empty." 1>&2 + exit 1 + ;; +"signin --raw" | "signin --account account --raw") echo 'thisIsAFakeSessionToken' ;; *) @@ -33,13 +45,25 @@ esac -- bin/op.cmd -- @echo off IF "%*" == "--version" ( - echo 2.0.0-beta.8 + echo 2.0.0 ) ELSE IF "%*" == "item get --format json ExampleLogin" ( echo.{"id":"wxcplh5udshnonkzg2n4qx262y","title":"ExampleLogin","version":1,"vault":{"id":"tscpxgi6s7c662jtqn3vmw4n5a"},"category":"LOGIN","last_edited_by":"YO4UTYPAD3ZFBNZG5DVAZFBNZM","created_at":"2022-01-17T01:53:50Z","updated_at":"2022-01-17T01:55:35Z","sections":[{"id":"Section_cdzjhg2jo7jylpyin2f5mbfnhm","label":"Related Items"}],"fields":[{"id":"username","type":"STRING","purpose":"USERNAME","label":"username","value":"exampleuser "},{"id":"password","type":"CONCEALED","purpose":"PASSWORD","label":"password","value":"L8rm1JXJIE1b8YUDWq7h","password_details":{"strength":"EXCELLENT"}},{"id":"notesPlain","type":"STRING","purpose":"NOTES","label":"notesPlain"},{"id":"cqn7oda7wkcsar7rzcr52i2m3u","section":{"id":"Section_cdzjhg2jo7jylpyin2f5mbfnhm","label":"Related Items"},"type":"STRING","label":"exampleLabel","value":"exampleValue"}],"urls":[{"primary":true,"href":"https://www.example.com/"}]} +) ELSE IF "%*" == "item get --format json ExampleLogin --vault vault --account account" ( + echo.{"id":"wxcplh5udshnonkzg2n4qx262y","title":"ExampleLogin","version":1,"vault":{"id":"tscpxgi6s7c662jtqn3vmw4n5a"},"category":"LOGIN","last_edited_by":"YO4UTYPAD3ZFBNZG5DVAZFBNZM","created_at":"2022-01-17T01:53:50Z","updated_at":"2022-01-17T01:55:35Z","sections":[{"id":"Section_cdzjhg2jo7jylpyin2f5mbfnhm","label":"Related Items"}],"fields":[{"id":"username","type":"STRING","purpose":"USERNAME","label":"username","value":"exampleuser "},{"id":"password","type":"CONCEALED","purpose":"PASSWORD","label":"password","value":"L8rm1JXJIE1b8YUDWq7h","password_details":{"strength":"EXCELLENT"}},{"id":"notesPlain","type":"STRING","purpose":"NOTES","label":"notesPlain"},{"id":"cqn7oda7wkcsar7rzcr52i2m3u","section":{"id":"Section_cdzjhg2jo7jylpyin2f5mbfnhm","label":"Related Items"},"type":"STRING","label":"exampleLabel","value":"exampleValue"}],"urls":[{"primary":true,"href":"https://www.example.com/"}]} +) ELSE IF "%*" == "item get --format json ExampleLogin --vault '''' --account account" ( + echo.[ERROR] 2020/01/01 00:00:00 invalid argument "" for "--vault" flag: it\'s empty. 1>&2 + exit /b 1 ) ELSE IF "%*" == "--session thisIsAFakeSessionToken item get --format json ExampleLogin" ( echo.{"id":"wxcplh5udshnonkzg2n4qx262y","title":"ExampleLogin","version":1,"vault":{"id":"tscpxgi6s7c662jtqn3vmw4n5a"},"category":"LOGIN","last_edited_by":"YO4UTYPAD3ZFBNZG5DVAZFBNZM","created_at":"2022-01-17T01:53:50Z","updated_at":"2022-01-17T01:55:35Z","sections":[{"id":"Section_cdzjhg2jo7jylpyin2f5mbfnhm","label":"Related Items"}],"fields":[{"id":"username","type":"STRING","purpose":"USERNAME","label":"username","value":"exampleuser "},{"id":"password","type":"CONCEALED","purpose":"PASSWORD","label":"password","value":"L8rm1JXJIE1b8YUDWq7h","password_details":{"strength":"EXCELLENT"}},{"id":"notesPlain","type":"STRING","purpose":"NOTES","label":"notesPlain"},{"id":"cqn7oda7wkcsar7rzcr52i2m3u","section":{"id":"Section_cdzjhg2jo7jylpyin2f5mbfnhm","label":"Related Items"},"type":"STRING","label":"exampleLabel","value":"exampleValue"}],"urls":[{"primary":true,"href":"https://www.example.com/"}]} +) ELSE IF "%*" == "--session thisIsAFakeSessionToken item get --format json ExampleLogin --vault vault --account account" ( + echo.{"id":"wxcplh5udshnonkzg2n4qx262y","title":"ExampleLogin","version":1,"vault":{"id":"tscpxgi6s7c662jtqn3vmw4n5a"},"category":"LOGIN","last_edited_by":"YO4UTYPAD3ZFBNZG5DVAZFBNZM","created_at":"2022-01-17T01:53:50Z","updated_at":"2022-01-17T01:55:35Z","sections":[{"id":"Section_cdzjhg2jo7jylpyin2f5mbfnhm","label":"Related Items"}],"fields":[{"id":"username","type":"STRING","purpose":"USERNAME","label":"username","value":"exampleuser "},{"id":"password","type":"CONCEALED","purpose":"PASSWORD","label":"password","value":"L8rm1JXJIE1b8YUDWq7h","password_details":{"strength":"EXCELLENT"}},{"id":"notesPlain","type":"STRING","purpose":"NOTES","label":"notesPlain"},{"id":"cqn7oda7wkcsar7rzcr52i2m3u","section":{"id":"Section_cdzjhg2jo7jylpyin2f5mbfnhm","label":"Related Items"},"type":"STRING","label":"exampleLabel","value":"exampleValue"}],"urls":[{"primary":true,"href":"https://www.example.com/"}]} +) ELSE IF "%*" == "--session thisIsAFakeSessionToken item get --format json ExampleLogin --vault '''' --account account" ( + echo.[ERROR] 2020/01/01 00:00:00 invalid argument "" for "--vault" flag: it\'s empty. 1>&2 + exit /b 1 ) ELSE IF "%*" == "signin --raw" ( echo thisIsAFakeSessionToken +) ELSE IF "%*" == "signin --account account --raw" ( + echo thisIsAFakeSessionToken ) ELSE ( echo.[ERROR] 2020/01/01 00:00:00 unknown command "%*" for "op" 1>&2 exit /b 1
fix
Fix op signin for 1Password CLI 2.0.0
212213f14cfcebd05b2451ed408a6652aed4f782
2021-09-28 00:16:14
Tom Payne
chore: Add Docker-based integration tests
false
diff --git a/assets/docker/archlinux.Dockerfile b/assets/docker/archlinux.Dockerfile new file mode 100644 index 00000000000..029cb4032e7 --- /dev/null +++ b/assets/docker/archlinux.Dockerfile @@ -0,0 +1,4 @@ +FROM archlinux:latest + +RUN pacman -Sy --noconfirm --noprogressbar age gcc git go unzip zip +ENTRYPOINT ( cd /chezmoi && go test ./... ) \ No newline at end of file diff --git a/assets/docker/fedora.Dockerfile b/assets/docker/fedora.Dockerfile new file mode 100644 index 00000000000..38c5abff538 --- /dev/null +++ b/assets/docker/fedora.Dockerfile @@ -0,0 +1,5 @@ +FROM fedora:latest + +RUN dnf update -y && \ + dnf install -y bzip2 git gnupg golang +ENTRYPOINT ( cd /chezmoi && go test ./... ) \ No newline at end of file diff --git a/assets/docker/test.sh b/assets/docker/test.sh new file mode 100755 index 00000000000..9920c945c3d --- /dev/null +++ b/assets/docker/test.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -eufo pipefail + +cd ../.. +for distribution in "$@"; do + dockerfile="assets/docker/${distribution}.Dockerfile" + if [ ! -f "${dockerfile}" ]; then + echo "${dockerfile} not found" + exit 1 + fi + image="$(docker build . -f "assets/docker/${distribution}.Dockerfile" -q)" + docker run --rm --volume "${PWD}:/chezmoi" "${image}" +done \ No newline at end of file
chore
Add Docker-based integration tests
15c9511fa7d7465ff4fe9f6595d0789f5f276210
2025-01-10 16:59:40
Tom Payne
chore: Update GitHub Actions
false
diff --git a/.github/actions/setup-go/action.yml b/.github/actions/setup-go/action.yml index df6f24ece6b..d9f89bd21d7 100644 --- a/.github/actions/setup-go/action.yml +++ b/.github/actions/setup-go/action.yml @@ -48,7 +48,7 @@ runs: key: ${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}- - - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a with: cache: false go-version: ${{ inputs.go-version }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5a5aee7ea7e..6ab45b4c490 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@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 + - uses: github/codeql-action/init@3407610120cd5656b6fc71991415cb50748b9489 with: languages: go - - uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 + - uses: github/codeql-action/analyze@3407610120cd5656b6fc71991415cb50748b9489 misspell: runs-on: ubuntu-22.04 permissions:
chore
Update GitHub Actions
5e14f9aacf9329673d8af71b1343a8fe2d25aa2e
2022-10-21 01:00:49
Braden Hilton
docs: Add note on setting .ps1 interpreter to pwsh
false
diff --git a/assets/chezmoi.io/docs/reference/target-types.md b/assets/chezmoi.io/docs/reference/target-types.md index a8730bbf010..9780da68a82 100644 --- a/assets/chezmoi.io/docs/reference/target-types.md +++ b/assets/chezmoi.io/docs/reference/target-types.md @@ -126,6 +126,17 @@ Script interpreters can be added or overridden with the command = "tclsh" ``` +!!! note + + If you intend to use PowerShell Core (`pwsh.exe`) as the `.ps1` + interpreter, include the following in your config file: + + ```toml title="~/.confg/chezmoi/chezmoi.toml" + [interpreters.ps1] + command = "pwsh" + args = ["-NoLogo"] + ``` + If the script in the source state is a template (with a `.tmpl` extension), then chezmoi will strip the `.tmpl` extension and use the next remaining extension to determine the interpreter to use.
docs
Add note on setting .ps1 interpreter to pwsh
760e90f08e86b9080a26b829585f5b63745e6abe
2022-09-25 19:54:34
Tom Payne
chore: Add lint-txtar to GitHub Actions
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 97ed5f98849..224d03386b7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -340,6 +340,9 @@ jobs: - name: lint-whitespace run: | go run ./internal/cmds/lint-whitespace + - name: lint-txtar + run: | + find . -name \*.txtar | xargs go run ./internal/cmds/lint-txtar - name: findtypos run: | go install github.com/twpayne/[email protected]
chore
Add lint-txtar to GitHub Actions
ddb631b94968632c906673167bcf5b0255d17a50
2022-01-18 22:13:00
Elias Roa
docs: Fix small typo in User guide
false
diff --git a/assets/chezmoi.io/docs/user-guide/manage-machine-to-machine-differences.md b/assets/chezmoi.io/docs/user-guide/manage-machine-to-machine-differences.md index b134918f58a..89724892ea2 100644 --- a/assets/chezmoi.io/docs/user-guide/manage-machine-to-machine-differences.md +++ b/assets/chezmoi.io/docs/user-guide/manage-machine-to-machine-differences.md @@ -188,7 +188,7 @@ on any variable. For example, if you want `~/.bashrc` to be different on Linux and macOS you would create a file in the source state called `dot_bashrc.tmpl` containing: -``` title="~/.local/share/chezmoi/.chezmoiignore" +``` title="~/.local/share/chezmoi/dot_bashrc.tmpl" {{ if eq .chezmoi.os "darwin" -}} # macOS .bashrc contents {{ else if eq .chezmoi.os "linux" -}}
docs
Fix small typo in User guide
ea9062ba60c17d6c070d8910d6b33a0664b04920
2021-10-19 02:27:12
Tom Payne
chore: Add edit.minDuration configuration variable
false
diff --git a/docs/REFERENCE.md b/docs/REFERENCE.md index 4676dc2b670..d9ee3ec1c2c 100644 --- a/docs/REFERENCE.md +++ b/docs/REFERENCE.md @@ -369,6 +369,7 @@ The following configuration variables are available: | | `pager` | string | *none* | Docs-specific pager | | `edit` | `args` | []string | *none* | Extra args to edit command | | | `command` | string | `$EDITOR` / `$VISUAL` | Edit command | +| | `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 | @@ -1208,6 +1209,10 @@ is re-encrypted and replaces the original file in the source state. If the operating system supports hard links, then the edit command invokes the editor with filenames which match the target filename. +chezmoi will emit a warning if the editor returns in less than +`edit.minDuration` (default `1s`). To disable this warning, set +`edit.minDuration` to `0`. + #### `-a`, `--apply` Apply target immediately after editing. Ignored if there are no targets. diff --git a/internal/cmd/config.go b/internal/cmd/config.go index 7f08777a537..709b75cc47a 100644 --- a/internal/cmd/config.go +++ b/internal/cmd/config.go @@ -291,8 +291,9 @@ func newConfig(options ...configOption) (*Config, error) { MaxWidth: 80, }, Edit: editCmdConfig{ - exclude: chezmoi.NewEntryTypeSet(chezmoi.EntryTypesNone), - include: chezmoi.NewEntryTypeSet(chezmoi.EntryTypeDirs | chezmoi.EntryTypeFiles | chezmoi.EntryTypeSymlinks | chezmoi.EntryTypeEncrypted), + MinDuration: 1 * time.Second, + exclude: chezmoi.NewEntryTypeSet(chezmoi.EntryTypesNone), + include: chezmoi.NewEntryTypeSet(chezmoi.EntryTypeDirs | chezmoi.EntryTypeFiles | chezmoi.EntryTypeSymlinks | chezmoi.EntryTypeEncrypted), }, Git: gitCmdConfig{ Command: "git", @@ -980,10 +981,10 @@ func (c *Config) diffFile(path chezmoi.RelPath, fromData []byte, fromMode fs.Fil } // editor returns the path to the user's editor and any extra arguments. -func (c *Config) editor() (string, []string) { +func (c *Config) editor(args []string) (string, []string) { // If the user has set and edit command then use it. if c.Edit.Command != "" { - return c.Edit.Command, c.Edit.Args + return c.Edit.Command, append(c.Edit.Args, args...) } // Prefer $VISUAL over $EDITOR and fallback to the OS's default editor. @@ -995,7 +996,7 @@ func (c *Config) editor() (string, []string) { // If editor is found, return it. if path, err := exec.LookPath(editor); err == nil { - return path, nil + return path, args } // Otherwise, if editor contains spaces, then assume that the first word is @@ -1003,12 +1004,12 @@ func (c *Config) editor() (string, []string) { components := whitespaceRx.Split(editor, -1) if len(components) > 1 { if path, err := exec.LookPath(components[0]); err == nil { - return path, components[1:] + return path, append(components[1:], args...) } } // Fallback to editor only. - return editor, nil + return editor, args } // errorf writes an error to stderr. @@ -1679,8 +1680,15 @@ func (c *Config) runEditor(args []string) error { if err := c.persistentState.Close(); err != nil { return err } - editor, editorArgs := c.editor() - return c.run(chezmoi.EmptyAbsPath, editor, append(editorArgs, args...)) + editor, editorArgs := c.editor(args) + start := time.Now() + 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) + } + } + return err } // sourceAbsPaths returns the source absolute paths for each target path in diff --git a/internal/cmd/doctorcmd.go b/internal/cmd/doctorcmd.go index 54cf0858b1e..c04f7c45d96 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() - editCommand, _ := c.editor() + editCommand, _ := c.editor(nil) checks := []check{ &versionCheck{ versionInfo: c.versionInfo, diff --git a/internal/cmd/editcmd.go b/internal/cmd/editcmd.go index 2e9d0286fa2..01ce46df000 100644 --- a/internal/cmd/editcmd.go +++ b/internal/cmd/editcmd.go @@ -3,6 +3,7 @@ package cmd import ( "os" "runtime" + "time" "github.com/spf13/cobra" @@ -10,12 +11,13 @@ import ( ) type editCmdConfig struct { - Command string `mapstructure:"command"` - Args []string `mapstructure:"args"` - apply bool - exclude *chezmoi.EntryTypeSet - include *chezmoi.EntryTypeSet - init bool + Command string `mapstructure:"command"` + Args []string `mapstructure:"args"` + MinDuration time.Duration `mapstructure:"minDuration"` + apply bool + exclude *chezmoi.EntryTypeSet + include *chezmoi.EntryTypeSet + init bool } func (c *Config) newEditCmd() *cobra.Command { diff --git a/internal/cmd/testdata/scripts/editconfig.txt b/internal/cmd/testdata/scripts/editconfig.txt index 9fadebd3938..36576f91b78 100644 --- a/internal/cmd/testdata/scripts/editconfig.txt +++ b/internal/cmd/testdata/scripts/editconfig.txt @@ -11,17 +11,20 @@ chhome home2/user # test that edit-config edits an existing YAML config file chezmoi edit-config grep -count=1 '# edited' $CHEZMOICONFIGDIR/chezmoi.yaml +! stderr warning chhome home3/user # test that edit-config reports a warning if the config is no longer valid -! stderr warning chezmoi edit-config stderr warning +! stderr 'returned in less than' grep -count=1 '# edited' $CHEZMOICONFIGDIR/chezmoi.json -- home2/user/.config/chezmoi/chezmoi.yaml -- data: email: "[email protected]" +edit: + minDuration: 0 -- home3/user/.config/chezmoi/chezmoi.json -- -{"data":{"email":"[email protected]"}} +{"data":{"email":"[email protected]"},"edit":{"minDuration":"0"}}
chore
Add edit.minDuration configuration variable
05b006d87dd2b97f6f9302ad8c15e1289af67070
2021-12-23 02:11:54
Tom Payne
chore: Tidy up install.sh
false
diff --git a/assets/scripts/install.sh b/assets/scripts/install.sh index daf990bc815..b3172106400 100644 --- a/assets/scripts/install.sh +++ b/assets/scripts/install.sh @@ -83,7 +83,9 @@ main() { (cd "${tmpdir}" && untar "${TARBALL}") # install binary - test ! -d "${BINDIR}" && install -d "${BINDIR}" + if [ ! -d "${BINDIR}" ]; then + install -d "${BINDIR}" + fi BINARY="chezmoi${BINSUFFIX}" install "${tmpdir}/${BINARY}" "${BINDIR}/" log_info "installed ${BINDIR}/${BINARY}" @@ -212,7 +214,9 @@ real_tag() { log_err "real_tag error determining real tag of GitHub release ${tag}" return 1 fi - test -z "${real_tag}" && return 1 + if [ -z "${real_tag}" ]; then + return 1 + fi log_debug "found tag ${real_tag} for ${tag}" echo "${real_tag}" } diff --git a/internal/cmds/generate-install.sh/install.sh.tmpl b/internal/cmds/generate-install.sh/install.sh.tmpl index 872df8c8a6e..459e0429f8a 100644 --- a/internal/cmds/generate-install.sh/install.sh.tmpl +++ b/internal/cmds/generate-install.sh/install.sh.tmpl @@ -83,7 +83,9 @@ main() { (cd "${tmpdir}" && untar "${TARBALL}") # install binary - test ! -d "${BINDIR}" && install -d "${BINDIR}" + if [ ! -d "${BINDIR}" ]; then + install -d "${BINDIR}" + fi BINARY="chezmoi${BINSUFFIX}" install "${tmpdir}/${BINARY}" "${BINDIR}/" log_info "installed ${BINDIR}/${BINARY}" @@ -194,7 +196,9 @@ real_tag() { log_err "real_tag error determining real tag of GitHub release ${tag}" return 1 fi - test -z "${real_tag}" && return 1 + if [ -z "${real_tag}" ]; then + return 1 + fi log_debug "found tag ${real_tag} for ${tag}" echo "${real_tag}" }
chore
Tidy up install.sh
9f9d2d9bd59df730c71279987d163b898fc785a4
2023-12-24 00:26:00
Tom Payne
docs: Add link to article
false
diff --git a/assets/chezmoi.io/docs/links/articles.md.yaml b/assets/chezmoi.io/docs/links/articles.md.yaml index 06ffd91a049..b8ae597ec8f 100644 --- a/assets/chezmoi.io/docs/links/articles.md.yaml +++ b/assets/chezmoi.io/docs/links/articles.md.yaml @@ -372,3 +372,8 @@ articles: lang: JP title: chezmoi 管理のdotfiles でマシン毎に設定を変えたい url: https://zenn.dev/yukionodera/articles/chezmoi-use-template +- date: '2023-12-23' + version: 2.42.3 + lang: DE + title: Lokale Kofigurationsdateien sicher mit chezmoi und Git synchronisieren + url: https://www.heise.de/ratgeber/Lokale-Kofigurationsdateien-sicher-mit-chezmoi-und-Git-synchronisieren-9580741.html
docs
Add link to article
f7efd405c8a4b0671f0780dc24e6ffd9fcd7f373
2022-08-20 05:28:44
Tom Payne
chore: Update dependencies
false
diff --git a/go.mod b/go.mod index dd0872d8de3..ddaf18105a2 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ require ( filippo.io/age v1.0.0 github.com/Masterminds/sprig/v3 v3.2.2 github.com/aws/aws-sdk-go-v2 v1.16.11 - github.com/aws/aws-sdk-go-v2/config v1.16.1 - github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.17 + github.com/aws/aws-sdk-go-v2/config v1.17.1 + github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.18 github.com/bmatcuk/doublestar/v4 v4.2.0 github.com/bradenhilton/mozillainstallhash v1.0.0 github.com/charmbracelet/glamour v0.5.0 @@ -20,7 +20,7 @@ require ( github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 github.com/mitchellh/mapstructure v1.5.0 github.com/muesli/combinator v0.3.0 - github.com/pelletier/go-toml/v2 v2.0.2 + github.com/pelletier/go-toml/v2 v2.0.3 github.com/rogpeppe/go-internal v1.8.1 github.com/rs/zerolog v1.27.0 github.com/sergi/go-diff v1.1.0 @@ -38,8 +38,8 @@ require ( go.uber.org/multierr v1.8.0 golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e golang.org/x/oauth2 v0.0.0-20220808172628-8227340efae7 - golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 - golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab + golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde + golang.org/x/sys v0.0.0-20220818161305-2296e01440c6 golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 gopkg.in/ini.v1 v1.67.0 gopkg.in/yaml.v3 v3.0.1 @@ -51,17 +51,17 @@ require ( github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.1.1 // indirect github.com/Microsoft/go-winio v0.5.2 // indirect - github.com/ProtonMail/go-crypto v0.0.0-20220812102039-7f02a4f046af // indirect + github.com/ProtonMail/go-crypto v0.0.0-20220819155348-b76dceea2ffa // indirect github.com/acomagu/bufpipe v1.0.3 // indirect github.com/alecthomas/chroma v0.10.0 // indirect github.com/alessio/shellescape v1.4.1 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.12.13 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.12.14 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18 // indirect github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19 // indirect github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.11.16 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.11.17 // indirect github.com/aws/aws-sdk-go-v2/service/sts v1.16.13 // indirect github.com/aws/smithy-go v1.12.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect @@ -87,8 +87,8 @@ require ( 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-colorable v0.1.12 // indirect - github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.16 // indirect github.com/mattn/go-runewidth v0.0.13 // indirect github.com/microcosm-cc/bluemonday v1.0.19 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect @@ -112,8 +112,8 @@ require ( github.com/yuin/goldmark v1.4.13 // indirect github.com/yuin/goldmark-emoji v1.0.1 // indirect go.uber.org/atomic v1.10.0 // indirect - golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect - golang.org/x/net v0.0.0-20220811182439-13a9a731de15 // indirect + golang.org/x/crypto v0.0.0-20220817201139-bc19a97f63c8 // indirect + golang.org/x/net v0.0.0-20220812174116-3211cb980234 // indirect golang.org/x/text v0.3.7 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.28.1 // indirect diff --git a/go.sum b/go.sum index f56c394245e..91c02408137 100644 --- a/go.sum +++ b/go.sum @@ -65,6 +65,8 @@ github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= github.com/ProtonMail/go-crypto v0.0.0-20220812102039-7f02a4f046af h1:o388RXRJJhhPJxKA4gEtUx2hX8NHwUssZK9PsKV+FpE= github.com/ProtonMail/go-crypto v0.0.0-20220812102039-7f02a4f046af/go.mod h1:UBYPn8k0D56RtnR8RFQMjmh4KrZzWJ5o7Z9SYjossQ8= +github.com/ProtonMail/go-crypto v0.0.0-20220819155348-b76dceea2ffa h1:JnQShhH/njwtGszIgvfvYOZD1OJTOcewacum0I5VdXw= +github.com/ProtonMail/go-crypto v0.0.0-20220819155348-b76dceea2ffa/go.mod h1:UBYPn8k0D56RtnR8RFQMjmh4KrZzWJ5o7Z9SYjossQ8= 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= github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek= @@ -80,8 +82,12 @@ github.com/aws/aws-sdk-go-v2 v1.16.11 h1:xM1ZPSvty3xVmdxiGr7ay/wlqv+MWhH0rMlyLdb github.com/aws/aws-sdk-go-v2 v1.16.11/go.mod h1:WTACcleLz6VZTp7fak4EO5b9Q4foxbn+8PIz3PmyKlo= github.com/aws/aws-sdk-go-v2/config v1.16.1 h1:jasqFPOoNPXHOYGEEuvyT87ACiXhD3OkQckIm5uqi5I= github.com/aws/aws-sdk-go-v2/config v1.16.1/go.mod h1:4SKzBMiB8lV0fw2w7eDBo/LjQyHFITN4vUUuqpurFmI= +github.com/aws/aws-sdk-go-v2/config v1.17.1 h1:BWxTjokU/69BZ4DnLrZco6OvBDii6ToEdfBL/y5I1nA= +github.com/aws/aws-sdk-go-v2/config v1.17.1/go.mod h1:uOxDHjBemNTF2Zos+fgG0NNfE86wn1OAHDTGxjMEYi0= github.com/aws/aws-sdk-go-v2/credentials v1.12.13 h1:cuPzIsjKAWBUAAk8ZUR2l02Sxafl9hiaMsc7tlnjwAY= github.com/aws/aws-sdk-go-v2/credentials v1.12.13/go.mod h1:9fDEemXizwXrxPU1MTzv69LP/9D8HVl5qHAQO9A9ikY= +github.com/aws/aws-sdk-go-v2/credentials v1.12.14 h1:AtVG/amkjbDBfnPr/tuW2IG18HGNznP6L12Dx0rLz+Q= +github.com/aws/aws-sdk-go-v2/credentials v1.12.14/go.mod h1:opAndTyq+YN7IpVG57z2CeNuXSQMqTYxGGlYH0m0RMY= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12 h1:wgJBHO58Pc1V1QAnzdVM3JK3WbE/6eUF0JxCZ+/izz0= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12/go.mod h1:aZ4vZnyUuxedC7eD4JyEHpGnCz+O2sHQEx3VvAwklSE= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18 h1:OmiwoVyLKEqqD5GvB683dbSqxiOfvx4U2lDZhG2Esc4= @@ -94,8 +100,12 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12 h1:7iPTTX4SA github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12/go.mod h1:1TODGhheLWjpQWSuhYuAUWYTCKwEjx2iblIFKDHjeTc= github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.17 h1:x4JtJ0TaVVCoNc3bUtv0W5VvMLFiQ1++ReiRfSxRYf8= github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.17/go.mod h1:HvF8QZUW+evBsd/SJn4VA0WWW5qVMKxPpWiRRK4w3eM= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.18 h1:OEPeoMWuUp1SvUvrLMh8B7SJPRz6M1hP/AV4pmXybx4= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.18/go.mod h1:HvF8QZUW+evBsd/SJn4VA0WWW5qVMKxPpWiRRK4w3eM= github.com/aws/aws-sdk-go-v2/service/sso v1.11.16 h1:YK8L7TNlGwMWHYqLs+i6dlITpxqzq08FqQUy26nm+T8= github.com/aws/aws-sdk-go-v2/service/sso v1.11.16/go.mod h1:mS5xqLZc/6kc06IpXn5vRxdLaED+jEuaSRv5BxtnsiY= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.17 h1:pXxu9u2z1UqSbjO9YA8kmFJBhFc1EVTDaf7A+S+Ivq8= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.17/go.mod h1:mS5xqLZc/6kc06IpXn5vRxdLaED+jEuaSRv5BxtnsiY= github.com/aws/aws-sdk-go-v2/service/sts v1.16.13 h1:dl8T0PJlN92rvEGOEUiD0+YPYdPEaCZK0TqHukvSfII= github.com/aws/aws-sdk-go-v2/service/sts v1.16.13/go.mod h1:Ru3QVMLygVs/07UQ3YDur1AQZZp2tUNje8wfloFttC0= github.com/aws/smithy-go v1.12.1 h1:yQRC55aXN/y1W10HgwHle01DRuV9Dpf31iGkotjt3Ag= @@ -341,9 +351,13 @@ github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= 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-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= 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.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= @@ -378,6 +392,8 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.2 h1:+jQXlF3scKIcSEKkdHzXhCTDLPFi5r1wnK6yPS+49Gw= github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI= +github.com/pelletier/go-toml/v2 v2.0.3 h1:h9JoA60e1dVEOpp0PFwJSmt1Htu057NUq9/bUwaO61s= +github.com/pelletier/go-toml/v2 v2.0.3/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A= @@ -513,6 +529,8 @@ golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa h1:zuSxTR4o9y82ebqCUJYNGJbGPo6sKVl54f/TVDObg1c= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220817201139-bc19a97f63c8 h1:GIAS/yBem/gq2MUqgNIzUHW7cJMmx3TGZOrnyYaNQ6c= +golang.org/x/crypto v0.0.0-20220817201139-bc19a97f63c8/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= @@ -588,6 +606,8 @@ golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220811182439-13a9a731de15 h1:cik0bxZUSJVDyaHf1hZPSDsU8SZHGQZQMeueXCE7yBQ= golang.org/x/net v0.0.0-20220811182439-13a9a731de15/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.0.0-20220812174116-3211cb980234 h1:RDqmgfe7SvlMWoqC3xwQ2blLO3fcWcxMa3eBLRdRW7E= +golang.org/x/net v0.0.0-20220812174116-3211cb980234/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= 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= @@ -611,6 +631,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde h1:ejfdSekXMDxDLbRrJMwUk6KnSLZ2McaUCVcIKM+N6jc= +golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -668,6 +690,8 @@ golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220818161305-2296e01440c6 h1:Sx/u41w+OwrInGdEckYmEuU5gHoGSL4QbDz3S9s6j4U= +golang.org/x/sys v0.0.0-20220818161305-2296e01440c6/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-20220722155259-a9ba230a4035 h1:Q5284mrmYTpACcm+eAKjKJH48BBwSyfJqmmGDTtT8Vc= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
chore
Update dependencies
5bc19ae10c043ddb64ad30d50be20390cb9fc9d0
2024-11-04 00:49:40
Tom Payne
feat: Inform user when to use get.chezmoi.io/lb
false
diff --git a/assets/scripts/install-local-bin.sh b/assets/scripts/install-local-bin.sh index 468bed12275..dc656a49d63 100644 --- a/assets/scripts/install-local-bin.sh +++ b/assets/scripts/install-local-bin.sh @@ -102,7 +102,13 @@ main() { parse_args() { while getopts "b:dh?t:" arg; do case "${arg}" in - b) BINDIR="${OPTARG}" ;; + b) + + if [ "${OPTARG}" = "bin" ] || [ "${OPTARG}" = "./bin" ]; then + log_info "instead of using 'get.chezmoi.io/lb -b bin', use 'get.chezmoi.io' instead" + fi + BINDIR="${OPTARG}" + ;; d) LOG_LEVEL=3 ;; h | \?) usage "${0}" ;; t) TAGARG="${OPTARG}" ;; diff --git a/assets/scripts/install.sh b/assets/scripts/install.sh index 89954fb56cc..263c712605d 100644 --- a/assets/scripts/install.sh +++ b/assets/scripts/install.sh @@ -7,7 +7,7 @@ set -e -BINDIR="${BINDIR:-./bin}" +BINDIR="${BINDIR:-bin}" TAGARG=latest LOG_LEVEL=2 @@ -102,7 +102,12 @@ main() { parse_args() { while getopts "b:dh?t:" arg; do case "${arg}" in - b) BINDIR="${OPTARG}" ;; + b) + if [ "${OPTARG}" = ".local/bin" ] || [ "${OPTARG}" = "./.local/bin" ]; then + log_info "instead of using 'get.chezmoi.io -b .local/bin', use 'get.chezmoi.io/lb' instead" + fi + BINDIR="${OPTARG}" + ;; d) LOG_LEVEL=3 ;; h | \?) usage "${0}" ;; t) TAGARG="${OPTARG}" ;; diff --git a/internal/cmds/generate-install.sh/install.sh.tmpl b/internal/cmds/generate-install.sh/install.sh.tmpl index dc0973645ff..e57cdb5c7d5 100644 --- a/internal/cmds/generate-install.sh/install.sh.tmpl +++ b/internal/cmds/generate-install.sh/install.sh.tmpl @@ -102,7 +102,21 @@ main() { parse_args() { while getopts "b:dh?t:" arg; do case "${arg}" in - b) BINDIR="${OPTARG}" ;; + b) +{{- if eq .BinDir "bin" }} + if [ "${OPTARG}" = ".local/bin" ] || [ "${OPTARG}" = "./.local/bin" ]; then + log_info "instead of using 'get.chezmoi.io -b .local/bin', use 'get.chezmoi.io/lb' instead" + fi +{{- else if eq .BinDir ".local/bin" }} + + if [ "${OPTARG}" = "bin" ] || [ "${OPTARG}" = "./bin" ]; then + log_info "instead of using 'get.chezmoi.io/lb -b bin', use 'get.chezmoi.io' instead" + fi +{{- else }} + log_info "unexpected .BinDir: {{ .BinDir }}" +{{- end }} + BINDIR="${OPTARG}" + ;; d) LOG_LEVEL=3 ;; h | \?) usage "${0}" ;; t) TAGARG="${OPTARG}" ;; diff --git a/internal/cmds/generate-install.sh/main.go b/internal/cmds/generate-install.sh/main.go index 99683184af1..6253d9f0679 100644 --- a/internal/cmds/generate-install.sh/main.go +++ b/internal/cmds/generate-install.sh/main.go @@ -15,7 +15,7 @@ import ( ) var ( - binDir = flag.String("b", "./bin", "binary directory") + binDir = flag.String("b", "bin", "binary directory") output = flag.String("o", "", "output") )
feat
Inform user when to use get.chezmoi.io/lb
602cb7b3cf748328cca4f40056f0055d96ce2964
2021-10-02 21:55:17
Tom Payne
chore: Use info and error log levels only
false
diff --git a/internal/cmd/config.go b/internal/cmd/config.go index 9ed2c184078..44e24d14dd8 100644 --- a/internal/cmd/config.go +++ b/internal/cmd/config.go @@ -697,7 +697,7 @@ func (c *Config) defaultConfigFile(fileSystem vfs.Stater, bds *xdg.BaseDirectory } func (c *Config) defaultPreApplyFunc(targetRelPath chezmoi.RelPath, targetEntryState, lastWrittenEntryState, actualEntryState *chezmoi.EntryState) error { - log.Debug(). + log.Info(). Stringer("targetRelPath", targetRelPath). Object("targetEntryState", targetEntryState). Object("lastWrittenEntryState", lastWrittenEntryState). @@ -803,20 +803,20 @@ func (c *Config) defaultTemplateData() map[string]interface{} { if rawGroup, err := user.LookupGroupId(currentUser.Gid); err == nil { group = rawGroup.Name } else { - log.Debug(). + log.Info(). Str("gid", currentUser.Gid). Err(err). Msg("user.LookupGroupId") } } } else { - log.Debug(). + log.Info(). Err(err). Msg("user.Current") var ok bool username, ok = os.LookupEnv("USER") if !ok { - log.Debug(). + log.Info(). Str("key", "USER"). Bool("ok", ok). Msg("os.LookupEnv") @@ -829,14 +829,14 @@ func (c *Config) defaultTemplateData() map[string]interface{} { if rawHostname, err := os.Hostname(); err == nil { hostname = strings.SplitN(rawHostname, ".", 2)[0] } else { - log.Debug(). + log.Info(). Err(err). Msg("os.Hostname") } kernel, err := chezmoi.Kernel(c.fileSystem) if err != nil { - log.Debug(). + log.Info(). Err(err). Msg("chezmoi.Kernel") } @@ -845,7 +845,7 @@ func (c *Config) defaultTemplateData() map[string]interface{} { if rawOSRelease, err := chezmoi.OSRelease(c.baseSystem); err == nil { osRelease = upperSnakeCaseToCamelCaseMap(rawOSRelease) } else { - log.Debug(). + log.Info(). Err(err). Msg("chezmoi.OSRelease") } @@ -1412,12 +1412,12 @@ func (c *Config) persistentPreRunRootE(cmd *cobra.Command, args []string) error }, )) if c.debug { - zerolog.SetGlobalLevel(zerolog.DebugLevel) + zerolog.SetGlobalLevel(zerolog.InfoLevel) } else { zerolog.SetGlobalLevel(zerolog.Disabled) } - log.Debug(). + log.Info(). Object("version", c.versionInfo). Strs("args", args). Str("goVersion", runtime.Version()). diff --git a/internal/cmd/statuscmd.go b/internal/cmd/statuscmd.go index f148af97877..c85d60bce22 100644 --- a/internal/cmd/statuscmd.go +++ b/internal/cmd/statuscmd.go @@ -43,7 +43,7 @@ func (c *Config) runStatusCmd(cmd *cobra.Command, args []string, sourceState *ch sb := strings.Builder{} dryRunSystem := chezmoi.NewDryRunSystem(c.destSystem) statusCmdPreApplyFunc := func(targetRelPath chezmoi.RelPath, targetEntryState, lastWrittenEntryState, actualEntryState *chezmoi.EntryState) error { - log.Debug(). + log.Info(). Stringer("targetRelPath", targetRelPath). Object("targetEntryState", targetEntryState). Object("lastWrittenEntryState", lastWrittenEntryState). diff --git a/internal/cmd/upgradecmd.go b/internal/cmd/upgradecmd.go index 5ab3a62e799..046641338a6 100644 --- a/internal/cmd/upgradecmd.go +++ b/internal/cmd/upgradecmd.go @@ -189,7 +189,7 @@ func (c *Config) runUpgradeCmd(cmd *cobra.Command, args []string) error { // Execute the new version. arg0 := path argv := []string{arg0, "--version"} - log.Debug(). + log.Info(). Str("arg0", arg0). Strs("argv", argv). Msg("exec")
chore
Use info and error log levels only
e4ac634349224955abc8b5b5709254a57f7da2e8
2022-03-02 00:15:45
dependabot[bot]
chore(deps): bump golangci/golangci-lint-action from 2 to 3.1.0
false
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5a8a531563f..f2d01f81303 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -437,8 +437,11 @@ jobs: if: github.event_name == 'push' || needs.changes.outputs.code == 'true' runs-on: ubuntu-18.04 steps: + - uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} - uses: actions/checkout@v2 - - uses: golangci/golangci-lint-action@v2 + - uses: golangci/[email protected] with: version: v${{ env.GOLANGCI_LINT_VERSION }} args: --timeout=5m
chore
bump golangci/golangci-lint-action from 2 to 3.1.0
cf70d3578fe963d73d6024667fb4d37390f6c1f3
2023-07-28 20:42:00
Tom Payne
fix: Respect setting diff.pager to the empty string as disabling the pager
false
diff --git a/pkg/cmd/config.go b/pkg/cmd/config.go index 7a82735c8ec..4bc2c2e2c03 100644 --- a/pkg/cmd/config.go +++ b/pkg/cmd/config.go @@ -54,6 +54,11 @@ import ( "github.com/twpayne/chezmoi/v2/pkg/shell" ) +// defaultSentinel is a string value used to indicate that the default value +// should be used. It is a string unlikely to be an actual value set by the +// user. +const defaultSentinel = "\x00" + const ( logComponentKey = "component" logComponentValueEncryption = "encryption" @@ -1129,7 +1134,7 @@ func (c *Config) diffFile( if err := unifiedEncoder.Encode(diffPatch); err != nil { return err } - return c.pageOutputString(builder.String(), c.Diff.Pager) + return c.pageDiffOutput(builder.String()) } // editor returns the path to the user's editor and any extra arguments. @@ -1725,10 +1730,16 @@ func (c *Config) persistentPostRunRootE(cmd *cobra.Command, args []string) error return nil } -// pageOutputString writes output using cmdPager as the pager command. -func (c *Config) pageOutputString(output, cmdPager string) error { - pager := firstNonEmptyString(cmdPager, c.Pager) - if c.noPager || pager == "" { +// pageDiffOutput pages the diff output to stdout. +func (c *Config) pageDiffOutput(output string) error { + pager := c.Diff.Pager + switch { + case c.noPager: + pager = "" + case pager == defaultSentinel: + pager = c.Pager // Use default pager. + } + if pager == "" { return c.writeOutputString(output) } @@ -2624,6 +2635,7 @@ func newConfigFile(bds *xdg.BaseDirectorySpecification) ConfigFile { }, Diff: diffCmdConfig{ Exclude: chezmoi.NewEntryTypeSet(chezmoi.EntryTypesNone), + Pager: defaultSentinel, ScriptContents: true, include: chezmoi.NewEntryTypeSet(chezmoi.EntryTypesAll), }, diff --git a/pkg/cmd/diffcmd.go b/pkg/cmd/diffcmd.go index 7c5c99bee00..8c04629a3db 100644 --- a/pkg/cmd/diffcmd.go +++ b/pkg/cmd/diffcmd.go @@ -80,7 +80,7 @@ func (c *Config) runDiffCmd(cmd *cobra.Command, args []string) (err error) { }); err != nil { return } - if err = c.pageOutputString(builder.String(), c.Diff.Pager); err != nil { + if err = c.pageDiffOutput(builder.String()); err != nil { return } if closer, ok := diffSystem.(interface { diff --git a/pkg/cmd/testdata/scripts/issue3113.txtar b/pkg/cmd/testdata/scripts/issue3113.txtar new file mode 100644 index 00000000000..0c563d07ce1 --- /dev/null +++ b/pkg/cmd/testdata/scripts/issue3113.txtar @@ -0,0 +1,44 @@ +[windows] skip 'UNIX only' + +chmod 777 bin/custom-pager +chmod 777 bin/default-pager + +# test that chezmoi diff uses the default pager by default +exec chezmoi diff +stdout default-pager + +chhome home2/user + +# test that setting diff.pager to a custom pager uses that pager +exec chezmoi diff +stdout custom-pager + +chhome home3/user + +# test that setting diff.pager to the empty string disables the pager +exec chezmoi diff +stdout diff + +-- bin/custom-pager -- +#!/bin/sh + +echo custom-pager +-- bin/default-pager -- +#!/bin/sh + +echo default-pager +-- home/user/.config/chezmoi/chezmoi.yaml -- +pager: default-pager +-- home/user/.local/share/chezmoi/dot_file -- +# contents of .file +-- home2/user/.config/chezmoi/chezmoi.yaml -- +diff: + pager: custom-pager +-- home2/user/.local/share/chezmoi/dot_file -- +# contents of .file +-- home3/user/.config/chezmoi/chezmoi.yaml -- +pager: default-pager +diff: + pager: '' +-- home3/user/.local/share/chezmoi/dot_file -- +# contents of .file
fix
Respect setting diff.pager to the empty string as disabling the pager
66837906121278eab501dc91b0d9fa6b1da2a501
2022-01-17 03:32:38
Tom Payne
chore: Improve documentation
false
diff --git a/assets/chezmoi.io/docs/reference/commands/add.md b/assets/chezmoi.io/docs/reference/commands/add.md index f69aef6da2c..a9d1a38acb5 100644 --- a/assets/chezmoi.io/docs/reference/commands/add.md +++ b/assets/chezmoi.io/docs/reference/commands/add.md @@ -54,6 +54,14 @@ When adding symlink to an absolute path in the source directory or destination directory, create a symlink template with `.chezmoi.sourceDir` or `.chezmoi.homeDir`. This is useful for creating portable absolute symlinks. +!!! bug + + `chezmoi add` will fail if the entry being added is in a directory + implicitly created by an + [external](/reference/special-files-and-directories/chezmoiexternal-format/). + See [this GitHub issue](https://github.com/twpayne/chezmoi/issues/1574) for + details. + !!! example ```console diff --git a/assets/chezmoi.io/docs/reference/commands/git.md b/assets/chezmoi.io/docs/reference/commands/git.md index e07154c61f8..ad97438583f 100644 --- a/assets/chezmoi.io/docs/reference/commands/git.md +++ b/assets/chezmoi.io/docs/reference/commands/git.md @@ -1,8 +1,11 @@ # `git` [*arg*...] -Run `git` *arg*s in the working tree (typically the source directory). Note -that flags in *arguments* must occur after `--` to prevent chezmoi from -interpreting them. +Run `git` *args* in the working tree (typically the source directory). + +!!! note + + Flags in *args* must occur after `--` to prevent chezmoi from interpreting + them. !!! example diff --git a/assets/chezmoi.io/docs/reference/commands/secret.md b/assets/chezmoi.io/docs/reference/commands/secret.md index 307481670b0..23a8b4d145a 100644 --- a/assets/chezmoi.io/docs/reference/commands/secret.md +++ b/assets/chezmoi.io/docs/reference/commands/secret.md @@ -1,10 +1,13 @@ # `secret` Run a secret manager's CLI, passing any extra arguments to the secret manager's -CLI. This is primarily for verifying chezmoi's integration with your secret -manager. Normally you would use template functions to retrieve secrets. Note -that if you want to pass flags to the secret manager's CLI you will need to -separate them with `--` to prevent chezmoi from interpreting them. +CLI. This is primarily for verifying chezmoi's integration with a custom secret +manager. Normally you would use chezmoi's existing template functions to retrieve secrets. + +!!! note + + If you need to pass flags to the secret manager's CLI you must separate + them with `--` to prevent chezmoi from interpreting them. !!! hint diff --git a/assets/chezmoi.io/docs/reference/target-types.md b/assets/chezmoi.io/docs/reference/target-types.md index 9fdec650822..8f2374d0fd8 100644 --- a/assets/chezmoi.io/docs/reference/target-types.md +++ b/assets/chezmoi.io/docs/reference/target-types.md @@ -104,8 +104,12 @@ The default script interpreters are: | `.rb` | `ruby` | *none* | Script interpreters can be added or overridden with the -`interpreters.`*extension* section in the configuration file. Note that the -leading `.` is dropped from *extension*. +`interpreters.`*extension* section in the configuration file. + +!!! note + + The leading `.` is dropped from *extension*, for example to specify the + interpreter for `.pl` files you configure `interpreters.pl`. !!! example diff --git a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md index 4a1a9b64a4f..7a898bc0f62 100644 --- a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md +++ b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md @@ -69,12 +69,14 @@ in your configuration file, for example: umask = 0o022 ``` -Note that this will apply to all files and directories that chezmoi manages and -will ensure that none of them are group writeable. It is not currently possible -to control group write permissions for individual files or directories. Please -[open an issue on -GitHub](https://github.com/twpayne/chezmoi/issues/new?assignees=&labels=enhancement&template=02_feature_request.md&title=) -if you need this. +!!! note + + This will apply to all files and directories that chezmoi manages and will + ensure that none of them are group writeable. It is not currently possible + to control group write permissions for individual files or directories. + Please [open an issue on + GitHub](https://github.com/twpayne/chezmoi/issues/new?assignees=&labels=enhancement&template=02_feature_request.md&title=) + if you need this. ## chezmoi reports `chezmoi: user: lookup userid NNNNN: input/output error` 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 f6858f687b4..1ba04a955d5 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 @@ -7,17 +7,24 @@ There are four popular approaches: 1. Use `chezmoi edit $FILE`. This will open the source file for `$FILE` in your editor, including . For extra ease, use `chezmoi edit --apply $FILE` to apply the changes when you quit your editor. + 2. Use `chezmoi cd` and edit the files in the source directory directly. Run `chezmoi diff` to see what changes would be made, and `chezmoi apply` to make the changes. + 3. If your editor supports opening directories, run `chezmoi edit` with no arguments to open the source directory. + 4. Edit the file in your home directory, and then either re-add it by running - `chezmoi add $FILE` or `chezmoi re-add`. Note that `re-add` doesn't work with - templates. + `chezmoi add $FILE` or `chezmoi re-add`. + 5. Edit the file in your home directory, and then merge your changes with source state by running `chezmoi merge $FILE`. + !!! note + + `re-add` doesn't work with templates. + ## What are the consequences of "bare" modifications to the target files? If my `.zshrc` is managed by chezmoi and I edit `~/.zshrc` without using `chezmoi edit`, what happens? Until you run `chezmoi apply` your modified `~/.zshrc` will remain in place. diff --git a/assets/chezmoi.io/docs/user-guide/include-dotfiles-from-elsewhere.md b/assets/chezmoi.io/docs/user-guide/include-dotfiles-from-elsewhere.md index 57aede9fa37..c828b56867e 100644 --- a/assets/chezmoi.io/docs/user-guide/include-dotfiles-from-elsewhere.md +++ b/assets/chezmoi.io/docs/user-guide/include-dotfiles-from-elsewhere.md @@ -100,10 +100,12 @@ $ mkdir -p $(chezmoi source-path)/dot_oh-my-zsh $ chezmoi import --strip-components 1 --destination ~/.oh-my-zsh ${TMPDIR}/oh-my-zsh-master.tar.gz ``` -Note that this only updates the source state. You will need to run +!!! note -```console -$ chezmoi apply -``` + This only updates the source state. You will need to run: + + ```console + $ chezmoi apply + ``` -to update your destination directory. + to update your destination directory. diff --git a/assets/chezmoi.io/docs/user-guide/machines/macos.md b/assets/chezmoi.io/docs/user-guide/machines/macos.md index c5baeca8e48..67b2fd8c75e 100644 --- a/assets/chezmoi.io/docs/user-guide/machines/macos.md +++ b/assets/chezmoi.io/docs/user-guide/machines/macos.md @@ -20,9 +20,11 @@ EOF {{ end -}} ``` -Note that the `Brewfile` is embedded directly in the script with a bash here -document. chezmoi will run this script whenever its contents change, i.e. when -you add or remove brews or casks. +!!! note + + The `Brewfile` is embedded directly in the script with a bash here + document. chezmoi will run this script whenever its contents change, i.e. + when you add or remove brews or casks. ### Determine the hostname diff --git a/assets/chezmoi.io/docs/user-guide/manage-different-types-of-file.md b/assets/chezmoi.io/docs/user-guide/manage-different-types-of-file.md index 191a0c53fab..27bdf81f76a 100644 --- a/assets/chezmoi.io/docs/user-guide/manage-different-types-of-file.md +++ b/assets/chezmoi.io/docs/user-guide/manage-different-types-of-file.md @@ -48,9 +48,13 @@ parts of a file. Firstly, a `modify_` script receives the current contents of the file on the standard input and chezmoi reads the target contents of the file from the script's standard output. This can be used to change parts of a file, for -example using `sed`. Note that if the file does not exist then the standard -input to the `modify_` script will be empty and it is the script's -responsibility to write a complete file to the standard output. +example using `sed`. + +!!! note + + If the file does not exist then the standard input to the `modify_` script + will be empty and it is the script's responsibility to write a complete + file to the standard output. Secondly, if only a small part of the file changes then consider using a template to re-generate the full contents of the file from the current state. diff --git a/assets/chezmoi.io/docs/user-guide/manage-machine-to-machine-differences.md b/assets/chezmoi.io/docs/user-guide/manage-machine-to-machine-differences.md index 0ddcae7f518..b134918f58a 100644 --- a/assets/chezmoi.io/docs/user-guide/manage-machine-to-machine-differences.md +++ b/assets/chezmoi.io/docs/user-guide/manage-machine-to-machine-differences.md @@ -33,8 +33,11 @@ machine to machine. For example, for your home machine: email = "[email protected]" ``` -Note that all variable names will be converted to lowercase. This is due to a -feature of a library used by chezmoi. +!!! note + + All variable names will be converted to lowercase. This is due to a feature + of a library used by chezmoi. See [this GitHub + issue](https://github.com/twpayne/chezmoi/issues/463) for more information. If you intend to store private data (e.g. access tokens) in `~/.config/chezmoi/chezmoi.toml`, make sure it has permissions `0600`. diff --git a/assets/chezmoi.io/docs/user-guide/password-managers/1password.md b/assets/chezmoi.io/docs/user-guide/password-managers/1password.md index 09c0eb56677..573ce43ea4b 100644 --- a/assets/chezmoi.io/docs/user-guide/password-managers/1password.md +++ b/assets/chezmoi.io/docs/user-guide/password-managers/1password.md @@ -42,10 +42,12 @@ Documents can be retrieved with: {{- onepasswordDocument "uuid" -}} ``` -Note the extra `-` after the opening `{{` and before the closing `}}`. This -instructs the template language to remove any whitespace before and after the -substitution. This removes any trailing newline added by your editor when -saving the template. +!!! note + + The extra `-` after the opening `{{` and before the closing `}}` instructs + the template language to remove any whitespace before and after the + substitution. This removes any trailing newline added by your editor when + saving the template. ## 1Password sign-in prompt @@ -64,7 +66,6 @@ your configuration file: !!! warning - A session token verified or acquired interactively will be passed to the - 1Password CLI through a command-line parameter, which could be visible to - other users of the same system. You should disable the prompt on shared - machines for improved security. + Do not use the prompt on shared machines. A session token verified or + acquired interactively will be passed to the 1Password CLI through a + command-line parameter, which is visible to other users of the same system.
chore
Improve documentation