2019-12-10 00:25:47 +00:00
|
|
|
package run
|
|
|
|
|
|
|
|
import (
|
2020-01-17 18:13:53 +00:00
|
|
|
"github.com/pelotech/drone-helm3/internal/env"
|
2019-12-10 00:25:47 +00:00
|
|
|
"io"
|
|
|
|
)
|
|
|
|
|
2020-01-17 18:13:53 +00:00
|
|
|
type config struct {
|
|
|
|
debug bool
|
|
|
|
namespace string
|
|
|
|
stdout io.Writer
|
|
|
|
stderr io.Writer
|
|
|
|
}
|
|
|
|
|
|
|
|
func newConfig(cfg env.Config) *config {
|
|
|
|
return &config{
|
|
|
|
debug: cfg.Debug,
|
|
|
|
namespace: cfg.Namespace,
|
|
|
|
stdout: cfg.Stdout,
|
|
|
|
stderr: cfg.Stderr,
|
|
|
|
}
|
2019-12-10 00:25:47 +00:00
|
|
|
}
|
2020-01-17 19:12:53 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|