NewAnnotateCommand creates a new `docker manifest annotate` command
(dockerCLI command.Cli)
| 97 | |
| 98 | // NewAnnotateCommand creates a new `docker manifest annotate` command |
| 99 | func 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 | |
| 125 | func runManifestAnnotate(dockerCLI command.Cli, opts annotateOptions) error { |
| 126 | targetRef, err := normalizeReference(opts.target) |
searching dependent graphs…