mirror of https://github.com/docker/cli.git
add daemon labels
Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
parent
bcae148da2
commit
1eda63e7e4
11
opts/opts.go
11
opts/opts.go
|
@ -43,6 +43,10 @@ func MirrorListVar(values *[]string, names []string, usage string) {
|
|||
flag.Var(newListOptsRef(values, ValidateMirror), names, usage)
|
||||
}
|
||||
|
||||
func LabelListVar(values *[]string, names []string, usage string) {
|
||||
flag.Var(newListOptsRef(values, ValidateLabel), names, usage)
|
||||
}
|
||||
|
||||
// ListOpts type
|
||||
type ListOpts struct {
|
||||
values *[]string
|
||||
|
@ -227,3 +231,10 @@ func ValidateMirror(val string) (string, error) {
|
|||
|
||||
return fmt.Sprintf("%s://%s/v1/", uri.Scheme, uri.Host), nil
|
||||
}
|
||||
|
||||
func ValidateLabel(val string) (string, error) {
|
||||
if strings.Count(val, "=") != 1 {
|
||||
return "", fmt.Errorf("bad attribute format: %s", val)
|
||||
}
|
||||
return val, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue