nopt icon indicating copy to clipboard operation
nopt copied to clipboard

[BUG] Parsing issues for options within a string on 4.0.x+

Open calderas opened this issue 8 years ago • 0 comments

Original issue: https://github.com/ember-cli/ember-cli/issues/6970 Parsing options issues for a string with "options" node test.js foo bar --options '--split 2 --random'

Issue after: https://github.com/npm/nopt/commit/651d4473946096d341a480bbe56793de3fc706aa. https://regex101.com/r/aoa7GZ/1

Example test.js:

var nopt = require("nopt")
var knownOpts = { options: String };
var parsed = nopt( knownOpts, {}, process.argv, 0)
console.log("parsed: ", parsed);
console.log("parsed.options: ", parsed.options);

3.0.x

node test.js foo bar --options '--split 2 --random'

parsed:  { options: '--split 2 --random',
  argv: 
   { remain: [],
     cooked: [ '--options', '--split 2 --random' ],
     original: [ '--options', '--split 2 --random' ] } }

parsed.options: --split 2 --random

4.0.X:

node test.js foo bar --options '--split 2 --random'

parsed:  { options: '',
  'split 2 --random': true,
  argv: 
   { remain: [],
     cooked: [ '--options', '--split 2 --random' ],
     original: [ '--options', '--split 2 --random' ] } }

parsed.options:

calderas avatar Apr 27 '17 20:04 calderas