()
| 33 | } |
| 34 | |
| 35 | func RootCmd() *cobra.Command { |
| 36 | flags := rootCmdFlags{} |
| 37 | command := &cobra.Command{ |
| 38 | Use: "devbox", |
| 39 | Short: "Instant, easy, predictable development environments", |
| 40 | // Warning, PersistentPreRunE is not called if a subcommand also declares |
| 41 | // it. TODO: Figure out a better way to implement this so that subcommands |
| 42 | // can't accidentally override it. |
| 43 | PersistentPreRun: func(cmd *cobra.Command, args []string) { |
| 44 | if flags.quiet { |
| 45 | cmd.SetErr(io.Discard) |
| 46 | } |
| 47 | vercheck.CheckVersion(cmd.ErrOrStderr(), cmd.CommandPath()) |
| 48 | }, |
| 49 | RunE: func(cmd *cobra.Command, args []string) error { |
| 50 | return cmd.Help() |
| 51 | }, |
| 52 | SilenceErrors: true, |
| 53 | SilenceUsage: true, |
| 54 | } |
| 55 | |
| 56 | // Stable commands |
| 57 | command.AddCommand(addCmd()) |
| 58 | if featureflag.Auth.Enabled() { |
| 59 | command.AddCommand(authCmd()) |
| 60 | } |
| 61 | command.AddCommand(cacheCmd()) |
| 62 | command.AddCommand(createCmd()) |
| 63 | command.AddCommand(secretsCmd()) |
| 64 | command.AddCommand(generateCmd()) |
| 65 | command.AddCommand(globalCmd()) |
| 66 | command.AddCommand(infoCmd()) |
| 67 | command.AddCommand(initCmd()) |
| 68 | command.AddCommand(installCmd()) |
| 69 | command.AddCommand(integrateCmd()) |
| 70 | command.AddCommand(listCmd()) |
| 71 | command.AddCommand(logCmd()) |
| 72 | command.AddCommand(patchCmd()) |
| 73 | command.AddCommand(removeCmd()) |
| 74 | command.AddCommand(runCmd(runFlagDefaults{})) |
| 75 | command.AddCommand(searchCmd()) |
| 76 | command.AddCommand(servicesCmd()) |
| 77 | command.AddCommand(setupCmd()) |
| 78 | command.AddCommand(shellCmd(shellFlagDefaults{})) |
| 79 | command.AddCommand(shellEnvCmd(shellenvFlagDefaults{ |
| 80 | recomputeEnv: true, |
| 81 | })) |
| 82 | command.AddCommand(updateCmd()) |
| 83 | command.AddCommand(versionCmd()) |
| 84 | // Internal commands |
| 85 | command.AddCommand(genDocsCmd()) |
| 86 | |
| 87 | // Register the "all" command to list all commands, including hidden ones. |
| 88 | // This makes debugging easier. |
| 89 | command.AddCommand(&cobra.Command{ |
| 90 | Use: "all", |
| 91 | Short: "List all commands, including hidden ones", |
| 92 | Hidden: true, |
no test coverage detected