-
Notifications
You must be signed in to change notification settings - Fork 61
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 {Type}LongVar and {Type}ShortVar helpers #134
base: main
Are you sure you want to change the base?
add {Type}LongVar and {Type}ShortVar helpers #134
Conversation
I tend to use just long flag names for all my applications, so moving out from fs.StringVar(&cfg.GRPCAddr, 0, "grpc-addr", "localhost:8000", "gRPC address")
fs.StringVar(&cfg.HTTPAddr, 0, "http-addr", "localhost:8001", "HTTP address")
// And so on... As I suppose you didn't add this before to avoid this implementation for every type, but in my case at least, string is like the 90% of the the flags. If you feel that we should add support for all types, I can do that as well. Just wanted to start small and simple. Thanks for the wonderful library btw @peterbourgon |
So I'm not totally convinced that the benefit from expanding the API surface area to include these new methods outweighs the cost of adding these zero-value params, but I guess it could make sense in a holistic way. Can you add the same variants to the other type-specific XxxVar methods on FlagSet? |
To be honest, I felt the same way, but as the concession is already made on the flagSet types without var ( Another option could be to remove all the I added the rest of the types along with two new tests. Thanks a lot for the quick review and let me know if I can help in another way. |
ddf2389
to
809ebbd
Compare
Add helper functions to avoid repeating the `0` and/or `""` in the case of `Var` flagset method calls.
809ebbd
to
f039960
Compare
No hurries, obviously, but if there is there anything else I can improve on my end, just tell me @peterbourgon . Thanks! |
Add helper functions to avoid repeating the
0
and/or""
in the case ofVar
flagset method calls.