Extract the debug/namespace flags into run.Config [#67]
This is a general-purpose cleanup commit; every step except InitKube had the same six "add the --debug and --namespace flags if applicable" code.
This commit is contained in:
@@ -20,3 +20,14 @@ func newConfig(cfg env.Config) *config {
|
||||
stderr: cfg.Stderr,
|
||||
}
|
||||
}
|
||||
|
||||
func (cfg *config) globalFlags() []string {
|
||||
flags := []string{}
|
||||
if cfg.debug {
|
||||
flags = append(flags, "--debug")
|
||||
}
|
||||
if cfg.namespace != "" {
|
||||
flags = append(flags, "--namespace", cfg.namespace)
|
||||
}
|
||||
return flags
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user