MCPcopy Index your code
hub / github.com/jetify-com/devbox / globalCmd

Function globalCmd

internal/boxcli/global.go:17–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15)
16
17func globalCmd() *cobra.Command {
18 globalCmd := &cobra.Command{}
19 persistentPreRunE := setGlobalConfigForDelegatedCommands(globalCmd)
20 *globalCmd = cobra.Command{
21 Use: "global",
22 Short: "Manage global devbox packages",
23 // PersistentPreRunE is inherited only if children do not implement it
24 // (i.e. it's not chained). So this is fragile. Ideally we stop
25 // using PersistentPreRunE. For now a hack is to pass it down to commands
26 // that declare their own.
27 PersistentPreRunE: persistentPreRunE,
28 PersistentPostRunE: ensureGlobalEnvEnabled,
29 }
30
31 addCommandAndHideConfigFlag(globalCmd, addCmd())
32 addCommandAndHideConfigFlag(globalCmd, installCmd())
33 addCommandAndHideConfigFlag(globalCmd, pathCmd())
34 addCommandAndHideConfigFlag(globalCmd, pullCmd())
35 addCommandAndHideConfigFlag(globalCmd, pushCmd())
36 addCommandAndHideConfigFlag(globalCmd, removeCmd())
37 addCommandAndHideConfigFlag(globalCmd, runCmd(runFlagDefaults{
38 omitNixEnv: true,
39 }))
40 addCommandAndHideConfigFlag(globalCmd, servicesCmd(persistentPreRunE))
41 addCommandAndHideConfigFlag(globalCmd, shellEnvCmd(shellenvFlagDefaults{
42 omitNixEnv: true,
43 }))
44 addCommandAndHideConfigFlag(globalCmd, updateCmd())
45 addCommandAndHideConfigFlag(globalCmd, listCmd())
46
47 return globalCmd
48}
49
50func addCommandAndHideConfigFlag(parent, child *cobra.Command) {
51 parent.AddCommand(child)

Callers 1

RootCmdFunction · 0.85

Calls 13

addCmdFunction · 0.85
installCmdFunction · 0.85
pathCmdFunction · 0.85
pullCmdFunction · 0.85
pushCmdFunction · 0.85
removeCmdFunction · 0.85
runCmdFunction · 0.85
servicesCmdFunction · 0.85
shellEnvCmdFunction · 0.85
updateCmdFunction · 0.85

Tested by

no test coverage detected