Skip to content

Commit

Permalink
feat: add current context in uninstall (glasskube#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafiramadhana authored Feb 20, 2024
1 parent ab439c9 commit 470e01e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmd/glasskube/cmd/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/glasskube/glasskube/internal/cliutils"
"github.com/glasskube/glasskube/internal/config"
"github.com/glasskube/glasskube/pkg/client"
pkgClient "github.com/glasskube/glasskube/pkg/client"
"github.com/glasskube/glasskube/pkg/list"
"github.com/glasskube/glasskube/pkg/uninstall"
"github.com/spf13/cobra"
Expand All @@ -19,7 +19,7 @@ var uninstallCmd = &cobra.Command{
Args: cobra.ExactArgs(1),
PreRun: cliutils.SetupClientContext(true),
Run: func(cmd *cobra.Command, args []string) {
client := client.FromContext(cmd.Context())
client := pkgClient.FromContext(cmd.Context())
pkgName := args[0]
pkg, err := list.Get(client, cmd.Context(), pkgName)
if err != nil {
Expand All @@ -28,7 +28,13 @@ var uninstallCmd = &cobra.Command{
return
}
proceed := config.ForceUninstall || cliutils.YesNoPrompt(
fmt.Sprintf("%v will be removed from your cluster. Are you sure?", pkgName), false)
fmt.Sprintf(
"%v will be removed from your cluster (%v). Are you sure?",
pkgName,
pkgClient.RawConfigFromContext(cmd.Context()).CurrentContext,
),
false,
)
if proceed {
fmt.Printf("Uninstalling %v.\n", pkgName)
err = uninstall.Uninstall(client, cmd.Context(), pkg)
Expand Down

0 comments on commit 470e01e

Please sign in to comment.