Skip to content

Commit 74b1e86

Browse files
authored
fix(yargs): specify types for every CLI option (#878)
Fixes #876
1 parent dae22df commit 74b1e86

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/helpers/cli.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ const args: ICLIArgument[] = [
1010
{
1111
alias: 'B',
1212
name: 'branch',
13+
type: 'string',
1314
description: 'Specify the branch manually',
1415
},
1516
{
1617
alias: 'b',
1718
name: 'build',
19+
type: 'number',
1820
description: 'Specify the build number manually',
1921
},
2022
{
@@ -27,11 +29,14 @@ const args: ICLIArgument[] = [
2729
{
2830
alias: 'C',
2931
name: 'sha',
32+
type: 'string',
3033
description: 'Specify the commit SHA manually',
3134
},
3235
{
3336
alias: 'CL',
3437
name: 'changelog',
38+
type: 'boolean',
39+
default: false,
3540
description: 'Display a link for the current changelog'
3641
},
3742
{
@@ -49,11 +54,13 @@ const args: ICLIArgument[] = [
4954
{
5055
alias: 'f',
5156
name: 'file',
57+
type: 'string',
5258
description: 'Target file(s) to upload',
5359
},
5460
{
5561
alias: 'F',
5662
name: 'flags',
63+
type: 'string',
5764
default: '',
5865
description: 'Flag the upload to group coverage metrics',
5966
},
@@ -103,17 +110,20 @@ const args: ICLIArgument[] = [
103110
{
104111
alias: 'n',
105112
name: 'name',
113+
type: 'string',
106114
default: '',
107115
description: 'Custom defined name of the upload. Visible in Codecov UI',
108116
},
109117
{
110118
alias: 'N',
111119
name: 'parent',
120+
type: 'string',
112121
description: "The commit SHA of the parent for which you are uploading coverage. If not present, the parent will be determined using the API of your repository provider. When using the repository provider's API, the parent is determined via finding the closest ancestor to the commit.",
113122
},
114123
{
115124
alias: 'P',
116125
name: 'pr',
126+
type: 'number',
117127
description: 'Specify the pull request number manually',
118128
},
119129
{
@@ -139,17 +149,20 @@ const args: ICLIArgument[] = [
139149
{
140150
alias: 's',
141151
name: 'dir',
152+
type: 'string',
142153
description: 'Directory to search for coverage reports.\nAlready searches project root and current working directory',
143154
},
144155
{
145156
alias: 'T',
146157
name: 'tag',
158+
type: 'string',
147159
default: '',
148160
description: 'Specify the git tag',
149161
},
150162
{
151163
alias: 't',
152164
name: 'token',
165+
type: 'string',
153166
default: '',
154167
description: 'Codecov upload token',
155168
},

test/helpers/cli.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe('CLI Helper', () => {
1212
alias: 'b',
1313
description: 'Specify the build number manually',
1414
name: 'build',
15+
type: 'number',
1516
})
1617
})
1718
})

0 commit comments

Comments
 (0)