3e3df5e4c6
* refact "cscli config show" * refact "cscli config backup" * refact "cscli confgi show-yaml" * refact "cscli config restore" * refact "cscli config feature-flags" * cscli restore: remove 'old-backup' option * lint (whitespace, wrapped errors)
32 lines
629 B
Go
32 lines
629 B
Go
package main
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
type cliConfig struct {
|
|
cfg configGetter
|
|
}
|
|
|
|
func NewCLIConfig(cfg configGetter) *cliConfig {
|
|
return &cliConfig{
|
|
cfg: cfg,
|
|
}
|
|
}
|
|
|
|
func (cli *cliConfig) NewCommand() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "config [command]",
|
|
Short: "Allows to view current config",
|
|
Args: cobra.ExactArgs(0),
|
|
DisableAutoGenTag: true,
|
|
}
|
|
|
|
cmd.AddCommand(cli.newShowCmd())
|
|
cmd.AddCommand(cli.newShowYAMLCmd())
|
|
cmd.AddCommand(cli.newBackupCmd())
|
|
cmd.AddCommand(cli.newRestoreCmd())
|
|
cmd.AddCommand(cli.newFeatureFlagsCmd())
|
|
|
|
return cmd
|
|
}
|