Skip to content

Commit

Permalink
Merge pull request #11 from mdanielolsson/namespace_flag_override
Browse files Browse the repository at this point in the history
Namespace flag override
  • Loading branch information
mdanielolsson authored Jun 9, 2020
2 parents 4f11ad4 + 26d9c07 commit 73ee27d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ var Namespace string
var Context string

var (
cfgFile string
verbose bool
lab bool
sandbox bool
teams []string
data []string
cfgFile string
namespaceFlag string
verbose bool
lab bool
sandbox bool
teams []string
data []string
)

var secretAliases = []string{
Expand Down Expand Up @@ -65,7 +66,7 @@ func init() {
rootCmd.PersistentFlags().BoolVarP(&lab, "lab", "", false, "Run lab to simulate team membership.")
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose output")
rootCmd.PersistentFlags().BoolVarP(&sandbox, "sandbox", "s", false, "Set if you want to work in a sandbox Namespace.")
rootCmd.PersistentFlags().StringVarP(&Namespace, "namespace", "n", "", "Namespace to create secret in. Usually only needed when member of more than one team.")
rootCmd.PersistentFlags().StringVarP(&namespaceFlag, "namespace", "n", "", "Namespace to create secret in. Usually only needed when member of more than one team.")
rootCmd.PersistentFlags().StringVarP(&Context, "context", "", "", "Set context name.")

// Hide flags
Expand Down Expand Up @@ -102,4 +103,9 @@ func identifyTeam() {
if sandbox {
Namespace = Namespace + "-sandbox"
}

// Override namespace if provided with --namespace flag.
if namespaceFlag != "" {
Namespace = namespaceFlag
}
}

0 comments on commit 73ee27d

Please sign in to comment.