MCPcopy Index your code
hub / github.com/1Panel-dev/1Panel / GetScriptName

Function GetScriptName

agent/utils/controller/controller.go:274–291  ·  view source on GitHub ↗
(keyword string)

Source from the content-addressed store, hash-verified

272}
273
274func GetScriptName(keyword string) (string, error) {
275 client, err := New()
276 if err != nil {
277 return "", err
278 }
279 switch client.Name() {
280 case "systemd":
281 keyword = strings.TrimSuffix(keyword, ".service") + ".service"
282 case "openrc", "sysvinit":
283 lastDotIdx := strings.LastIndex(keyword, ".")
284 if lastDotIdx != -1 {
285 keyword = keyword[:lastDotIdx]
286 }
287 default:
288 return "", fmt.Errorf("unsupported manager: %s", client.Name())
289 }
290 return keyword, nil
291}

Callers

nothing calls this directly

Calls 2

NewFunction · 0.70
NameMethod · 0.65

Tested by

no test coverage detected