Skip to content

Commit

Permalink
Merge pull request #8 from xxxAlvaDevxxx/main
Browse files Browse the repository at this point in the history
Fix bug --collaborate and file restructuring, also added an options manager
  • Loading branch information
RaulCatalinas authored Apr 29, 2024
2 parents 0b57ba2 + 40bf746 commit 7983303
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 24 deletions.
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()

0 comments on commit 7983303

Please sign in to comment.