Skip to content

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

@calderas

Description

@calderas

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

Issue after: 651d447.
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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions