4cbb4922fb
I'm vacillating about the choice to have separate Config structs in the `helm` and `run` packages. I can't tell whether it's "good separation of concerns" or "cumbersome and over-engineered." It seems appropriate at the moment, though.
34 lines
592 B
Go
34 lines
592 B
Go
package run
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// Help is a step in a helm Plan that calls `helm help`.
|
|
type Help struct {
|
|
cmd cmd
|
|
}
|
|
|
|
// Execute executes the `helm help` command.
|
|
func (h *Help) Execute() error {
|
|
return h.cmd.Run()
|
|
}
|
|
|
|
// Prepare gets the Help ready to execute.
|
|
func (h *Help) Prepare(cfg Config) error {
|
|
args := []string{"help"}
|
|
if cfg.Debug {
|
|
args = append([]string{"--debug"}, args...)
|
|
}
|
|
|
|
h.cmd = command(helmBin, args...)
|
|
h.cmd.Stdout(cfg.Stdout)
|
|
h.cmd.Stderr(cfg.Stderr)
|
|
|
|
if cfg.Debug {
|
|
fmt.Fprintf(cfg.Stderr, "Generated command: '%s'\n", h.cmd.String())
|
|
}
|
|
|
|
return nil
|
|
}
|