Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug --collaborate and file restructuring, also added an options manager #8

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bun.lockb
Binary file not shown.
22 changes: 11 additions & 11 deletions src/config/options.ts
Original file line number Diff line number Diff line change
@@ -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)
}
13 changes: 13 additions & 0 deletions src/controllers/handlers-options.ts
Original file line number Diff line number Diff line change
@@ -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)
}
3 changes: 0 additions & 3 deletions src/controllers/husky-config.ts

This file was deleted.

11 changes: 1 addition & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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()