tool: Move multipleFlag handling to utils.go

It's a generic thing and may be shared by other code.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
Rolf Neugebauer 2017-11-08 13:30:30 +00:00
parent a272eba740
commit fe953f6bc2
2 changed files with 12 additions and 11 deletions

View File

@ -618,17 +618,6 @@ func discoverBackend(config QemuConfig) QemuConfig {
return config
}
type multipleFlag []string
func (f *multipleFlag) String() string {
return "A multiple flag is a type of flag that can be repeated any number of times"
}
func (f *multipleFlag) Set(value string) error {
*f = append(*f, value)
return nil
}
func buildQemuForwardings(publishFlags multipleFlag, containerized bool) (string, error) {
if len(publishFlags) == 0 {
return "", nil

View File

@ -8,6 +8,18 @@ import (
"strings"
)
// Handle flags with multiple occurrences
type multipleFlag []string
func (f *multipleFlag) String() string {
return "A multiple flag is a type of flag that can be repeated any number of times"
}
func (f *multipleFlag) Set(value string) error {
*f = append(*f, value)
return nil
}
func getStringValue(envKey string, flagVal string, defaultVal string) string {
var res string