Skip to content

Do not try to split as folders command line params that are not folders #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ const FLAG_LOGGER_MACHINE = "machine"
const FLAG_VERSION = "version"
const FLAG_VID_PID = "vid-pid"

type slice []string
type foldersFlag []string

func (h *slice) String() string {
func (h *foldersFlag) String() string {
return fmt.Sprint(*h)
}

func (h *slice) Set(csv string) error {
func (h *foldersFlag) Set(csv string) error {
var values []string
if strings.Contains(csv, string(os.PathListSeparator)) {
values = strings.Split(csv, string(os.PathListSeparator))
Expand All @@ -99,15 +99,28 @@ func (h *slice) Set(csv string) error {
return nil
}

type propertiesFlag []string

func (h *propertiesFlag) String() string {
return fmt.Sprint(*h)
}

func (h *propertiesFlag) Set(value string) error {
value = strings.TrimSpace(value)
*h = append(*h, value)

return nil
}

var compileFlag *bool
var preprocessFlag *bool
var dumpPrefsFlag *bool
var buildOptionsFileFlag *string
var hardwareFoldersFlag slice
var toolsFoldersFlag slice
var librariesBuiltInFoldersFlag slice
var librariesFoldersFlag slice
var customBuildPropertiesFlag slice
var hardwareFoldersFlag foldersFlag
var toolsFoldersFlag foldersFlag
var librariesBuiltInFoldersFlag foldersFlag
var librariesFoldersFlag foldersFlag
var customBuildPropertiesFlag propertiesFlag
var fqbnFlag *string
var coreAPIVersionFlag *string
var ideVersionFlag *string
Expand Down Expand Up @@ -336,7 +349,7 @@ func main() {
defer os.Exit(exitCode)
}

func setContextSliceKeyOrLoadItFromOptions(context map[string]interface{}, cliFlag slice, buildOptions map[string]string, contextKey string, paramName string, mandatory bool) (error, bool) {
func setContextSliceKeyOrLoadItFromOptions(context map[string]interface{}, cliFlag []string, buildOptions map[string]string, contextKey string, paramName string, mandatory bool) (error, bool) {
values, err := toSliceOfUnquoted(cliFlag)
if err != nil {
return err, true
Expand Down Expand Up @@ -364,7 +377,7 @@ func toExitCode(err error) int {
return 1
}

func toSliceOfUnquoted(value slice) ([]string, error) {
func toSliceOfUnquoted(value []string) ([]string, error) {
var values []string
for _, v := range value {
v, err := gohasissues.Unquote(v)
Expand Down