Skip to content
This repository has been archived by the owner on Oct 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request #75 from rebuy-de/add-make-slice-func
Browse files Browse the repository at this point in the history
add makeSlice template function
  • Loading branch information
svenwltr authored Aug 10, 2017
2 parents f57c59a + 4195ee7 commit dca608e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/templates/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ func IdentifierFunc(s string) string {
s = strings.Trim(s, "-")
return s
}

// Example: https://stackoverflow.com/a/25013152/393157
func MakeSliceFunc(elements ...interface{}) []interface{} {
return elements
}
1 change: 1 addition & 0 deletions pkg/templates/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func Render(templateString string, variables Variables) (string, error) {
"ToUpper": strings.ToUpper,
"ToLower": strings.ToLower,
"Identifier": IdentifierFunc,
"MakeSlice": MakeSliceFunc,
}

t, err := template.
Expand Down

0 comments on commit dca608e

Please sign in to comment.