MCPcopy Index your code
hub / github.com/docker/cli / runTop

Function runTop

cli/command/container/top.go:48–64  ·  view source on GitHub ↗
(ctx context.Context, dockerCli command.Cli, opts *topOptions)

Source from the content-addressed store, hash-verified

46}
47
48func 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}

Callers 1

newTopCommandFunction · 0.85

Calls 3

FlushMethod · 0.95
ClientMethod · 0.65
OutMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…