Skip to content

Commit 352cbfe

Browse files
committed
chore: add git-hooks with gitlint
1 parent b96a974 commit 352cbfe

File tree

4 files changed

+45
-111
lines changed

4 files changed

+45
-111
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
4141

4242
- name: Attach Binaries
43-
uses: softprops/action-gh-release@v2
43+
uses: stacksjs/action-[email protected]
4444
with:
4545
files: |
4646
bin/bunfig-linux-x64.zip

bin/cli.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
import process from 'node:process'
12
import { CAC } from 'cac'
23
import { version } from '../package.json'
3-
import { defaultConfigDir, defaultGeneratedDir, generateConfigTypes } from '../src/config'
4+
import { config, defaultConfigDir, defaultGeneratedDir, generateConfigTypes } from '../src/config'
45

56
const cli = new CAC('bunfig')
67

78
// Define CLI options interface to match our core types
89
interface CLIOptions {
910
configDir?: string
1011
generatedDir?: string
12+
verbose?: boolean
1113
}
1214

1315
cli
@@ -17,16 +19,30 @@ cli
1719
.option('--verbose', 'Enable verbose logging')
1820
.example('bunfig generate --config-dir ./config --generated-dir ./src/generated')
1921
.action(async (options?: CLIOptions) => {
20-
console.log('Generating config types...')
2122
generateConfigTypes({
2223
configDir: options?.configDir || defaultConfigDir,
2324
generatedDir: options?.generatedDir || defaultGeneratedDir,
2425
})
2526
})
2627

27-
cli.command('', 'Show the version of the Bunfig CLI').action(() => {
28-
console.log(version)
29-
})
28+
cli
29+
.command('show <name>', 'Show the loaded configuration for the specified name')
30+
.option('--verbose', 'Enable verbose logging')
31+
.example('bunfig show my-app')
32+
.action(async (name: string, options?: { verbose?: boolean }) => {
33+
try {
34+
const loadedConfig = await config({
35+
name,
36+
defaultConfig: {},
37+
verbose: options?.verbose,
38+
})
39+
console.log(JSON.stringify(loadedConfig, null, 2))
40+
}
41+
catch (error) {
42+
console.error('Failed to load configuration:', error)
43+
process.exit(1)
44+
}
45+
})
3046

3147
cli.command('version', 'Show the version of the Bunfig CLI').action(() => {
3248
console.log(version)

0 commit comments

Comments
 (0)