NewRestartCmd creates a new purge command
(f factory.Factory, globalFlags *flags.GlobalFlags)
| 36 | |
| 37 | // NewRestartCmd creates a new purge command |
| 38 | func NewRestartCmd(f factory.Factory, globalFlags *flags.GlobalFlags) *cobra.Command { |
| 39 | cmd := &RestartCmd{ |
| 40 | GlobalFlags: globalFlags, |
| 41 | log: log.GetInstance(), |
| 42 | } |
| 43 | |
| 44 | restartCmd := &cobra.Command{ |
| 45 | Use: "restart", |
| 46 | Short: "Restarts containers where the sync restart helper is injected", |
| 47 | Long: ` |
| 48 | ####################################################### |
| 49 | ################## devspace restart ################### |
| 50 | ####################################################### |
| 51 | Restarts containers where the sync restart helper |
| 52 | is injected: |
| 53 | |
| 54 | devspace restart |
| 55 | devspace restart -n my-namespace |
| 56 | #######################################################`, |
| 57 | Args: cobra.NoArgs, |
| 58 | RunE: func(cobraCmd *cobra.Command, args []string) error { |
| 59 | plugin.SetPluginCommand(cobraCmd, args) |
| 60 | return cmd.Run(f) |
| 61 | }, |
| 62 | } |
| 63 | restartCmd.Flags().StringVarP(&cmd.Container, "container", "c", "", "Container name within pod to restart") |
| 64 | restartCmd.Flags().StringVar(&cmd.Pod, "pod", "", "Pod to restart") |
| 65 | restartCmd.Flags().StringVarP(&cmd.LabelSelector, "label-selector", "l", "", "Comma separated key=value selector list (e.g. release=test)") |
| 66 | restartCmd.Flags().StringVar(&cmd.Name, "name", "", "The sync path name to restart") |
| 67 | restartCmd.Flags().BoolVar(&cmd.Pick, "pick", true, "Select a pod") |
| 68 | |
| 69 | return restartCmd |
| 70 | } |
| 71 | |
| 72 | // Run executes the purge command logic |
| 73 | func (cmd *RestartCmd) Run(f factory.Factory) error { |
no test coverage detected