From c764e9b1347ca570b93ada51e9e8b88033d579d5 Mon Sep 17 00:00:00 2001 From: xxxAlvaDevxxx Date: Mon, 29 Apr 2024 00:32:54 -0400 Subject: [PATCH] fix: option '--collaborate' | feat: creating handler-options.ts --- bun.lockb | Bin 185866 -> 185866 bytes src/config/options.ts | 22 +++++++++++----------- src/controllers/handlers-options.ts | 13 +++++++++++++ src/controllers/husky-config.ts | 3 --- src/index.ts | 11 +---------- 5 files changed, 25 insertions(+), 24 deletions(-) create mode 100644 src/controllers/handlers-options.ts delete mode 100644 src/controllers/husky-config.ts diff --git a/bun.lockb b/bun.lockb index dfa9734f99000d76f0933d0f33c1a1dad4df035a..059c2971e4dc374ec92541bb78f8ebde299f2bb6 100644 GIT binary patch delta 24 gcmeBL!`-!pyI~9C?T>7XhI%G?#@io$WYl~D0DPVb761SM delta 24 dcmeBL!`-!pyI~9C?T>6s3?Q)m;YUWzCjfLB2_pai diff --git a/src/config/options.ts b/src/config/options.ts index 5dd4777..7e93331 100644 --- a/src/config/options.ts +++ b/src/config/options.ts @@ -1,16 +1,16 @@ -// Third-Party libraries -import opener from 'opener' - // Constants -import { REPOSITORY } from '../constants/github' import { program } from '../constants/huskybc' +import { + handlerOptionBuild, + handlerOptionCollaborate +} from '../controllers/handlers-options' export function configureOptions() { - program.option( - '--collaborate', - 'Open GitHub repository for collaboration', - () => { - opener(REPOSITORY) - } - ) + program + .option( + '--collaborate', + 'Open GitHub repository for collaboration', + handlerOptionCollaborate + ) + .option('--build', "Start Husky's configuration", handlerOptionBuild) } diff --git a/src/controllers/handlers-options.ts b/src/controllers/handlers-options.ts new file mode 100644 index 0000000..5f20617 --- /dev/null +++ b/src/controllers/handlers-options.ts @@ -0,0 +1,13 @@ +import opener from 'opener' +import { REPOSITORY } from '../constants/github' + +export const handlerOptionBuild = () => { + console.log("Generating Husky's configuration") + // code... +} + +export const handlerOptionCollaborate = async () => { + console.log('Open GitHub repository for collaboration...') + await Bun.sleep(500) + opener(REPOSITORY) +} diff --git a/src/controllers/husky-config.ts b/src/controllers/husky-config.ts deleted file mode 100644 index 609cead..0000000 --- a/src/controllers/husky-config.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function huskyConfigController() { - console.log("Generating Husky's configuration") -} diff --git a/src/index.ts b/src/index.ts index d048e9e..2002030 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,20 +1,11 @@ -// Config' +// Config import { configureCLI } from './config/cli' import { configureOptions } from './config/options' -// Controllers -import { huskyConfigController } from './controllers/husky-config' - // Constants import { program } from './constants/huskybc' configureCLI() configureOptions() -const thereIsFirstArgument = program.args[0] !== undefined - -if (!thereIsFirstArgument) { - program.action(huskyConfigController) -} - program.parse()