Skip to content
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

Add support for command args with JSON Array #38

Merged
merged 6 commits into from
Dec 9, 2015

Conversation

justenwalker
Copy link
Contributor

See README.md for a better description

  • Refactor getCmd into argsToCmd and strToCmd
  • Add *Cmd parameters to all config structs
  • Add parseCommandArgs function which supports JSON array or JSON string
  • Support parsing interfaces as a string with parseInterfaces
  • Do parsing of all commands once - during loadConfig()
  • Update README

For #37

@justenwalker justenwalker force-pushed the array-args branch 2 times, most recently from cf18933 to 5b5b1c3 Compare December 9, 2015 04:32
- Refactor getCmd into argsToCmd and strToCmd
- Add *Cmd parameters to all config structs
- Add parseCommandArgs function which supports JSON array or JSON string
- Do parsing of all commands once - during loadConfig()
- Update README
}
}

func getCmd(args []string) *exec.Cmd {
func argsToCmd(args []string) *exec.Cmd {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like argsToCmd and strToCmd should be moved into config.go now, just because all but one of their callers are in config.go.

@tgross
Copy link
Contributor

tgross commented Dec 9, 2015

I like the approach here. Just a few comments to fix I think.

- If JSON is not provided, return an empty string form parseInterfaces
  to prevent future null-ref problems
- Convert errors.New(fmt.Sprintf()) into fmt.Errorf()
- Break up long lines using the former convention
@justenwalker
Copy link
Contributor Author

@tgross I agree with and have addressed your comments. fmt.Errorf is now my new friend - nice find!

@tgross
Copy link
Contributor

tgross commented Dec 9, 2015

LGTM! Merging!

tgross added a commit that referenced this pull request Dec 9, 2015
Add support for command args with JSON Array
@tgross tgross merged commit dd157e8 into TritonDataCenter:master Dec 9, 2015
@justenwalker justenwalker deleted the array-args branch December 15, 2015 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants