MCPcopy Create free account
hub / github.com/containerd/nerdctl / stopOptions

Function stopOptions

cmd/nerdctl/container/container_stop.go:48–77  ·  view source on GitHub ↗
(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

46}
47
48func stopOptions(cmd *cobra.Command) (types.ContainerStopOptions, error) {
49 globalOptions, err := helpers.ProcessRootCmdFlags(cmd)
50 if err != nil {
51 return types.ContainerStopOptions{}, err
52 }
53 var timeout *time.Duration
54 if cmd.Flags().Changed("time") {
55 timeValue, err := cmd.Flags().GetInt("time")
56 if err != nil {
57 return types.ContainerStopOptions{}, err
58 }
59 t := time.Duration(timeValue) * time.Second
60 timeout = &t
61 }
62 var signal string
63 if cmd.Flags().Changed("signal") {
64 signalValue, err := cmd.Flags().GetString("signal")
65 if err != nil {
66 return types.ContainerStopOptions{}, err
67 }
68 signal = signalValue
69 }
70 return types.ContainerStopOptions{
71 Stdout: cmd.OutOrStdout(),
72 Stderr: cmd.ErrOrStderr(),
73 GOptions: globalOptions,
74 Timeout: timeout,
75 Signal: signal,
76 }, nil
77}
78
79func stopAction(cmd *cobra.Command, args []string) error {
80 options, err := stopOptions(cmd)

Callers 1

stopActionFunction · 0.85

Calls 1

ProcessRootCmdFlagsFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…