Implement the debug flag in lint [#3]

This commit is contained in:
Erin Call
2019-12-17 16:55:01 -08:00
parent 51800c18d7
commit a6b7e06bd2
2 changed files with 46 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
package run
import (
// "fmt"
"fmt"
)
// Lint is an execution step that calls `helm lint` when executed.
@@ -18,7 +18,13 @@ func (l *Lint) Execute(_ Config) error {
// Prepare gets the Lint ready to execute.
func (l *Lint) Prepare(cfg Config) error {
args := []string{"lint"}
args := make([]string, 0)
if cfg.Debug {
args = append(args, "--debug")
}
args = append(args, "lint")
if cfg.Values != "" {
args = append(args, "--set", cfg.Values)
@@ -36,5 +42,9 @@ func (l *Lint) Prepare(cfg Config) error {
l.cmd.Stdout(cfg.Stdout)
l.cmd.Stderr(cfg.Stderr)
if cfg.Debug {
fmt.Fprintf(cfg.Stderr, "Generated command: '%s'\n", l.cmd.String())
}
return nil
}