Skip to content

Commit

Permalink
Values of params supporting multiple values can be separated by both …
Browse files Browse the repository at this point in the history
…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 <f.fissore@arduino.cc>
  • Loading branch information
Federico Fissore committed Sep 15, 2015
1 parent 40f0321 commit 8c877a1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ func (h *slice) String() string {
}

func (h *slice) Set(csv string) error {
values := strings.Split(csv, ",")
var values []string
if strings.Contains(csv, string(os.PathListSeparator)) {
values = strings.Split(csv, string(os.PathListSeparator))
} else {
values = strings.Split(csv, ",")
}

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

0 comments on commit 8c877a1

Please sign in to comment.