It was only used internally and has no external users. It should not be used for new uses, because it also adds a minimum API version constraint and a default from env-var, which must be evaluated for each individual use of such flags. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
18 lines
571 B
Go
18 lines
571 B
Go
package image
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/spf13/pflag"
|
|
)
|
|
|
|
// addPlatformFlag adds "--platform" to a set of flags for API version 1.32 and
|
|
// later, using the value of "DOCKER_DEFAULT_PLATFORM" (if set) as a default.
|
|
//
|
|
// It should not be used for new uses, which may have a different API version
|
|
// requirement.
|
|
func addPlatformFlag(flags *pflag.FlagSet, target *string) {
|
|
flags.StringVar(target, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Set platform if server is multi-platform capable")
|
|
_ = flags.SetAnnotation("platform", "version", []string{"1.32"})
|
|
}
|