()
| 19 | } |
| 20 | |
| 21 | func 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 | |
| 56 | func (r *RootCommand) Execute() error { |
| 57 | return r.cmd.Execute() |
no test coverage detected
searching dependent graphs…