36643b77b4
- upgrade from apiextension v1beta1 to v1 - generate yaml manifest for crd intead of applying it at runtime - users will have to apply the manifest with kubectl - kg and kgctl log an error if the crd is not present - now validation should actually work Signed-off-by: leonnicolas <leonloechner@gmx.de>
44 lines
810 B
Go
44 lines
810 B
Go
/*
|
|
Package flect is a new inflection engine to replace [https://github.com/markbates/inflect](https://github.com/markbates/inflect) designed to be more modular, more readable, and easier to fix issues on than the original.
|
|
*/
|
|
package flect
|
|
|
|
import (
|
|
"strings"
|
|
"unicode"
|
|
)
|
|
|
|
var spaces = []rune{'_', ' ', ':', '-', '/'}
|
|
|
|
func isSpace(c rune) bool {
|
|
for _, r := range spaces {
|
|
if r == c {
|
|
return true
|
|
}
|
|
}
|
|
return unicode.IsSpace(c)
|
|
}
|
|
|
|
func xappend(a []string, ss ...string) []string {
|
|
for _, s := range ss {
|
|
s = strings.TrimSpace(s)
|
|
for _, x := range spaces {
|
|
s = strings.Trim(s, string(x))
|
|
}
|
|
if _, ok := baseAcronyms[strings.ToUpper(s)]; ok {
|
|
s = strings.ToUpper(s)
|
|
}
|
|
if s != "" {
|
|
a = append(a, s)
|
|
}
|
|
}
|
|
return a
|
|
}
|
|
|
|
func abs(x int) int {
|
|
if x < 0 {
|
|
return -x
|
|
}
|
|
return x
|
|
}
|