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. |
|
|
||
| var validOutput bool | ||
| for _, out := range []string{"", "flag", "basic", "detailed"} { | ||
| for _, out := range append(validOutputs, "") { |
There was a problem hiding this comment.
check if out~="" instead of append; this makes it clear
There was a problem hiding this comment.
Not sure I quite got what you meant, but 8ffba32 at least simplifies it some.
There was a problem hiding this comment.
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)
}
}|
Looks like this is half obsolete as of 6.0.1, reworked remainders in #177, closing here. |
No description provided.