From bb20fcaf5b9950d29b63a0ee62120e8351bb8c64 Mon Sep 17 00:00:00 2001 From: yxxhero <11087727+yxxhero@users.noreply.github.com> Date: Mon, 6 Jun 2022 08:12:54 +0800 Subject: [PATCH] Move repos subcommand to a dedicated source file (#137) Signed-off-by: yxxhero --- cmd/repos.go | 24 ++++++++++++++++++++++++ cmd/root.go | 1 + main.go | 14 -------------- 3 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 cmd/repos.go diff --git a/cmd/repos.go b/cmd/repos.go new file mode 100644 index 00000000..dca5bb95 --- /dev/null +++ b/cmd/repos.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/helmfile/helmfile/pkg/app" + "github.com/helmfile/helmfile/pkg/config" + "github.com/urfave/cli" +) + +func addReposSubcommand(cliApp *cli.App) { + cliApp.Commands = append(cliApp.Commands, cli.Command{ + Name: "repos", + Usage: "sync repositories from state file (helm repo add && helm repo update)", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "args", + Value: "", + Usage: "pass args to helm exec", + }, + }, + Action: Action(func(a *app.App, c config.ConfigImpl) error { + return a.Repos(c) + }), + }) +} diff --git a/cmd/root.go b/cmd/root.go index f9bb0f3d..a5e4821e 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -26,6 +26,7 @@ func RootCommand() *cli.App { // add subcommands addDepsSubcommand(cliApp) + addReposSubcommand(cliApp) return cliApp } diff --git a/main.go b/main.go index 7d099bca..14057132 100644 --- a/main.go +++ b/main.go @@ -14,20 +14,6 @@ func main() { rootCmd := cmd.RootCommand() subCommands := []cli.Command{ - { - Name: "repos", - Usage: "sync repositories from state file (helm repo add && helm repo update)", - Flags: []cli.Flag{ - cli.StringFlag{ - Name: "args", - Value: "", - Usage: "pass args to helm exec", - }, - }, - Action: cmd.Action(func(a *app.App, c config.ConfigImpl) error { - return a.Repos(c) - }), - }, { Name: "charts", Usage: "DEPRECATED: sync releases from state file (helm upgrade --install)",