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

Pass arguments to final generator #947

Merged
merged 3 commits into from Dec 3, 2016
Merged

Pass arguments to final generator #947

merged 3 commits into from Dec 3, 2016

Conversation

@jsimonetti
Copy link

@jsimonetti jsimonetti commented Dec 2, 2016

This change will allow arguments to goagen which are add after the '--' argument to be passed allong to the generator.

The generate command becomes goagen gen -d --pkg-path= -- --custom-arg=value

Fixes #934

Jeroen Simonetti
This change will allow arguments to goagen which are add after the '--' argument to be passed allong to the generator.

Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
@@ -235,10 +238,10 @@ func run(pkg string, c *cobra.Command) ([]string, error) {
if err != nil {
return nil, fmt.Errorf("invalid package import path: %s", err)
}
return generate(pkgName, pkgPath, c)
return generate(pkgName, pkgPath, c, []string{})

This comment has been minimized.

@raphael

raphael Dec 2, 2016
Member

Please just use nil instead of an empty slice.

return nil, nil
}
}
return nil, fmt.Errorf("no flag --custom=arg found")

This comment has been minimized.

@raphael

raphael Dec 2, 2016
Member

--custom=arg should probably be {{.}}

@raphael
Copy link
Member

@raphael raphael commented Dec 2, 2016

Thank you, the PR looks great. Left two nitpick comments, I'll merge once you address these.

Jeroen Simonetti added 2 commits Dec 3, 2016
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
Jeroen Simonetti
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
@raphael raphael merged commit 11a8a01 into goadesign:master Dec 3, 2016
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@raphael
Copy link
Member

@raphael raphael commented Dec 3, 2016

Thank you! Do you think you could also make a PR against the v1 branch?

@jsimonetti jsimonetti deleted the jsimonetti:generator_flags branch Dec 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants