display resource type as part of its name

This commit is contained in:
juanvallejo
2016-06-29 18:02:08 -04:00
parent 8cabbcbdcf
commit 7df60d6b64
5 changed files with 250 additions and 30 deletions

View File

@@ -164,6 +164,19 @@ var shortForms = map[string]string{
"svc": "services",
}
// Look-up for resource short forms by value
func ResourceShortFormFor(resource string) (string, bool) {
var alias string
exists := false
for k, val := range shortForms {
if val == resource {
alias = k
exists = true
}
}
return alias, exists
}
// expandResourceShortcut will return the expanded version of resource
// (something that a pkg/api/meta.RESTMapper can understand), if it is
// indeed a shortcut. Otherwise, will return resource unmodified.