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

#187 Change boolean option parsing #188

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

Conversation

beci
Copy link

@beci beci commented Jul 9, 2020

change: modified boolean option parsing, don't parse the next value for boolean options.

Prevent the annoying prevous behavior when parsing a boolean option followed by variadic arguments parsed the first followed as value for option instead of true and parst the variadic arguments from the second element only. Like --verbose first second was parsed where the verbose value was first instead true and the followed array is only [second] instead [first, second].

In order to achieve this the shouldTakeNextAsValue function extracted from handleConcatenatedOpts and use it in handleOptWithoutValue as well. I know this is not the optimal implementation, but I prefered as little modifications as possible. Also, need to change description, because the Option synopsis desciprion is not valid anymore:

-f, --file means the option can be provided either by its short notation -f or by its long notation --file. You don't have to repeat the placeholder twice in that case.

Also fixed the rawOptions, where the inverted values was stored for negative flags.

beci added 2 commits July 9, 2020 11:35
…or boolean options.

Prevent the annoying prevous behavior when parsing a boolean option followed by variadic arguments parsed the first followed as value for option instead of true and parst the variadic arguments from the second element only. Like `--verbose first second` was parsed where the `verbose` value was `first` instead `true` and the followed array is only `[second]` instead `[first, second]`.

In order to achieve this the `shouldTakeNextAsValue` function extracted from `handleConcatenatedOpts` and use it in `handleOptWithoutValue` as well.

Resolves mattallty#187
@mattallty
Copy link
Owner

Thanks for the PR @beci ! Will take a look at it early next week.

@beci
Copy link
Author

beci commented Dec 4, 2020

Hey @mattallty , it seems github actions misconfigured somehow, as https://api.github.com/repos/mattallty/Caporal.js/check-runs not available in node 12/ubuntu-latest.

  request: {
    method: 'POST',
    url: 'https://api.github.com/repos/mattallty/Caporal.js/check-runs',
    headers: {
      accept: 'application/vnd.github.antiope-preview+json',
      'user-agent': 'octokit.js/16.43.1 Node.js/12.13.1 (Linux 5.4; x64)',
      authorization: 'token [REDACTED]',
      'content-type': 'application/json; charset=utf-8'
    },
    body: '{"head_sha":"8da978461d657a9aba40c241444dfece184eab10","name":"jest-github-action","status":"completed","conclusion":"success","output":{"title":"Jest tests passed","summary":"228 tests passing in 24 suites.","annotations":[]}}',
    request: { hook: [Function: bound bound register], validate: [Object] }
  },
  documentation_url: 'https://docs.github.com/rest/reference/checks#create-a-check-run'
}
Check payload: {"owner":"mattallty","repo":"Caporal.js","head_sha":"8da978461d657a9aba40c241444dfece184eab10","name":"jest-github-action","status":"completed","conclusion":"success","output":{"title":"Jest tests passed","summary":"228 tests passing in 24 suites.","annotations":[]}}
Error: Resource not accessible by integration

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

2 participants