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

Conversation

Projects
None yet
2 participants
@jsimonetti
Copy link
Contributor

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

Pass arguments to final generator
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

This comment has been minimized.

Copy link
Member

raphael commented Dec 2, 2016

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

jsimonetti added some commits Dec 3, 2016

Use nil instead of empty slice
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
Use template var for argument
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>

@raphael raphael merged commit 11a8a01 into goadesign:master Dec 3, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@raphael

This comment has been minimized.

Copy link
Member

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