Skip to content

Commit 055bd4e

Browse files
authored
Merge pull request #110 from onepanelio/feat/get.context
feat: show current context when deleting deployments
2 parents 86958fc + 4639446 commit 055bd4e

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

cmd/delete.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ package cmd
22

33
import (
44
"fmt"
5+
"path/filepath"
6+
57
opConfig "github.com/onepanelio/cli/config"
68
"github.com/onepanelio/cli/files"
79
"github.com/onepanelio/cli/util"
810
"github.com/spf13/cobra"
9-
"path/filepath"
11+
"k8s.io/client-go/tools/clientcmd"
1012
)
1113

1214
var (
@@ -21,7 +23,15 @@ var deleteCmd = &cobra.Command{
2123
Example: "delete",
2224
Run: func(cmd *cobra.Command, args []string) {
2325
if skipConfirmDelete == false {
24-
fmt.Print("Are you sure you want to delete onepanel? ('y' or 'yes' to confirm. Anything else to cancel): ")
26+
options := clientcmd.NewDefaultPathOptions()
27+
config, err := options.GetStartingConfig()
28+
if err != nil {
29+
fmt.Printf("Unable to get kubernetes config: %v", err.Error())
30+
return
31+
}
32+
33+
fmt.Println("The current kubernetes context is:", config.CurrentContext)
34+
fmt.Printf("Are you sure you want to delete onepanel from '%s'? ('y' or 'yes' to confirm. Anything else to cancel): ", config.CurrentContext)
2535
userInput := ""
2636
if _, err := fmt.Scanln(&userInput); err != nil {
2737
fmt.Printf("Unable to get response\n")

0 commit comments

Comments
 (0)