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

Accept the multiple --type options in order to output the generated code of the multiple types into a single file #14

Merged
merged 1 commit into from
Aug 21, 2022

Conversation

moznion
Copy link
Owner

@moznion moznion commented Aug 21, 2022

Usage

//go:generate gonstructor --type=AlphaStructure --type=BravoStructure --constructorTypes=allArgs,builder --withGetter --output=./alpha_and_bravo_gen.go"

then, the generated code of AlphaStructure and BravoStructure are combined and put on the single file alpha_and_bravo_gen.go.


rel: #10

… code of the multiple types into a single file

rel: #10

Signed-off-by: moznion <moznion@mail.moznion.net>
@moznion moznion added the enhancement New feature or request label Aug 21, 2022
@moznion moznion self-assigned this Aug 21, 2022

func main() {
var typeNames stringArrayFlag
flag.Var(&typeNames, "type", `[mandatory] A type name. It accepts this option occurs multiple times to output the generated code of the multi types into a single file. If this option is given multiple times, the "-output" option becomes mandatory.`)

Choose a reason for hiding this comment

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

@moznion maybe do types=A,B,C,D,E,F?

For backward compatibility, you can keep type, if u want.

Copy link
Owner Author

@moznion moznion Aug 21, 2022

Choose a reason for hiding this comment

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

Yea, I intend to keep the backward compatibility. Also I think this way to specify the multiple options is suitable rather than comma-separated.
So if I have to have the consistency of the way to give this command's options, it should change -constructorTypes To -constructorType as well as this change.

Copy link

@Antonboom Antonboom Aug 21, 2022

Choose a reason for hiding this comment

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

As u wish :)

@moznion moznion merged commit 41e8632 into master Aug 21, 2022
@moznion moznion deleted the multiple_types_support branch August 21, 2022 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants