Skip to content

Parsing Issue #138

Closed
Closed

Description

@leondexelle

The parser seems to remove quotes before passing in any specific options.
My use case is creating a sort of evaluation command which parses in certain options from the user like so:
User: someExampleFunction('hello')
But, I get this:
Error: ReferenceError: hello is not defined

The actual parsed string is someExampleFunction(hello).
Is there any way to get around this and stop it removing quotes before I add something like --some-option "testing" (Where I would want it to set some-option to "testing")?

Activity

  1. bcoe commented on Dec 25, 2018

    @bcoe
    Member

    @leondexelle I apologize that it's taken me so long to sift through old issues; could you try the latest version of yargs-parser and let me know if this is still happening to you? we've made a few fixes around tokenization in recent months.

  2. leondexelle commented on Dec 25, 2018

    @leondexelle
    Author

    I tried this again with v11.1.1 and I'm getting the exact same output

    require('yargs-parser')('someFunction("hello")')

    returns:

    { _: [ 'someFunction(hello)' ] }

    and I want it to be

    { _: [ 'someFunction("hello")' ] }
  3. pinned this issue on Jan 28, 2019
  4. bcoe commented on Jan 29, 2019

    @bcoe
    Member

    @leondexelle this should now be addressed in + [email protected], please take it for a spin 👍

    > require('yargs-parser')('someFunction("hello")')
    { _: [ 'someFunction("hello")' ] }

    let me know if you continue to bump into any issues.

  5. unpinned this issue on Jan 29, 2019
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions