mirror of
https://github.com/docker/cli.git
synced 2026-01-18 08:21:31 +03:00
committed by
Vincent Demeester
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user