MCPcopy Create free account
hub / github.com/larksuite/cli / BootstrapInvocationContext

Function BootstrapInvocationContext

cmd/bootstrap.go:17–30  ·  view source on GitHub ↗

BootstrapInvocationContext extracts global invocation options before the real command tree is built, so provider-backed config resolution sees the correct profile from the start.

(args []string)

Source from the content-addressed store, hash-verified

15// the real command tree is built, so provider-backed config resolution sees
16// the correct profile from the start.
17func BootstrapInvocationContext(args []string) (cmdutil.InvocationContext, error) {
18 var globals GlobalOptions
19
20 fs := pflag.NewFlagSet("bootstrap", pflag.ContinueOnError)
21 fs.ParseErrorsAllowlist.UnknownFlags = true
22 fs.SetInterspersed(true)
23 fs.SetOutput(io.Discard)
24 RegisterGlobalFlags(fs, &globals)
25
26 if err := fs.Parse(args); err != nil && !errors.Is(err, pflag.ErrHelp) {
27 return cmdutil.InvocationContext{}, err
28 }
29 return cmdutil.InvocationContext{Profile: globals.Profile}, nil
30}

Calls 2

RegisterGlobalFlagsFunction · 0.85
IsMethod · 0.80