newVersionCommand creates a new cobra.Command for `docker version`
(dockerCLI command.Cli)
| 173 | |
| 174 | // newVersionCommand creates a new cobra.Command for `docker version` |
| 175 | func newVersionCommand(dockerCLI command.Cli) *cobra.Command { |
| 176 | var opts versionOptions |
| 177 | |
| 178 | cmd := &cobra.Command{ |
| 179 | Use: "version [OPTIONS]", |
| 180 | Short: "Show the Docker version information", |
| 181 | Args: cli.NoArgs, |
| 182 | RunE: func(cmd *cobra.Command, args []string) error { |
| 183 | return runVersion(cmd.Context(), dockerCLI, &opts) |
| 184 | }, |
| 185 | Annotations: map[string]string{ |
| 186 | "category-top": "10", |
| 187 | }, |
| 188 | ValidArgsFunction: cobra.NoFileCompletions, |
| 189 | DisableFlagsInUseLine: true, |
| 190 | } |
| 191 | |
| 192 | cmd.Flags().StringVarP(&opts.format, "format", "f", "", flagsHelper.InspectFormatHelp) |
| 193 | return cmd |
| 194 | } |
| 195 | |
| 196 | func reformatDate(buildTime string) string { |
| 197 | t, errTime := time.Parse(time.RFC3339Nano, buildTime) |
searching dependent graphs…