5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-04 07:29:56 +08:00
wails/v3/internal/commands/service.go
Lea Anthony d3d11593bc
Add update cli
Terminal output refactor
2025-01-02 16:24:37 +11:00

45 lines
859 B
Go

package commands
import (
"github.com/wailsapp/wails/v3/internal/flags"
"github.com/wailsapp/wails/v3/internal/service"
"github.com/wailsapp/wails/v3/internal/term"
"strings"
)
func toCamelCasePlugin(s string) string {
var camelCase string
var capitalize = true
for _, c := range s {
if c >= 'a' && c <= 'z' || c >= '0' && c <= '9' {
if capitalize {
camelCase += strings.ToUpper(string(c))
capitalize = false
} else {
camelCase += string(c)
}
} else if c >= 'A' && c <= 'Z' {
camelCase += string(c)
capitalize = false
} else {
capitalize = true
}
}
return camelCase + "Plugin"
}
func ServiceInit(options *flags.ServiceInit) error {
if options.Quiet {
term.DisableOutput()
}
if options.PackageName == "" {
options.PackageName = toCamelCasePlugin(options.Name)
}
return service.Install(options)
}