Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

allow extractOptions to work with -option #5443

Merged
merged 1 commit into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/lib/command-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/core/lib/utils/utils.js
Original file line number Diff line number Diff line change
@@ -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`
Expand Down