a480527808
Each of these include an option for --current-context that set or retrieves the curret context This patchset mainly creates the cmd/config and pkg/config require additions Also includes a fync getCurrentContext(<CLUSTERTYPE>) in the config pkg that other modules should rely on. Introduces new ErrMissingConfig and ErrConfigFailed types been used by set-context, will decimate through get/ and set/get cluster after this is reviewed. Change-Id: I501483a9db99f33f860eaf329a65bb0209b2aaff
25 lines
864 B
Go
25 lines
864 B
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-current-context my-context" `),
|
|
}
|
|
configRootCmd.AddCommand(NewCmdConfigSetCluster(rootSettings))
|
|
configRootCmd.AddCommand(NewCmdConfigGetCluster(rootSettings))
|
|
configRootCmd.AddCommand(NewCmdConfigSetContext(rootSettings))
|
|
configRootCmd.AddCommand(NewCmdConfigGetContext(rootSettings))
|
|
|
|
return configRootCmd
|
|
}
|