newInfoCommand creates a new cobra.Command for `docker info`
(dockerCLI command.Cli)
| 61 | |
| 62 | // newInfoCommand creates a new cobra.Command for `docker info` |
| 63 | func newInfoCommand(dockerCLI command.Cli) *cobra.Command { |
| 64 | var opts infoOptions |
| 65 | |
| 66 | cmd := &cobra.Command{ |
| 67 | Use: "info [OPTIONS]", |
| 68 | Short: "Display system-wide information", |
| 69 | Args: cli.NoArgs, |
| 70 | RunE: func(cmd *cobra.Command, args []string) error { |
| 71 | return runInfo(cmd.Context(), cmd, dockerCLI, &opts) |
| 72 | }, |
| 73 | Annotations: map[string]string{ |
| 74 | "category-top": "12", |
| 75 | "aliases": "docker system info, docker info", |
| 76 | }, |
| 77 | ValidArgsFunction: cobra.NoFileCompletions, |
| 78 | DisableFlagsInUseLine: true, |
| 79 | } |
| 80 | |
| 81 | cmd.Flags().StringVarP(&opts.format, "format", "f", "", flagsHelper.InspectFormatHelp) |
| 82 | return cmd |
| 83 | } |
| 84 | |
| 85 | func runInfo(ctx context.Context, cmd *cobra.Command, dockerCli command.Cli, opts *infoOptions) error { |
| 86 | info := dockerInfo{ |
no test coverage detected
searching dependent graphs…