Skip to content

Commit

Permalink
format flag suggestion message
Browse files Browse the repository at this point in the history
Signed-off-by: Samson Olawoyin <olawoyin.samson@outlook.com>
  • Loading branch information
samson-olawoyin committed Mar 7, 2024
1 parent 081bb2c commit 14c489a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ export const run = async () => {
native: 'app'
}
});

//Check the passed flags when installing Nightwatch and then suggest when undefined flag is been found.
if (argv[0] !== undefined) {
if ((argv[0] !== '--mobile') && (String(argv[0]) !== '--generate-config')) {
const nightwatchFlags = ['--mobile', '--generate-config'];
const checkFlags = didYouMean(argv[0], nightwatchFlags);

Logger.error(colors.red(`Did you mean flag ${checkFlags['winner']}`));
const msg = colors.red(`Flag ${argv[0]} is not a valid flag, did you mean`) + colors.green(` flag ${checkFlags['winner']}`);
Logger.error(msg);

// terminate Nightwatch setup since flag does not have definition
process.exit(0);
Expand Down

0 comments on commit 14c489a

Please sign in to comment.