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

Function newInspectCommand

cli/command/service/inspect.go:27–51  ·  view source on GitHub ↗
(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

25}
26
27func newInspectCommand(dockerCLI command.Cli) *cobra.Command {
28 var opts inspectOptions
29
30 cmd := &cobra.Command{
31 Use: "inspect [OPTIONS] SERVICE [SERVICE...]",
32 Short: "Display detailed information on one or more services",
33 Args: cli.RequiresMinArgs(1),
34 RunE: func(cmd *cobra.Command, args []string) error {
35 opts.refs = args
36
37 if opts.pretty && len(opts.format) > 0 {
38 return errors.New("--format is incompatible with human friendly format")
39 }
40 return runInspect(cmd.Context(), dockerCLI, opts)
41 },
42 ValidArgsFunction: completeServiceNames(dockerCLI),
43 DisableFlagsInUseLine: true,
44 }
45
46 flags := cmd.Flags()
47 flags.StringVarP(&opts.format, "format", "f", "", flagsHelper.InspectFormatHelp)
48 flags.BoolVar(&opts.pretty, "pretty", false, "Print the information in a human friendly format")
49
50 return cmd
51}
52
53func runInspect(ctx context.Context, dockerCLI command.Cli, opts inspectOptions) error {
54 apiClient := dockerCLI.Client()

Callers 1

newServiceCommandFunction · 0.70

Calls 2

completeServiceNamesFunction · 0.85
runInspectFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…