MCPcopy Index your code
hub / github.com/yusing/godoxy / aliasCommandPath

Function aliasCommandPath

cmd/cli/cli.go:528–545  ·  view source on GitHub ↗
(ep Endpoint)

Source from the content-addressed store, hash-verified

526}
527
528func aliasCommandPath(ep Endpoint) []string {
529 rawPath := strings.TrimPrefix(ep.Path, "/api/v1/")
530 rawPath = strings.Trim(rawPath, "/")
531 if rawPath == "" {
532 return nil
533 }
534 parts := strings.Split(rawPath, "/")
535 if len(parts) == 1 {
536 if isPathParam(parts[0]) {
537 return nil
538 }
539 return []string{toKebabToken(parts[0])}
540 }
541 if isPathParam(parts[0]) || isPathParam(parts[1]) {
542 return nil
543 }
544 return []string{toKebabToken(parts[0]), toKebabToken(parts[1])}
545}
546
547func isPathParam(s string) bool {
548 return strings.HasPrefix(s, "{") || strings.HasPrefix(s, ":")

Callers 3

findEndpointAliasFunction · 0.85
nearestForGroupFunction · 0.85
formatEndpointHelpFunction · 0.85

Calls 2

isPathParamFunction · 0.85
toKebabTokenFunction · 0.85

Tested by

no test coverage detected