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

Function runInspect

cli/command/config/inspect.go:46–73  ·  view source on GitHub ↗

runInspect inspects the given Swarm config.

(ctx context.Context, dockerCLI command.Cli, opts inspectOptions)

Source from the content-addressed store, hash-verified

44
45// runInspect inspects the given Swarm config.
46func runInspect(ctx context.Context, dockerCLI command.Cli, opts inspectOptions) error {
47 apiClient := dockerCLI.Client()
48
49 if opts.pretty {
50 opts.format = "pretty"
51 }
52
53 getRef := func(id string) (any, []byte, error) {
54 res, err := apiClient.ConfigInspect(ctx, id, client.ConfigInspectOptions{})
55 return res.Config, res.Raw, err
56 }
57
58 // check if the user is trying to apply a template to the pretty format, which
59 // is not supported
60 if strings.HasPrefix(opts.format, "pretty") && opts.format != "pretty" {
61 return errors.New("cannot supply extra formatting options to the pretty template")
62 }
63
64 configCtx := formatter.Context{
65 Output: dockerCLI.Out(),
66 Format: newFormat(opts.format, false),
67 }
68
69 if err := inspectFormatWrite(configCtx, opts.names, getRef); err != nil {
70 return cli.StatusError{StatusCode: 1, Status: err.Error()}
71 }
72 return nil
73}

Callers 1

newConfigInspectCommandFunction · 0.70

Calls 6

newFormatFunction · 0.70
inspectFormatWriteFunction · 0.70
ClientMethod · 0.65
OutMethod · 0.65
ConfigInspectMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…