Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

scop
Copy link
Contributor

@scop scop commented Aug 21, 2023

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Aug 21, 2023

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.

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, "") {
Copy link
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
Contributor 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
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
Contributor Author

Choose a reason for hiding this comment

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

Done in b9a55db

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.

None yet

3 participants