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

Function resolveDeclaredShortcutScopes

cmd/error_auth_hint.go:75–92  ·  view source on GitHub ↗

resolveDeclaredShortcutScopes returns the scopes declared by a mounted shortcut command for the given identity.

(cmd *cobra.Command, identity string)

Source from the content-addressed store, hash-verified

73// resolveDeclaredShortcutScopes returns the scopes declared by a mounted
74// shortcut command for the given identity.
75func resolveDeclaredShortcutScopes(cmd *cobra.Command, identity string) []string {
76 if cmd == nil || cmd.Parent() == nil || !strings.HasPrefix(cmd.Name(), "+") {
77 return nil
78 }
79
80 service := cmd.Parent().Name()
81 for _, sc := range shortcuts.AllShortcuts() {
82 if sc.Service != service || sc.Command != cmd.Name() || !shortcutSupportsIdentity(sc, identity) {
83 continue
84 }
85 scopes := sc.DeclaredScopesForIdentity(identity)
86 if len(scopes) == 0 {
87 return nil
88 }
89 return append([]string(nil), scopes...)
90 }
91 return nil
92}
93
94// resolveDeclaredServiceMethodScopes returns the scopes declared by a
95// service/resource/method command. It reconstructs the catalog path from the

Calls 4

AllShortcutsFunction · 0.92
shortcutSupportsIdentityFunction · 0.70
NameMethod · 0.65

Tested by

no test coverage detected