(ctx context.Context, dockerCli command.Cli, opts *topOptions)
| 46 | } |
| 47 | |
| 48 | func runTop(ctx context.Context, dockerCli command.Cli, opts *topOptions) error { |
| 49 | procList, err := dockerCli.Client().ContainerTop(ctx, opts.container, client.ContainerTopOptions{ |
| 50 | Arguments: opts.args, |
| 51 | }) |
| 52 | if err != nil { |
| 53 | return err |
| 54 | } |
| 55 | |
| 56 | w := tabwriter.NewWriter(dockerCli.Out(), 20, 1, 3, ' ', 0) |
| 57 | _, _ = fmt.Fprintln(w, strings.Join(procList.Titles, "\t")) |
| 58 | |
| 59 | for _, proc := range procList.Processes { |
| 60 | _, _ = fmt.Fprintln(w, strings.Join(proc, "\t")) |
| 61 | } |
| 62 | _ = w.Flush() |
| 63 | return nil |
| 64 | } |
no test coverage detected
searching dependent graphs…