diff --git a/cmd/add.go b/cmd/add.go index 4c299db4fdf..70ac3a36e42 100644 --- a/cmd/add.go +++ b/cmd/add.go @@ -13,7 +13,7 @@ var addCommand = &cobra.Command{ Use: "add", Args: cobra.MinimumNArgs(1), Short: "Add an existing file or directory", - RunE: makeRunE(config.runAddCommandE), + RunE: makeRunE(config.runAddCommand), } // An AddCommandConfig is a configuration for the add command. @@ -32,7 +32,7 @@ func init() { persistentFlags.BoolVarP(&config.add.template, "template", "T", false, "add files as templates") } -func (c *Config) runAddCommandE(fs vfs.FS, command *cobra.Command, args []string) error { +func (c *Config) runAddCommand(fs vfs.FS, command *cobra.Command, args []string) error { targetState, err := c.getTargetState(fs) if err != nil { return err diff --git a/cmd/add_test.go b/cmd/add_test.go index 40f1957d38f..561d3979b20 100644 --- a/cmd/add_test.go +++ b/cmd/add_test.go @@ -144,8 +144,8 @@ func TestAddCommand(t *testing.T) { if err != nil { t.Fatalf("vfst.NewTestFS(_) == _, _, %v, want _, _, ", err) } - if err := c.runAddCommandE(fs, nil, tc.args); err != nil { - t.Errorf("c.runAddCommandE(fs, nil, %+v) == %v, want ", tc.args, err) + if err := c.runAddCommand(fs, nil, tc.args); err != nil { + t.Errorf("c.runAddCommand(fs, nil, %+v) == %v, want ", tc.args, err) } vfst.RunTests(t, fs, "", tc.tests) }) diff --git a/cmd/apply.go b/cmd/apply.go index c58f7d01a6c..afc8233f056 100644 --- a/cmd/apply.go +++ b/cmd/apply.go @@ -8,14 +8,14 @@ import ( var applyCommand = &cobra.Command{ Use: "apply", Short: "Update the actual state to match the target state", - RunE: makeRunE(config.runApplyCommandE), + RunE: makeRunE(config.runApplyCommand), } func init() { rootCommand.AddCommand(applyCommand) } -func (c *Config) runApplyCommandE(fs vfs.FS, command *cobra.Command, args []string) error { +func (c *Config) runApplyCommand(fs vfs.FS, command *cobra.Command, args []string) error { actuator := c.getDefaultActuator(fs) return c.applyArgs(fs, args, actuator) } diff --git a/cmd/archive.go b/cmd/archive.go index 9860b950375..f0a0a0bbf28 100644 --- a/cmd/archive.go +++ b/cmd/archive.go @@ -12,14 +12,14 @@ var archiveCommand = &cobra.Command{ Use: "archive", Args: cobra.NoArgs, Short: "Write a tar archive of the target state to stdout", - RunE: makeRunE(config.runArchiveCommandE), + RunE: makeRunE(config.runArchiveCommand), } func init() { rootCommand.AddCommand(archiveCommand) } -func (c *Config) runArchiveCommandE(fs vfs.FS, command *cobra.Command, args []string) error { +func (c *Config) runArchiveCommand(fs vfs.FS, command *cobra.Command, args []string) error { targetState, err := c.getTargetState(fs) if err != nil { return err diff --git a/cmd/diff.go b/cmd/diff.go index cd9e6432e6d..8050b3c9ebe 100644 --- a/cmd/diff.go +++ b/cmd/diff.go @@ -11,14 +11,14 @@ import ( var diffCommand = &cobra.Command{ Use: "diff", Short: "Print the diff between the actual state and the target state", - RunE: makeRunE(config.runDiffCommandE), + RunE: makeRunE(config.runDiffCommand), } func init() { rootCommand.AddCommand(diffCommand) } -func (c *Config) runDiffCommandE(fs vfs.FS, command *cobra.Command, args []string) error { +func (c *Config) runDiffCommand(fs vfs.FS, command *cobra.Command, args []string) error { actuator := chezmoi.NewLoggingActuator(os.Stdout, chezmoi.NewNullActuator()) return c.applyArgs(fs, args, actuator) } diff --git a/cmd/dump.go b/cmd/dump.go index b2561417d04..892e75876cc 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -12,14 +12,14 @@ import ( var dumpCommand = &cobra.Command{ Use: "dump", Short: "Dump the target state", - RunE: makeRunE(config.runDumpCommandE), + RunE: makeRunE(config.runDumpCommand), } func init() { rootCommand.AddCommand(dumpCommand) } -func (c *Config) runDumpCommandE(fs vfs.FS, command *cobra.Command, args []string) error { +func (c *Config) runDumpCommand(fs vfs.FS, command *cobra.Command, args []string) error { targetState, err := c.getTargetState(fs) if err != nil { return err diff --git a/cmd/edit.go b/cmd/edit.go index 1b07bfe3fda..ce1df36f3f8 100644 --- a/cmd/edit.go +++ b/cmd/edit.go @@ -16,7 +16,7 @@ var editCommand = &cobra.Command{ Use: "edit", Args: cobra.MinimumNArgs(1), Short: "Edit a file", - RunE: makeRunE(config.runEditCommandE), + RunE: makeRunE(config.runEditCommand), } type editCommandConfig struct { @@ -34,7 +34,7 @@ func init() { persistentFlags.BoolVarP(&config.edit.prompt, "prompt", "p", false, "prompt before applying (implies --diff)") } -func (c *Config) runEditCommandE(fs vfs.FS, command *cobra.Command, args []string) error { +func (c *Config) runEditCommand(fs vfs.FS, command *cobra.Command, args []string) error { if c.edit.prompt { c.edit.diff = true } diff --git a/cmd/forget.go b/cmd/forget.go index a2ac8af9217..fd218a88368 100644 --- a/cmd/forget.go +++ b/cmd/forget.go @@ -11,14 +11,14 @@ var forgetCommand = &cobra.Command{ Use: "forget", Args: cobra.MinimumNArgs(1), Short: "Forget a file or directory", - RunE: makeRunE(config.runForgetCommandE), + RunE: makeRunE(config.runForgetCommand), } func init() { rootCommand.AddCommand(forgetCommand) } -func (c *Config) runForgetCommandE(fs vfs.FS, command *cobra.Command, args []string) error { +func (c *Config) runForgetCommand(fs vfs.FS, command *cobra.Command, args []string) error { targetState, err := c.getTargetState(fs) if err != nil { return err diff --git a/cmd/remove.go b/cmd/remove.go index 8e53fb3d49e..ff0503f317c 100644 --- a/cmd/remove.go +++ b/cmd/remove.go @@ -13,28 +13,28 @@ var removeCommand = &cobra.Command{ Aliases: []string{"rm"}, Args: cobra.MinimumNArgs(1), Short: "Remove a file or directory", - RunE: makeRunE(runRemoveCommandE), + RunE: makeRunE(config.runRemoveCommand), } func init() { rootCommand.AddCommand(removeCommand) } -func runRemoveCommandE(fs vfs.FS, command *cobra.Command, args []string) error { - targetState, err := config.getTargetState(fs) +func (c *Config) runRemoveCommand(fs vfs.FS, command *cobra.Command, args []string) error { + targetState, err := c.getTargetState(fs) if err != nil { return err } - sourceNames, err := config.getSourceNames(targetState, args) + sourceNames, err := c.getSourceNames(targetState, args) if err != nil { return err } - actuator := config.getDefaultActuator(fs) + actuator := c.getDefaultActuator(fs) for i, targetFileName := range args { - if err := actuator.RemoveAll(filepath.Join(config.TargetDir, targetFileName)); err != nil && !os.IsNotExist(err) { + if err := actuator.RemoveAll(filepath.Join(c.TargetDir, targetFileName)); err != nil && !os.IsNotExist(err) { return err } - if err := actuator.RemoveAll(filepath.Join(config.SourceDir, sourceNames[i])); err != nil && !os.IsNotExist(err) { + if err := actuator.RemoveAll(filepath.Join(c.SourceDir, sourceNames[i])); err != nil && !os.IsNotExist(err) { return err } } diff --git a/cmd/verify.go b/cmd/verify.go index 10421a05280..b72fdc5784e 100644 --- a/cmd/verify.go +++ b/cmd/verify.go @@ -11,14 +11,14 @@ import ( var verifyCommand = &cobra.Command{ Use: "verify", Short: "Exit with success if the actual state matches the target state, fail otherwise", - RunE: makeRunE(config.runVerifyCommandE), + RunE: makeRunE(config.runVerifyCommand), } func init() { rootCommand.AddCommand(verifyCommand) } -func (c *Config) runVerifyCommandE(fs vfs.FS, command *cobra.Command, args []string) error { +func (c *Config) runVerifyCommand(fs vfs.FS, command *cobra.Command, args []string) error { actuator := chezmoi.NewAnyActuator(chezmoi.NewNullActuator()) if err := c.applyArgs(fs, args, actuator); err != nil { return err diff --git a/cmd/version.go b/cmd/version.go index 046673fe056..4aeab03d9f8 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -11,14 +11,14 @@ var versionCommand = &cobra.Command{ Use: "version", Args: cobra.NoArgs, Short: "Print version", - RunE: makeRunE(config.runVersionCommandE), + RunE: makeRunE(config.runVersionCommand), } func init() { rootCommand.AddCommand(versionCommand) } -func (c *Config) runVersionCommandE(fs vfs.FS, cmd *cobra.Command, args []string) error { +func (c *Config) runVersionCommand(fs vfs.FS, cmd *cobra.Command, args []string) error { fmt.Printf("Version: %s Commit: %s Date: %s\n", c.version.Version, c.version.Commit, c.version.Date) return nil }