add daemon labels

Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
Victor Vieux 2014-11-20 18:36:05 +00:00 committed by Vincent Demeester
parent bcae148da2
commit 1eda63e7e4
1 changed files with 11 additions and 0 deletions

View File

@ -43,6 +43,10 @@ func MirrorListVar(values *[]string, names []string, usage string) {
flag.Var(newListOptsRef(values, ValidateMirror), names, usage) flag.Var(newListOptsRef(values, ValidateMirror), names, usage)
} }
func LabelListVar(values *[]string, names []string, usage string) {
flag.Var(newListOptsRef(values, ValidateLabel), names, usage)
}
// ListOpts type // ListOpts type
type ListOpts struct { type ListOpts struct {
values *[]string values *[]string
@ -227,3 +231,10 @@ func ValidateMirror(val string) (string, error) {
return fmt.Sprintf("%s://%s/v1/", uri.Scheme, uri.Host), nil 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
}