Skip to content

Commit 8c877a1

Browse files
author
Federico Fissore
committed
Values of params supporting multiple values can be separated by both a comma or
a platform specific path separator (":" on unixes, ";" on windows) Specifying each param multiple times (-param value -param value) instead of separating values with commas is preferred Fixes #2 Signed-off-by: Federico Fissore <[email protected]>
1 parent 40f0321 commit 8c877a1

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Diff for: main.go

+10-5
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ func (h *slice) String() string {
5353
}
5454

5555
func (h *slice) Set(csv string) error {
56-
values := strings.Split(csv, ",")
56+
var values []string
57+
if strings.Contains(csv, string(os.PathListSeparator)) {
58+
values = strings.Split(csv, string(os.PathListSeparator))
59+
} else {
60+
values = strings.Split(csv, ",")
61+
}
5762

5863
for _, value := range values {
5964
value = strings.TrimSpace(value)
@@ -81,10 +86,10 @@ var versionFlag *bool
8186
func init() {
8287
compileFlag = flag.Bool("compile", false, "compiles the given sketch")
8388
dumpPrefsFlag = flag.Bool("dump-prefs", false, "dumps build properties used when compiling")
84-
flag.Var(&hardwareFoldersFlag, "hardware", "comma-separated list of 'hardware' folders")
85-
flag.Var(&toolsFoldersFlag, "tools", "comma-separated list of 'tools' folders")
86-
flag.Var(&librariesFoldersFlag, "libraries", "comma-separated list of 'libraries' folders")
87-
flag.Var(&customBuildPropertiesFlag, "prefs", "comma-separated list of custom preferences")
89+
flag.Var(&hardwareFoldersFlag, "hardware", "Specify a 'hardware' folder. Can be added multiple times for specifying multiple 'hardware' folders")
90+
flag.Var(&toolsFoldersFlag, "tools", "Specify a 'tools' folder. Can be added multiple times for specifying multiple 'tools' folders")
91+
flag.Var(&librariesFoldersFlag, "libraries", "Specify a 'libraries' folder. Can be added multiple times for specifying multiple 'libraries' folders")
92+
flag.Var(&customBuildPropertiesFlag, "prefs", "Specify a custom preference. Can be added multiple times for specifying multiple custom preferences")
8893
fqbnFlag = flag.String("fqbn", "", "fully qualified board name")
8994
ideVersionFlag = flag.String("ide-version", "10600", "fake IDE version")
9095
buildPathFlag = flag.String("build-path", "", "build path")

0 commit comments

Comments
 (0)