yargs / yargs/yargs-parser

Invalid parsing of quoted arguments

Open
#344 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
519
Forks
129
Avg merge
1h 34m
Merged PRs (30d)
1

Description

Let's say I invoke a CLI with following arguments:

$ cli --docker-args "-p 5432:5432"

In Node.js trailing part of process.argv resolves to:

["--docker-args", "-p  5432:5432"]

Now when I put it to yargs-parser, result is not expected:

const yargsParser = require('yargs-parser');
console.log(yargsParser(["--docker-args", "-p  5432:5432"]));
// {
//   'docker-arg': true,
//   dockerArg: true,
//   p: ' 5432:5432'
// }

While expected result is:

{ "dockerArg": "-p  5432:5432" }

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the yargsParser invocation and comparing its handling of the quoted docker arguments with the expected object in the issue. Done means the quoted value remains a single dockerArg value, with coverage for this argument shape.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.