diff --git a/packages/core/lib/command-utils.js b/packages/core/lib/command-utils.js index b3f034a97b7..efbfde47f23 100644 --- a/packages/core/lib/command-utils.js +++ b/packages/core/lib/command-utils.js @@ -106,7 +106,7 @@ const prepareOptions = ({ command, inputStrings, options }) => { } }); - // method `extractFlags(args)` : Extracts the `--option` flags from arguments + // method `extractFlags(args)` : Extracts the `--option` & `-option` flags from arguments const inputOptions = extractFlags(inputStrings); // adding allowed global options as enumerated in each command diff --git a/packages/core/lib/utils/utils.js b/packages/core/lib/utils/utils.js index 73300bfb484..a283240c345 100644 --- a/packages/core/lib/utils/utils.js +++ b/packages/core/lib/utils/utils.js @@ -1,8 +1,8 @@ -// Extracts the input flags --option from the arguments of type `--option=value` or `--option value` or `--flag` +// Extracts the input flags --option & -option from the arguments of type `--option=value` or `--option value` or `--flag` or -flag const extractFlags = inputArguments => { // Get all the args that begins with `--`. This also includes `--option=value` const inputFlags = inputArguments.filter(flag => { - return flag.startsWith("--") ? flag : null; + return flag.startsWith("--") || flag.startsWith("-") ? flag : null; }); // Extract only the flags i.e `--option` from `--option=value`