mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 19:13:34 +00:00
29 lines
603 B
Go
29 lines
603 B
Go
package context
|
|
|
|
import (
|
|
"github.com/psviderski/uncloud/internal/cli"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func NewRootCommand() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "ctx",
|
|
Aliases: []string{"context"},
|
|
Short: "Switch between different cluster contexts. Contains subcommands to manage contexts.",
|
|
Args: cobra.NoArgs,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
uncli := cmd.Context().Value("cli").(*cli.CLI)
|
|
return selectContext(uncli)
|
|
},
|
|
}
|
|
|
|
cmd.AddCommand(
|
|
NewListCommand(),
|
|
NewUseCommand(),
|
|
NewConnectionCommand(),
|
|
NewShowCommand(),
|
|
)
|
|
|
|
return cmd
|
|
}
|