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

Function newVersionCommand

cli/command/system/version.go:175–194  ·  view source on GitHub ↗

newVersionCommand creates a new cobra.Command for `docker version`

(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

173
174// newVersionCommand creates a new cobra.Command for `docker version`
175func 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
196func reformatDate(buildTime string) string {
197 t, errTime := time.Parse(time.RFC3339Nano, buildTime)

Callers 1

TestVersionWithoutServerFunction · 0.85

Calls 1

runVersionFunction · 0.85

Tested by 1

TestVersionWithoutServerFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…