MCPcopy Create free account
hub / github.com/docker/cli / newAnnotateCommand

Function newAnnotateCommand

cli/command/manifest/annotate.go:99–123  ·  view source on GitHub ↗

NewAnnotateCommand creates a new `docker manifest annotate` command

(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

97
98// NewAnnotateCommand creates a new `docker manifest annotate` command
99func newAnnotateCommand(dockerCLI command.Cli) *cobra.Command {
100 var opts annotateOptions
101
102 cmd := &cobra.Command{
103 Use: "annotate [OPTIONS] MANIFEST_LIST MANIFEST",
104 Short: "Add additional information to a local image manifest",
105 Args: cli.ExactArgs(2),
106 RunE: func(cmd *cobra.Command, args []string) error {
107 opts.target = args[0]
108 opts.image = args[1]
109 return runManifestAnnotate(dockerCLI, opts)
110 },
111 DisableFlagsInUseLine: true,
112 }
113
114 flags := cmd.Flags()
115
116 flags.StringVar(&opts.os, "os", "", "Set operating system")
117 flags.StringVar(&opts.arch, "arch", "", "Set architecture")
118 flags.StringVar(&opts.osVersion, "os-version", "", "Set operating system version")
119 flags.StringSliceVar(&opts.osFeatures, "os-features", []string{}, "Set operating system feature")
120 flags.StringVar(&opts.variant, "variant", "", "Set architecture variant")
121
122 return cmd
123}
124
125func runManifestAnnotate(dockerCLI command.Cli, opts annotateOptions) error {
126 targetRef, err := normalizeReference(opts.target)

Callers 3

newManifestCommandFunction · 0.85
TestManifestAnnotateFunction · 0.85

Calls 1

runManifestAnnotateFunction · 0.85

Tested by 2

TestManifestAnnotateFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…