MCPcopy
hub / github.com/larksuite/cli / commandCatalogPath

Function commandCatalogPath

cmd/error_auth_hint.go:120–126  ·  view source on GitHub ↗

commandCatalogPath reconstructs the catalog path [service, resource..., method] from a command's ancestry, excluding the root command. It is the inverse of the service command tree's construction, so any depth (flat or nested) round-trips through apicatalog.Resolve.

(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

118// the service command tree's construction, so any depth (flat or nested)
119// round-trips through apicatalog.Resolve.
120func commandCatalogPath(cmd *cobra.Command) []string {
121 var path []string
122 for c := cmd; c != nil && c.Parent() != nil; c = c.Parent() {
123 path = append([]string{c.Name()}, path...)
124 }
125 return path
126}
127
128// shortcutSupportsIdentity reports whether a shortcut supports the requested
129// identity, applying the default user-only behavior when AuthTypes is empty.

Callers 2

TestCommandCatalogPathFunction · 0.85

Calls 1

NameMethod · 0.65

Tested by 1

TestCommandCatalogPathFunction · 0.68