1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-16 23:29:16 +00:00

Update generator to handle collection as an output

This commit is contained in:
Dan Ramich
2018-04-02 11:27:44 -07:00
committed by Craig Jellick
parent 5c92744615
commit 9f2b71df50
3 changed files with 24 additions and 13 deletions

View File

@@ -11,12 +11,13 @@ import (
func funcs() template.FuncMap {
return template.FuncMap{
"capitalize": convert.Capitalize,
"unCapitalize": convert.Uncapitalize,
"upper": strings.ToUpper,
"toLower": strings.ToLower,
"hasGet": hasGet,
"hasPost": hasPost,
"capitalize": convert.Capitalize,
"unCapitalize": convert.Uncapitalize,
"upper": strings.ToUpper,
"toLower": strings.ToLower,
"hasGet": hasGet,
"hasPost": hasPost,
"getCollectionOutput": getCollectionOutput,
}
}
@@ -40,3 +41,10 @@ func contains(list []string, needle string) bool {
}
return false
}
func getCollectionOutput(output, codeName string) string {
if output == "collection" {
return codeName + "Collection"
}
return convert.Capitalize(output)
}