Skip to content

Commit

Permalink
fix: validate undefined variables in initHelp template (#150)
Browse files Browse the repository at this point in the history
Co-authored-by: rchojn <[email protected]>
  • Loading branch information
rchojn and rchojn authored Nov 11, 2024
1 parent 7f98c08 commit 8c9efe1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/recipe/sauce.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package recipe

import (
"errors"
"fmt"
"path/filepath"
"strings"
Expand Down Expand Up @@ -169,5 +170,11 @@ func (s *Sauce) RenderInitHelp() (string, error) {
return "", fmt.Errorf("failed to render initHelp template: %w", err)
}

return buf.String(), nil
output := buf.String()

if strings.Contains(output, "<no value>") {
return "", errors.New("some of the variables used in the initHelp template were undefined")
}

return output, nil
}

0 comments on commit 8c9efe1

Please sign in to comment.