Skip to content

Commit 6e34db6

Browse files
authored
fix(command): get apply ghqrc config (#19)
1 parent 187daab commit 6e34db6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/commands/get.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
import { clone } from '../git'
22
import { parseCliOptionsToGitArgs } from '../args'
33
import { PluginApi } from '../types'
4+
import { readConfig } from '../config'
45

56
export const get: PluginApi = {
67
extend(api) {
78
api.cli
89
.command('get [repo]', 'Clone/sync with a remote repository')
910
.alias('clone')
10-
.option('--shallow', 'Shallow clone, alias to `--depth 1`')
11+
.option('--shallow', 'Shallow clone, alias to `--depth 1`', {
12+
default: false,
13+
type: [Boolean],
14+
})
1115
.example('ghq get 2nthony/ghq')
1216
.example('ghq get github.com/2nthony/ghq')
1317
.example('ghq get https://github.com/2nthony/ghq')
1418
.example('ghq clone 2nthony/ghq')
1519
.allowUnknownOptions()
16-
.action((repo, options) => {
20+
.action(async (repo, options) => {
1721
if (!repo) {
1822
api.cli.outputHelp()
1923
return
2024
}
2125

22-
const args = parseCliOptionsToGitArgs(options)
26+
const config = await readConfig()
27+
const args = parseCliOptionsToGitArgs({ ...config, ...options })
2328

2429
clone(repo, ...args)
2530
})

0 commit comments

Comments
 (0)