Return an error on unknown commands [#15]
I'm probably overthinking this--explicitly calling help is a strange and unusual case--but it doesn't really hurt, so I'm going for it.
This commit is contained in:
@@ -10,8 +10,15 @@ type Help struct {
|
||||
}
|
||||
|
||||
// Execute executes the `helm help` command.
|
||||
func (h *Help) Execute(_ Config) error {
|
||||
return h.cmd.Run()
|
||||
func (h *Help) Execute(cfg Config) error {
|
||||
if err := h.cmd.Run(); err != nil {
|
||||
return fmt.Errorf("while running '%s': %w", h.cmd.String(), err)
|
||||
}
|
||||
|
||||
if cfg.HelmCommand == "help" {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown command '%s'", cfg.HelmCommand)
|
||||
}
|
||||
|
||||
// Prepare gets the Help ready to execute.
|
||||
|
||||
Reference in New Issue
Block a user