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

[Feature]: solve yargs issue where it drops leading and trailing double quotes in a string #625

Closed
1 task done
jchenche opened this issue Apr 26, 2022 · 1 comment
Closed
1 task done
Assignees
Labels
feature New feature or request refactor Tasks that involve refactoring existing code

Comments

@jchenche
Copy link
Contributor

jchenche commented Apr 26, 2022

Describe the feature you would like

Have yargs preserve leading and trailing double quotes inside a string. Look at issue yargs/yargs-parser#201 and solve it by forking the repository and make a pull request for it. https://github.com/yargs/yargs/blob/main/docs/tricks.md#quotes might be a good read before attempting to solve it.

e.g. '"hello"' should be '"hello"' after processing it with yargs. But currently, it yields 'hello' (double quotes gone).

Is this feature solving a problem?

It prevents yargs from throwing away leading and trailing double quotes so that we don't have to hack around the library.

Please share any additional details you have?

Currently the hack is in 2 places.

inputArgs = inputArgs.map(arg => arg.match(/^"(.|\n)*"$/) ? "___" + arg + "___" : arg) from cli.ts

and

if (typeof val === 'string' && val.match(/^___(.|\n)*___$/)) val = val.slice(3, -3) from plugins.ts

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jchenche jchenche added feature New feature or request triage Requires triage refactor Tasks that involve refactoring existing code labels Apr 26, 2022
@jchenche jchenche changed the title [Feature]: solve **yargs** issue where it drops leading and trailing double quotes in a string [Feature]: solve yargs issue where it drops leading and trailing double quotes in a string Apr 26, 2022
@jchenche jchenche changed the title [Feature]: solve yargs issue where it drops leading and trailing double quotes in a string [Feature]: solve yargs issue where it drops leading and trailing double quotes in a string Apr 26, 2022
@hu3man hu3man added this to the UX Improvements milestone May 11, 2022
@hu3man hu3man added cli-core and removed triage Requires triage labels May 11, 2022
@hu3man hu3man removed the cli-core label Aug 16, 2022
@hu3man hu3man removed this from the UX Improvements milestone Aug 20, 2022
@hu3man
Copy link
Contributor

hu3man commented Oct 19, 2022

Closing: fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request refactor Tasks that involve refactoring existing code
Projects
None yet
Development

No branches or pull requests

2 participants