diff --git a/bun.lockb b/bun.lockb index 37e73a1..dfa9734 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 0696eea..ac10c36 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "prepublishOnly": "bun run build" }, "dependencies": { - "commander": "12.0.0" + "commander": "12.0.0", + "opener": "1.5.2" }, "devDependencies": { "@commitlint/cli": "19.3.0", @@ -21,6 +22,7 @@ "@swc/cli": "0.3.12", "@swc/core": "1.4.17", "@types/bun": "1.1.0", + "@types/opener": "1.4.3", "@typescript-eslint/eslint-plugin": "^7.0.1", "eslint": "^8.0.1", "eslint-config-love": "47.0.0", diff --git a/src/config/huskybc.ts b/src/config/cli.ts similarity index 60% rename from src/config/huskybc.ts rename to src/config/cli.ts index c906261..a0c75d9 100644 --- a/src/config/huskybc.ts +++ b/src/config/cli.ts @@ -1,11 +1,6 @@ -// Commander -import { createCommand } from 'commander' - -// Constants +import { program } from '../constants/huskybc' import { VERSION } from '../constants/version' -export const program = createCommand('HuskyBC') - export function configureCLI() { program .description('Command line for easy Husky configuration') diff --git a/src/config/options.ts b/src/config/options.ts new file mode 100644 index 0000000..5dd4777 --- /dev/null +++ b/src/config/options.ts @@ -0,0 +1,16 @@ +// Third-Party libraries +import opener from 'opener' + +// Constants +import { REPOSITORY } from '../constants/github' +import { program } from '../constants/huskybc' + +export function configureOptions() { + program.option( + '--collaborate', + 'Open GitHub repository for collaboration', + () => { + opener(REPOSITORY) + } + ) +} diff --git a/src/constants/github.ts b/src/constants/github.ts new file mode 100644 index 0000000..4eb6ecc --- /dev/null +++ b/src/constants/github.ts @@ -0,0 +1 @@ +export const REPOSITORY = 'https://github.com/RaulCatalinas/HuskyBC' diff --git a/src/constants/huskybc.ts b/src/constants/huskybc.ts new file mode 100644 index 0000000..ce6be84 --- /dev/null +++ b/src/constants/huskybc.ts @@ -0,0 +1,3 @@ +import { createCommand } from 'commander' + +export const program = createCommand('HuskyBC') diff --git a/src/index.ts b/src/index.ts index 753e7d1..d048e9e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,15 @@ -// Config -import { configureCLI, program } from './config/huskybc' +// 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