Files
helmfile/cmd/fetch.go
T
Hans Song 1d0ba72b47 feat: add/expose cli flags (#771)
* feat: add/expose cli flags

Signed-off-by: Hans Song <hans.m.song@gmail.com>

* fix tests

Signed-off-by: Hans Song <hans.m.song@gmail.com>

* remove skipdeps from subcommand options

Signed-off-by: Hans Song <hans.m.song@gmail.com>

* remove skip-deps from subcommand flags

Signed-off-by: Hans Song <hans.m.song@gmail.com>

* remove SkipDeps from subcommand implementations

Signed-off-by: Hans Song <hans.m.song@gmail.com>

* update doco with new flags

Signed-off-by: Hans Song <hans.m.song@gmail.com>

---------

Signed-off-by: Hans Song <hans.m.song@gmail.com>
2023-04-02 14:53:52 +08:00

41 lines
1.2 KiB
Go

package cmd
import (
"github.com/spf13/cobra"
"github.com/helmfile/helmfile/pkg/app"
"github.com/helmfile/helmfile/pkg/config"
"github.com/helmfile/helmfile/pkg/state"
)
// NewFetchCmd returns fetch subcmd
func NewFetchCmd(globalCfg *config.GlobalImpl) *cobra.Command {
fetchOptions := config.NewFetchOptions()
cmd := &cobra.Command{
Use: "fetch",
Short: "Fetch charts from state file",
RunE: func(cmd *cobra.Command, args []string) error {
fetchImpl := config.NewFetchImpl(globalCfg, fetchOptions)
err := config.NewCLIConfigImpl(fetchImpl.GlobalImpl)
if err != nil {
return err
}
if err := fetchImpl.ValidateConfig(); err != nil {
return err
}
a := app.New(fetchImpl)
return toCLIError(fetchImpl.GlobalImpl, a.Fetch(fetchImpl))
},
}
f := cmd.Flags()
f.IntVar(&fetchOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited")
f.StringVar(&fetchOptions.OutputDir, "output-dir", "", "directory to store charts (default: temporary directory which is deleted when the command terminates)")
f.StringVar(&fetchOptions.OutputDirTemplate, "output-dir-template", state.DefaultFetchOutputDirTemplate, "go text template for generating the output directory")
return cmd
}