Skip to content

cmd/jv: flag parsing and usage fixes - #127

Closed
scop wants to merge 3 commits into
santhosh-tekuri:masterfrom
scop:fix/jv-flags
Closed

cmd/jv: flag parsing and usage fixes#127
scop wants to merge 3 commits into
santhosh-tekuri:masterfrom
scop:fix/jv-flags

Conversation

@scop

@scop scop commented Aug 21, 2023

Copy link
Copy Markdown

No description provided.

@codecov-commenter

codecov-commenter commented Aug 21, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage has no change and project coverage change: -0.01% ⚠️

Comparison is base (bbc9f89) 89.21% compared to head (b9a55db) 89.21%.
Report is 4 commits behind head on master.

❗ 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              

see 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment thread cmd/jv/main.go Outdated

var validOutput bool
for _, out := range []string{"", "flag", "basic", "detailed"} {
for _, out := range append(validOutputs, "") {

Copy link
Copy Markdown
Owner

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

Copy link
Copy Markdown
Author

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.

Copy link
Copy Markdown
Owner

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)
     }
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in b9a55db

@scop

scop commented Jun 28, 2024

Copy link
Copy Markdown
Author

Looks like this is half obsolete as of 6.0.1, reworked remainders in #177, closing here.

@scop scop closed this Jun 28, 2024
@scop
scop deleted the fix/jv-flags branch June 28, 2024 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants