-
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
cmd/jv: flag parsing and usage fixes #127
Conversation
Per general convention, and to follow what `flag` errors give.
Codecov ReportPatch coverage has no change and project coverage change:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## master #127 +/- ##
==========================================
- Coverage 89.21% 89.21% -0.01%
==========================================
Files 10 10
Lines 2652 2651 -1
==========================================
- Hits 2366 2365 -1
Misses 237 237
Partials 49 49 ☔ View full report in Codecov by Sentry. |
cmd/jv/main.go
Outdated
} | ||
|
||
compiler.LoadURL = loadURL | ||
compiler.AssertFormat = *assertFormat | ||
compiler.AssertContent = *assertContent | ||
|
||
var validOutput bool | ||
for _, out := range []string{"", "flag", "basic", "detailed"} { | ||
for _, out := range append(validOutputs, "") { |
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.
check if out~=""
instead of append
; this makes it clear
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.
Not sure I quite got what you meant, but 8ffba32 at least simplifies it some.
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.
I meant to say add if
guard as shown below:
if *output != "" {
valid := false
for _, out := range validOutputs {
If *output == out {
valid = true
break
}
}
If !valid {
fmt.Fprintln(os.Stderr, "output must be one of", strings.Join(validOutputs, ", "))
os.Exit(2)
}
}
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.
Done in b9a55db
Looks like this is half obsolete as of 6.0.1, reworked remainders in #177, closing here. |
No description provided.