mirror of https://github.com/docker/cli.git
Make --attach case-insensitive
Docker-DCO-1.1-Signed-off-by: Tibor Vass <teabee89@gmail.com> (github: tiborvass)
This commit is contained in:
parent
29adea2e42
commit
67a518b70c
|
@ -87,10 +87,13 @@ func (opts *ListOpts) Len() int {
|
||||||
type ValidatorFctType func(val string) (string, error)
|
type ValidatorFctType func(val string) (string, error)
|
||||||
|
|
||||||
func ValidateAttach(val string) (string, error) {
|
func ValidateAttach(val string) (string, error) {
|
||||||
if val != "stdin" && val != "stdout" && val != "stderr" {
|
s := strings.ToLower(val)
|
||||||
return val, fmt.Errorf("Unsupported stream name: %s", 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) {
|
func ValidateLink(val string) (string, error) {
|
||||||
|
|
Loading…
Reference in New Issue