(app *App)
| 13 | ) |
| 14 | |
| 15 | func newRebuildCmd(app *App) *cobra.Command { |
| 16 | var ( |
| 17 | selector *CodespaceSelector |
| 18 | fullRebuild bool |
| 19 | ) |
| 20 | |
| 21 | rebuildCmd := &cobra.Command{ |
| 22 | Use: "rebuild", |
| 23 | Short: "Rebuild a codespace", |
| 24 | Long: heredoc.Doc(` |
| 25 | Rebuilding recreates your codespace. |
| 26 | |
| 27 | Your code and any current changes will be preserved. Your codespace will be rebuilt using |
| 28 | your working directory's dev container. A full rebuild also removes cached Docker images. |
| 29 | `), |
| 30 | Args: cobra.NoArgs, |
| 31 | RunE: func(cmd *cobra.Command, args []string) error { |
| 32 | return app.Rebuild(cmd.Context(), selector, fullRebuild) |
| 33 | }, |
| 34 | } |
| 35 | |
| 36 | selector = AddCodespaceSelector(rebuildCmd, app.apiClient) |
| 37 | |
| 38 | rebuildCmd.Flags().BoolVar(&fullRebuild, "full", false, "Perform a full rebuild") |
| 39 | |
| 40 | return rebuildCmd |
| 41 | } |
| 42 | |
| 43 | func (a *App) Rebuild(ctx context.Context, selector *CodespaceSelector, full bool) (err error) { |
| 44 | ctx, cancel := context.WithCancel(ctx) |
no test coverage detected