Move repos subcommand to a dedicated source file (#137)

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2022-06-06 08:12:54 +08:00 committed by GitHub
parent 9032395818
commit bb20fcaf5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 14 deletions

24
cmd/repos.go Normal file
View File

@ -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)
}),
})
}

View File

@ -26,6 +26,7 @@ func RootCommand() *cli.App {
// add subcommands
addDepsSubcommand(cliApp)
addReposSubcommand(cliApp)
return cliApp
}

14
main.go
View File

@ -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)",