You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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
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.tsand
if (typeof val === 'string' && val.match(/^___(.|\n)*___$/)) val = val.slice(3, -3)
from plugins.tsCode of Conduct
The text was updated successfully, but these errors were encountered: