Export GetKubeNamespace function from kubectl

This commit is contained in:
Michal Fojtik
2014-12-03 13:15:48 +01:00
parent 993ef88eec
commit 17e24aed47
4 changed files with 14 additions and 10 deletions

View File

@@ -123,7 +123,10 @@ func runHelp(cmd *cobra.Command, args []string) {
cmd.Help()
}
func getKubeNamespace(cmd *cobra.Command) string {
// GetKubeNamespace returns the value of the namespace a
// user provided on the command line or use the default
// namespace.
func GetKubeNamespace(cmd *cobra.Command) string {
result := api.NamespaceDefault
if ns := GetFlagString(cmd, "namespace"); len(ns) > 0 {
result = ns
@@ -140,10 +143,10 @@ func getKubeNamespace(cmd *cobra.Command) string {
return result
}
// getExplicitKubeNamespace returns the value of the namespace a
// GetExplicitKubeNamespace returns the value of the namespace a
// user explicitly provided on the command line, or false if no
// such namespace was specified.
func getExplicitKubeNamespace(cmd *cobra.Command) (string, bool) {
func GetExplicitKubeNamespace(cmd *cobra.Command) (string, bool) {
if ns := GetFlagString(cmd, "namespace"); len(ns) > 0 {
return ns, true
}