(cmd *cobra.Command)
| 46 | } |
| 47 | |
| 48 | func 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 | |
| 79 | func stopAction(cmd *cobra.Command, args []string) error { |
| 80 | options, err := stopOptions(cmd) |
no test coverage detected
searching dependent graphs…