From 67a518b70c76c9d55b0f551f76d3c999f05377d1 Mon Sep 17 00:00:00 2001 From: Tibor Vass Date: Wed, 30 Jul 2014 10:20:52 -0400 Subject: [PATCH] Make --attach case-insensitive Docker-DCO-1.1-Signed-off-by: Tibor Vass (github: tiborvass) --- opts/opts.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/opts/opts.go b/opts/opts.go index 43bef37068..bfee2ad217 100644 --- a/opts/opts.go +++ b/opts/opts.go @@ -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) {