Caporal.js icon indicating copy to clipboard operation
Caporal.js copied to clipboard

#187 Change boolean option parsing

Open beci opened this issue 5 years ago • 2 comments
trafficstars

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 avatar Jul 09 '20 11:07 beci

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

mattallty avatar Jul 12 '20 07:07 mattallty

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

beci avatar Dec 04 '20 10:12 beci