feat(ctx): interactive ctx command to switch between cluster contexts

This commit is contained in:
Pavel Sviderski committed 2025-04-02 16:31:26 +10:00
1 parent 1bbefdd0d2
commit 20b2ca2ea5
3 files changed
+87 -6

No files matched your search

+6 -4
View File
@@ -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