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:
committed by
Craig Jellick
parent
5c92744615
commit
9f2b71df50
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user