Add bash completion cmd
This commit is contained in:
28
cmd/tk/completion.go
Normal file
28
cmd/tk/completion.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var completionCmd = &cobra.Command{
|
||||
Use: "completion",
|
||||
Short: "Generates bash completion scripts",
|
||||
Example: `To load completion run
|
||||
|
||||
. <(tk completion)
|
||||
|
||||
To configure your bash shell to load completions for each session add to your bashrc
|
||||
|
||||
# ~/.bashrc or ~/.profile
|
||||
. <(tk completion)
|
||||
`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
rootCmd.GenBashCompletion(os.Stdout)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(completionCmd)
|
||||
}
|
||||
@@ -47,15 +47,11 @@ func deleteKsCmdRun(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
if !deleteSilent {
|
||||
warning := "This action will remove the Kubernetes objects previously applied by this kustomization. "
|
||||
if kustomization.Spec.Suspend {
|
||||
warning = ""
|
||||
if !kustomization.Spec.Suspend {
|
||||
logWaiting("This action will remove the Kubernetes objects previously applied by the %s kustomization!", name)
|
||||
}
|
||||
prompt := promptui.Prompt{
|
||||
Label: fmt.Sprintf(
|
||||
"%sAre you sure you want to delete the %s kustomization from the %s namespace",
|
||||
warning, name, namespace,
|
||||
),
|
||||
Label: "Are you sure you want to delete this kustomization",
|
||||
IsConfirm: true,
|
||||
}
|
||||
if _, err := prompt.Run(); err != nil {
|
||||
|
||||
@@ -47,9 +47,7 @@ func deleteSourceGitCmdRun(cmd *cobra.Command, args []string) error {
|
||||
|
||||
if !deleteSilent {
|
||||
prompt := promptui.Prompt{
|
||||
Label: fmt.Sprintf(
|
||||
"Are you sure you want to delete the %s source from the %s namespace", name, namespace,
|
||||
),
|
||||
Label: "Are you sure you want to delete this source",
|
||||
IsConfirm: true,
|
||||
}
|
||||
if _, err := prompt.Run(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user