Skip to content

ember-cli 2.12 argument parsing #6970

Closed

Description

@christiancueto

Original Issue: ember-cli/ember-exam#84

Something has changed in the way that ember-cli parses arguments, I just wanted to add this here for visibility.

DEBUG=ember-cli:* ember exam:iterate 2 --options "--reporter teamcity --random"

Output on 2.11.1

Wed, 19 Apr 2017 19:06:57 GMT ember-cli:cli command: exam:iterate
Wed, 19 Apr 2017 19:06:57 GMT ember-cli:testing cli: command.validateAndRun
Building app for test iterations.
cleaning up...

Output on 2.12.0-beta.1

Wed, 19 Apr 2017 19:11:12 GMT ember-cli:command [lookup-command#3] initialize: name: exam:iterate, name: %s
Wed, 19 Apr 2017 19:11:12 GMT ember-cli:platform-checker: [platform-checker#253] { version: 'v7.9.0', isValid: true, isTested: true, isDeprecated: false }
Wed, 19 Apr 2017 19:11:12 GMT ember-cli:cli command: exam:iterate
Wed, 19 Apr 2017 19:11:12 GMT ember-cli:testing cli: command.beforeRun
Wed, 19 Apr 2017 19:11:12 GMT ember-cli:testing cli: command.validateAndRun
The option '--reporter teamcity --random' is not registered with the exam:iterate command. Run `ember exam:iterate --help` for a list of supported options.

Building app for test iterations.

Activity

  1. calderas commented on Apr 27, 2017

    @calderas
    Contributor

    This issue is related to updating nopt from version 3.x to 4.x on 2.12.0-beta.1+
    ff0b96e

    https://github.com/ember-cli/ember-cli/blob/master/lib/models/command.js#L570

    parsedOptions = nopt(knownOpts, this.optionsAliases, commandArgs, 0);

    Example:

    var nopt = require("nopt")
    var args = [ '1', '--options', '--split 2 --random' ]
    var knownOpts = { options: String, path: String}
    var opts = nopt( knownOpts, {}, args, 0)

    Logging options with nopt version 3.x, options work fine.

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

    Logging options with nopt version 4.x, options are empty.

     { options: '',
      'split 2 --random': true,
      argv:
       { remain: [ '1' ],
         cooked: [ '1', '--options', '--split 2 --random' ],
         original: [ '1', '--options', '--split 2 --random' ] } }
    
  2. stefanpenner commented on Apr 27, 2017

    @stefanpenner
    Contributor

    Interesting, sounds like this might be an upstream nopt bug, Got time to see if thats the case?

  3. calderas commented on Apr 27, 2017

    @calderas
    Contributor

    Looks like it. Does it make sense to revert to the previous version of nopt in the meantime?

  4. stefanpenner commented on Apr 27, 2017

    @stefanpenner
    Contributor

    Looks like it. Does it make sense to revert to the previous version of nopt in the meantime?

    yup

  5. stefanpenner commented on Apr 27, 2017

    @stefanpenner
    Contributor

    @calderas mind submitting a PR? + quick unit test so we get a test failure if someone tries to upgrade before this is fixed upstream.

  6. added a commit that references this issue on Apr 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions