MCPcopy Index your code
hub / github.com/devspace-sh/devspace / NewRestartCmd

Function NewRestartCmd

cmd/restart.go:38–70  ·  view source on GitHub ↗

NewRestartCmd creates a new purge command

(f factory.Factory, globalFlags *flags.GlobalFlags)

Source from the content-addressed store, hash-verified

36
37// NewRestartCmd creates a new purge command
38func 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#######################################################
51Restarts containers where the sync restart helper
52is injected:
53
54devspace restart
55devspace 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
73func (cmd *RestartCmd) Run(f factory.Factory) error {

Callers 1

BuildRootFunction · 0.70

Calls 3

RunMethod · 0.95
GetInstanceFunction · 0.92
SetPluginCommandFunction · 0.92

Tested by

no test coverage detected