MCPcopy
hub / github.com/basecamp/once / NewRootCommand

Function NewRootCommand

internal/command/root.go:21–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19}
20
21func NewRootCommand() *RootCommand {
22 r := &RootCommand{}
23 r.cmd = &cobra.Command{
24 Use: "once",
25 Short: "Manage web applications from Docker images",
26 SilenceUsage: true,
27 CompletionOptions: cobra.CompletionOptions{
28 HiddenDefaultCmd: true,
29 },
30 RunE: WithNamespace(func(ctx context.Context, ns *docker.Namespace, cmd *cobra.Command, args []string) error {
31 return logging.ToLogFile(func() error {
32 return ui.Run(ns, r.installImageRef)
33 })
34 }),
35 }
36 r.cmd.PersistentFlags().StringVarP(&r.namespace, "namespace", "n", docker.DefaultNamespace, "namespace for containers")
37
38 r.cmd.Flags().StringVar(&r.installImageRef, "install", "", "Path to Docker image to install")
39
40 r.cmd.AddCommand(newBackgroundCommand().cmd)
41 r.cmd.AddCommand(newBackupCommand().cmd)
42 r.cmd.AddCommand(newDeployCommand().cmd)
43 r.cmd.AddCommand(newListCommand().cmd)
44 r.cmd.AddCommand(newRemoveCommand().cmd)
45 r.cmd.AddCommand(newRestoreCommand().cmd)
46 r.cmd.AddCommand(newStartCommand().cmd)
47 r.cmd.AddCommand(newStopCommand().cmd)
48 r.cmd.AddCommand(newTeardownCommand().cmd)
49 r.cmd.AddCommand(newUpdateCommand().cmd)
50 r.cmd.AddCommand(newSelfUpdateCommand().cmd)
51 r.cmd.AddCommand(newVersionCommand().cmd)
52
53 return r
54}
55
56func (r *RootCommand) Execute() error {
57 return r.cmd.Execute()

Callers 1

mainFunction · 0.92

Calls 15

ToLogFileFunction · 0.92
RunFunction · 0.92
WithNamespaceFunction · 0.85
newBackgroundCommandFunction · 0.85
newBackupCommandFunction · 0.85
newDeployCommandFunction · 0.85
newListCommandFunction · 0.85
newRemoveCommandFunction · 0.85
newRestoreCommandFunction · 0.85
newStartCommandFunction · 0.85
newStopCommandFunction · 0.85
newTeardownCommandFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…