mirror of
https://github.com/docker/cli.git
synced 2026-01-18 08:21:31 +03:00
Merge pull request #7325 from tiborvass/case-insensitive-attach
Make --attach case-insensitive Upstream-commit: 2970ba487766f51d0d8f5d026e981abec55c1519 Component: engine
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user