mirror of
https://github.com/FlipsideCrypto/convox.git
synced 2026-02-06 10:56:56 +00:00
* upgrade kubernetes client * cleanup provider helpers * use kubernetes patch to avoid update races
38 lines
484 B
Go
38 lines
484 B
Go
package common
|
|
|
|
import "strings"
|
|
|
|
func UpperName(name string) string {
|
|
if name == "" {
|
|
return ""
|
|
}
|
|
|
|
// replace underscores with dashes
|
|
name = strings.Replace(name, "_", "-", -1)
|
|
|
|
// myapp -> Myapp; my-app -> MyApp
|
|
us := strings.ToUpper(name[0:1]) + name[1:]
|
|
|
|
for {
|
|
i := strings.Index(us, "-")
|
|
|
|
if i == -1 {
|
|
break
|
|
}
|
|
|
|
s := us[0:i]
|
|
|
|
if len(us) > i+1 {
|
|
s += strings.ToUpper(us[i+1 : i+2])
|
|
}
|
|
|
|
if len(us) > i+2 {
|
|
s += us[i+2:]
|
|
}
|
|
|
|
us = s
|
|
}
|
|
|
|
return us
|
|
}
|