-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Prototype v2 #197
base: master
Are you sure you want to change the base?
Prototype v2 #197
Conversation
…ProcessOptions, ProcessPositions, ProcessDefaults
…are just using "parse"
…ument has been seen before
// | ||
// ./example --iter=1 --debug // debug is a boolean flag so its value is set to true | ||
// ./example -iter 1 // debug defaults to its zero value (false) | ||
// ./example --debug=true // iter defaults to its zero value (zero) |
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.
You've got the comments after the example swapped around. Also --iter
on the line above?
Codecov ReportBase: 100.00% // Head: 100.00% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## master #197 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 5 5
Lines 688 690 +2
=========================================
+ Hits 688 690 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
go.work
Outdated
@@ -0,0 +1,2 @@ | |||
use . | |||
use ./v2 |
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.
go.work
is meant to locally modify your workspace. It shouldn't be committed and shouldn't be part of a release. It's generally recommended to add it to .gitignore
.
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.
Thank you!
Hope you make #146 as soon as possible. |
Last commit was 8 months ago, and it is now 19 commits ahead, 20 commits behind master. IE, I see delaying would be more harmful than helpful. Maybe we can have |
I took a look, and one design question baffled me: We have cli values, env values, default values, and config-file values. I would expect that the precedence order be: default value IOW, default is what's used when nothing else is given. I am probably just naive here, but I can't think of a scenario when this is not the desired precedence order. As a result, I believe that allowing the user to set this order makes our API more complicated. Just my personal opinion, but I am happy to hear alternate viewpoints. |
Agree 🤦♂️, totally agree with your opinion @purpleidea 👍 |
I'm also on the waitlist for the multiple "providers". |
This PR will introduce a v2 of go-arg, to be imported with
It should be backwards with v1 for about 95% of users. If you only used arg.MustParse then you can use v2 without modifications to your code. The main changes are:
Parser.ProcessCommandLine
,Parser.ProcessEnvironment
,Parser.ProcessDefaults
so that you can control the order in which things are loadedParser.OverwriteWithCommandLine
,Parser.OverwriteWithEnvironment
,Parser.OverwriteWithDefaults
for further control over which arguments get overwritten when by which other argumentsConfig
struct in favor of a list of ParserOptions toNewParser
Features still to be implemented on this branch:
For users and contributors to go-arg: please leave your feedback and suggestions on this PR.