MCPcopy Index your code
hub / github.com/larksuite/cli / Execute

Function Execute

cmd/root.go:96–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94var rawInvocationArgs []string
95
96func Execute() int {
97 rawInvocationArgs = os.Args[1:]
98 inv, err := BootstrapInvocationContext(os.Args[1:])
99 if err != nil {
100 fmt.Fprintln(os.Stderr, "Error:", err)
101 return 1
102 }
103 configureFlagCompletions(os.Args)
104
105 ctx := context.Background()
106 f, rootCmd, reg := buildInternal(
107 ctx, inv,
108 WithIO(os.Stdin, os.Stdout, os.Stderr),
109 HideProfile(isSingleAppMode()),
110 )
111
112 // --- Notices (non-blocking) ---
113 if !isCompletionCommand(os.Args) {
114 setupNotices()
115 }
116
117 runErr := rootCmd.Execute()
118
119 // Fire Shutdown lifecycle hooks regardless of run outcome.
120 // emitShutdown imposes a 2s total deadline and never propagates handler
121 // errors (Emit's documented Shutdown contract), so it cannot block exit
122 // or alter the user-visible exit code.
123 if reg != nil && !isCompletionCommand(os.Args) {
124 _ = hook.Emit(ctx, reg, platform.Shutdown, runErr)
125 }
126
127 if runErr != nil {
128 return handleRootError(f, runErr)
129 }
130 return 0
131}
132
133// setupNotices wires both the binary update notice and the skills
134// staleness notice into output.PendingNotice as a composed function.

Callers 3

mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92

Calls 10

EmitFunction · 0.92
configureFlagCompletionsFunction · 0.85
buildInternalFunction · 0.85
WithIOFunction · 0.85
HideProfileFunction · 0.85
isSingleAppModeFunction · 0.85
isCompletionCommandFunction · 0.85
setupNoticesFunction · 0.85
handleRootErrorFunction · 0.85

Tested by

no test coverage detected