Browse code

Make --attach case-insensitive

Docker-DCO-1.1-Signed-off-by: Tibor Vass <teabee89@gmail.com> (github: tiborvass)

Tibor Vass authored on 2014/07/30 23:20:52
Showing 1 changed files
... ...
@@ -87,10 +87,13 @@ func (opts *ListOpts) Len() int {
87 87
 type ValidatorFctType func(val string) (string, error)
88 88
 
89 89
 func ValidateAttach(val string) (string, error) {
90
-	if val != "stdin" && val != "stdout" && val != "stderr" {
91
-		return val, fmt.Errorf("Unsupported stream name: %s", val)
90
+	s := strings.ToLower(val)
91
+	for _, str := range []string{"stdin", "stdout", "stderr"} {
92
+		if s == str {
93
+			return s, nil
94
+		}
92 95
 	}
93
-	return val, nil
96
+	return val, fmt.Errorf("valid streams are STDIN, STDOUT and STDERR.")
94 97
 }
95 98
 
96 99
 func ValidateLink(val string) (string, error) {