airshipctl/cmd/config/config.go
Drew Walters a437caa141 [#56] Add use-context subcommand
Currently, airshipctl users switch their current context by modifying
the airshipctl config file or executing airshipctl config set-context
[NAME]. This change introduces the use-context subcommand, which
replaces the current behavior of using set-context without flags. After
this change, set-context will only be used to modify contexts.

Change-Id: If3980138a0abeeb6c59c07615b5373654073610a
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-02-26 10:35:13 -06:00

29 lines
1.1 KiB
Go

package config
import (
"github.com/spf13/cobra"
"opendev.org/airship/airshipctl/pkg/environment"
)
// NewConfigCommand creates a command object for the airshipctl "config" , and adds all child commands to it.
func NewConfigCommand(rootSettings *environment.AirshipCTLSettings) *cobra.Command {
configRootCmd := &cobra.Command{
Use: "config",
DisableFlagsInUseLine: true,
Short: "Modify airshipctl config files",
Long: `Modify airshipctl config files using subcommands
like "airshipctl config set-context my-context" `,
}
configRootCmd.AddCommand(NewCmdConfigSetCluster(rootSettings))
configRootCmd.AddCommand(NewCmdConfigGetCluster(rootSettings))
configRootCmd.AddCommand(NewCmdConfigSetContext(rootSettings))
configRootCmd.AddCommand(NewCmdConfigGetContext(rootSettings))
configRootCmd.AddCommand(NewCmdConfigInit(rootSettings))
configRootCmd.AddCommand(NewCmdConfigSetAuthInfo(rootSettings))
configRootCmd.AddCommand(NewCmdConfigGetAuthInfo(rootSettings))
configRootCmd.AddCommand(NewCmdConfigUseContext(rootSettings))
return configRootCmd
}