mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-22 02:21:34 +00:00
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:
parent
a272eba740
commit
fe953f6bc2
@ -618,17 +618,6 @@ func discoverBackend(config QemuConfig) QemuConfig {
|
|||||||
return config
|
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) {
|
func buildQemuForwardings(publishFlags multipleFlag, containerized bool) (string, error) {
|
||||||
if len(publishFlags) == 0 {
|
if len(publishFlags) == 0 {
|
||||||
return "", nil
|
return "", nil
|
||||||
|
@ -8,6 +8,18 @@ import (
|
|||||||
"strings"
|
"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 {
|
func getStringValue(envKey string, flagVal string, defaultVal string) string {
|
||||||
var res string
|
var res string
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user