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

Function resolveShortcutIdentity

shortcuts/common/runner.go:980–994  ·  view source on GitHub ↗
(cmd *cobra.Command, f *cmdutil.Factory, s *Shortcut)

Source from the content-addressed store, hash-verified

978}
979
980func resolveShortcutIdentity(cmd *cobra.Command, f *cmdutil.Factory, s *Shortcut) (core.Identity, error) {
981 // Step 1: determine identity (--as > default-as > auto-detect).
982 asFlag, _ := cmd.Flags().GetString("as")
983 as := f.ResolveAs(cmd.Context(), cmd, core.Identity(asFlag))
984
985 if err := f.CheckStrictMode(cmd.Context(), as); err != nil {
986 return "", err
987 }
988
989 // Step 2: check if this shortcut supports the resolved identity.
990 if err := f.CheckIdentity(as, s.AuthTypes); err != nil {
991 return "", err
992 }
993 return as, nil
994}
995
996func checkShortcutScopes(f *cmdutil.Factory, ctx context.Context, as core.Identity, config *core.CliConfig, scopes []string) error {
997 if len(scopes) == 0 {

Callers 1

runShortcutFunction · 0.85

Calls 4

IdentityTypeAlias · 0.92
ResolveAsMethod · 0.80
CheckStrictModeMethod · 0.80
CheckIdentityMethod · 0.80

Tested by

no test coverage detected