Skip to content

Commit

Permalink
Add shorthand -n for --namespace (#882)
Browse files Browse the repository at this point in the history
This commit adds the `-n` shorthand option for the `--namespace` global
flag, mirroring the behaviour of `kubectl`.

It also removes the redundant flag definition elsewhere since
`--namespace` is global, and tidies the help default for another.
  • Loading branch information
yankcrime authored and gerred committed Sep 30, 2019
1 parent b48cef3 commit 5cb7a30
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions pkg/kudoctl/cmd/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func NewPlanHistoryCmd() *cobra.Command {
}

listCmd.Flags().StringVar(&options.Instance, "instance", "", "The instance name.")
listCmd.Flags().StringVar(&options.Namespace, "namespace", "default", "The namespace where the instance is running.")

return listCmd
}
Expand All @@ -59,7 +58,6 @@ func NewPlanStatusCmd() *cobra.Command {
}

statusCmd.Flags().StringVar(&options.Instance, "instance", "", "The instance name available from 'kubectl get instances'")
statusCmd.Flags().StringVar(&options.Namespace, "namespace", "default", "The namespace where the instance is running.")

return statusCmd
}
4 changes: 2 additions & 2 deletions pkg/kudoctl/env/environoment.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ var envMap = map[string]string{
// AddFlags binds flags to the given flagset.
func (s *Settings) AddFlags(fs *pflag.FlagSet) {
fs.StringVar((*string)(&s.Home), "home", DefaultKudoHome, "location of your KUDO config.")
fs.StringVar(&s.KubeConfig, "kubeconfig", os.Getenv("HOME")+"/.kube/config", "Path to your Kubernetes configuration file")
fs.StringVar(&s.Namespace, "namespace", "default", "The namespace used for the package installation. (default \"default\"")
fs.StringVar(&s.KubeConfig, "kubeconfig", os.Getenv("HOME")+"/.kube/config", "Path to your Kubernetes configuration file.")
fs.StringVarP(&s.Namespace, "namespace", "n", "default", "Target namespace for the object.")
}

// Init sets values from the environment.
Expand Down

0 comments on commit 5cb7a30

Please sign in to comment.