Skip to content

Commit

Permalink
fix: yargs 17.3.0 change in how quotes are handled
Browse files Browse the repository at this point in the history
  • Loading branch information
rofe committed Dec 8, 2021
1 parent 80fbeca commit af71354
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/newrelic/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ class CLI {
auth, name, url, email, group_policy, group_targets,
incubator, script, type, locations, frequency,
}) => {
// since 17.3.0, yargs is preserving inner quotes so we need to strip
// them again from argument values where they were added
// see https://github.com/yargs/yargs-parser/pull/407
const stripQuotes = (value) => {
const match = /^"(.*)"$/.exec(value);
return match ? match[1] : value;
};
/* eslint-disable no-param-reassign */
name = name.map(stripQuotes);
group_policy = stripQuotes(group_policy);
script = stripQuotes(script);
/* eslint-enable no-param-reassign */

// number of names, urls and emails must match
if (name.length !== url.length) {
console.error('The number of provides names and urls must match.');
Expand Down

0 comments on commit af71354

Please sign in to comment.