Skip to content

Commit

Permalink
Minor refactors.
Browse files Browse the repository at this point in the history
  • Loading branch information
garg3133 committed Aug 14, 2024
1 parent 4f5ca40 commit fd7df21
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/commands/android/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Options} from './interfaces';
import {AndroidSubcommand} from './subcommands';
import {getSubcommandHelp} from './utils/common';

export function runAndroidCommand(args: string[], options: Options): void {
export function handleAndroidCommand(args: string[], options: Options): void {
if (args.length === 1) {
const androidSetup = new AndroidSetup(options);
androidSetup.run();
Expand All @@ -15,9 +15,9 @@ export function runAndroidCommand(args: string[], options: Options): void {
androidSubcommand.run();
} else {
// android command doesn't accept more than one argument.
console.log(`${colors.red(`Too many arguments passed for android command: ${args.slice(1).join(', ')}`)}\n`);
const help = getSubcommandHelp();
console.log(help);
console.log(`${colors.red(`Too many arguments passed for 'android' command: ${args.slice(1).join(', ')}`)}\n`);

console.log(getSubcommandHelp());
}
}

8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import minimist from 'minimist';
import {AndroidSetup} from './commands/android/androidSetup';
import {AVAILABLE_COMMANDS} from './constants';
import {IosSetup} from './commands/ios';
import {runAndroidCommand} from './commands/android';
import {handleAndroidCommand} from './commands/android';

export const run = () => {
try {
Expand All @@ -26,12 +26,12 @@ export const run = () => {
}
showHelp();
} else if (args[0] === 'android') {
runAndroidCommand(args, options);
handleAndroidCommand(args, options);
} else if (args[0] === 'ios') {
if (args.length > 1) {
// ios command does not accept subcommands.
console.log(`${colors.red(`Too many arguments passed for ios command: ${args.slice(1).join(', ')}`)}\n`);
console.log(`Run ${colors.cyan('npx @nightwatch/mobile-helper ios --help')} to know more about the ios command.`);
console.log(`${colors.red(`Too many arguments passed for 'ios' command: ${args.slice(1).join(', ')}`)}\n`);
console.log(`Run: ${colors.cyan('npx @nightwatch/mobile-helper ios --help')} to get help for 'ios' command.`);
} else {
const iOSSetup = new IosSetup(options);
iOSSetup.run();
Expand Down

0 comments on commit fd7df21

Please sign in to comment.