(dockerCLI command.Cli)
| 25 | } |
| 26 | |
| 27 | func 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 | |
| 53 | func runInspect(ctx context.Context, dockerCLI command.Cli, opts inspectOptions) error { |
| 54 | apiClient := dockerCLI.Client() |
no test coverage detected
searching dependent graphs…