mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-07 21:59:15 +00:00
feat(ctx): interactive ctx command to switch between cluster contexts
This commit is contained in:
1 parent
1bbefdd0d2
commit
20b2ca2ea5
3 files changed
+87
-6
No files matched your search
@@ -1,22 +1,24 @@
|
||||
package context
|
||||
|
||||
import (
|
||||
"github.com/psviderski/uncloud/internal/cli"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewRootCommand() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "context",
|
||||
Aliases: []string{"ctx"},
|
||||
Use: "ctx",
|
||||
Aliases: []string{"context"},
|
||||
Short: "Switch between different cluster contexts. Contains subcommands to manage contexts.",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
// TODO
|
||||
return nil
|
||||
uncli := cmd.Context().Value("cli").(*cli.CLI)
|
||||
return selectContext(uncli)
|
||||
},
|
||||
}
|
||||
|
||||
cmd.AddCommand(
|
||||
NewListCommand(),
|
||||
NewUseCommand(),
|
||||
)
|
||||
|
||||
return cmd
|
||||
|
||||
Reference in new issue
Block a user