Make --attach case-insensitive

Docker-DCO-1.1-Signed-off-by: Tibor Vass <teabee89@gmail.com> (github: tiborvass)
Upstream-commit: a7134132933d899f30ab775ac9604ff4e87d7c8d
Component: engine
This commit is contained in:
Tibor Vass
2014-07-30 15:36:16 -04:00
parent 69c6e53156
commit d3b2916a28
+6 -3
View File
@@ -87,10 +87,13 @@ func (opts *ListOpts) Len() int {
type ValidatorFctType func(val string) (string, error)
func ValidateAttach(val string) (string, error) {
if val != "stdin" && val != "stdout" && val != "stderr" {
return val, fmt.Errorf("Unsupported stream name: %s", val)
s := strings.ToLower(val)
for _, str := range []string{"stdin", "stdout", "stderr"} {
if s == str {
return s, nil
}
}
return val, nil
return val, fmt.Errorf("valid streams are STDIN, STDOUT and STDERR.")
}
func ValidateLink(val string) (string, error) {