MCPcopy Create free account
hub / github.com/dropbox/dbxcli / Execute

Function Execute

cmd/root.go:305–325  ·  view source on GitHub ↗

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

()

Source from the content-addressed store, hash-verified

303// Execute adds all child commands to the root command sets flags appropriately.
304// This is called by main.main(). It only needs to happen once to the rootCmd.
305func Execute() {
306 args := os.Args[1:]
307 jsonErrorOutput := outputJSONRequested(args)
308 if err := rawArgsHelpOutputFormatError(args); err != nil {
309 renderCommandErrorWithJSON(RootCmd, err, jsonErrorOutput)
310 os.Exit(exitCodeForError(err))
311 }
312
313 restoreDeprecatedCommands := func() {}
314 if rawArgsRequestJSONHelp(args) {
315 restoreDeprecatedCommands = temporarilyClearDeprecatedCommands(RootCmd)
316 }
317 defer restoreDeprecatedCommands()
318 defer finishCommandContext()
319
320 cmd, err := RootCmd.ExecuteC()
321 if err != nil {
322 renderCommandErrorWithJSON(cmd, err, jsonErrorOutput)
323 os.Exit(exitCodeForError(err))
324 }
325}
326
327func loadOAuthCredentialsFromEnv() {
328 personalAppKey = getEnv("DROPBOX_PERSONAL_APP_KEY", personalAppKey)

Callers 2

mainFunction · 0.92
TestExecuteExitHelperFunction · 0.85

Calls 7

outputJSONRequestedFunction · 0.85
exitCodeForErrorFunction · 0.85
rawArgsRequestJSONHelpFunction · 0.85
finishCommandContextFunction · 0.85

Tested by 1

TestExecuteExitHelperFunction · 0.68