Skip to content

Commit

Permalink
refactor: refactoring after review
Browse files Browse the repository at this point in the history
  • Loading branch information
PKulkoRaccoonGang committed Dec 13, 2023
1 parent 993d469 commit acca5ac
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions bin/paragon-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ const helpCommand = require('../lib/help');
const versionCommand = require('../lib/version');

const HELP_COMMAND = 'help';
const VERSION_COMMANDS = ['-v', '--version'];
const commandAliases = {
'-v': 'version',
'--version': 'version',
};

const COMMANDS = {
/**
Expand Down Expand Up @@ -57,12 +60,8 @@ const COMMANDS = {

(async () => {
const [command] = process.argv.slice(2);
const executor = COMMANDS[command];

if (VERSION_COMMANDS.includes(command)) {
versionCommand();
return;
}
const resolvedCommand = commandAliases[command] || command;
const executor = COMMANDS[resolvedCommand];

if (!executor) {
// eslint-disable-next-line no-console
Expand Down

0 comments on commit acca5ac

Please sign in to comment.