-
Notifications
You must be signed in to change notification settings - Fork 63
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
feature: support multiple prefixes #142
Conversation
ec8136d
to
43e6c14
Compare
I'm unsure about the way I documented it in the --help and in the README.md I'm open to suggestion I also fixed some typos. I had no idea what could have been "presed", so I used "present" |
"presed" means default used, we can remove it safely since we have mentioned the default enabled sections. |
43e6c14
to
223cca5
Compare
I removed them, please read and tell me |
223cca5
to
790e621
Compare
790e621
to
b0fe436
Compare
I updated the commit message, please review it |
This changes allows to use this to group multiple prefixes gci write -s standard -s default -s 'Prefix(alt.code.company.com,code.company.com)' --custom-order --skip-generated In order to provide this, a change was needed in gci --section parameter parsing The code was using pflag.StringSliceP for parsing sections. Please consider the pflag documentation: > Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. > For example: --ss="v1,v2" --ss="v3" While the usage of StringSliceP was legitimate with -local legacy parameter, if we consider gci documentation: > -l, --local strings put imports beginning with this string after 3rd-party packages, separate imports by comma We can assume that when gci was rewritten in its "new style", it appears it was unintended to keep using pflag.StringSliceP. Switching back to StringArrayP allows us to use comma in CLI arguments, without this change the following command would have failed: gci write -s standard -s default -s 'Prefix(alt.code.company.com,code.company.com)' --custom-order --skip-generated because pflag.StringSliceP would have considered it as: gci write -s standard -s default -s 'Prefix(alt.code.company.com' -s 'code.company.com)' --custom-order --skip-generated We can assume this change will be OK. But it will break the following command: gci write -s standard,default It was working because of StringSliceP The syntax is now gci write -s standard -s default as documented Signed-off-by: ccoVeille <3875889+ccoVeille@users.noreply.github.com>
b0fe436
to
72599ab
Compare
I changed according to your feedbacks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fix #107
This PR includes the changes made in #134 by @luw2007
Should yield: