-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add helper method to check for CLI commands
- Loading branch information
1 parent
98b69b7
commit be3dcf2
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Helper function to determine if an option was passed via CLI | ||
export function wasOptionPassed(option: string) { | ||
// Regular expression to match the exact option with any value | ||
const regex = new RegExp(`--${option}(?:=[^\\s]*)?$`) | ||
|
||
// eslint-disable-next-line node/prefer-global/process | ||
return process.argv.some(arg => regex.test(arg)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters