Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quotes are stripped from options but not positional arguments #2416

Open
dleavitt opened this issue May 31, 2024 · 1 comment
Open

Quotes are stripped from options but not positional arguments #2416

dleavitt opened this issue May 31, 2024 · 1 comment
Labels

Comments

@dleavitt
Copy link

let r;
r = require("yargs")().command("echo [pos]").parse(`echo "a b" --opt "a b"`);
console.log(r.opt); // 'a b'
console.log(r.pos); // '"a b"'

// behavior originates here, where it makes more sense
r = require("yargs-parser")(`echo "a b" --opt "a b"`);
console.log(r); // { _: [ 'echo', '"a b"' ], opt: 'a b' }

Related to yargs/yargs-parser#180.

Specifically seems weird to me that whether an option is positional or not changes the quote stripping behavior.

Seems like there may be a bunch of history here so feel free to just close if this has already been talked to death: yargs/yargs-parser#300

@shadowspawn
Copy link
Member

There are a lot of related issues, but this issue highlights a particular inconsistency I didn't see elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants