Skip to content

Commit e362410

Browse files
committed
fix: handle dots in option validation
1 parent 8ec05e9 commit e362410

File tree

2 files changed

+5
-36
lines changed

2 files changed

+5
-36
lines changed

src/Command.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export default class Command {
117117
* @param name Option name
118118
*/
119119
hasOption(name: string) {
120+
name = name.split('.')[0]
120121
return this.options.find(option => {
121122
return option.names.includes(name)
122123
})
@@ -262,7 +263,7 @@ export default class Command {
262263
option => option.required
263264
)
264265
for (const option of requiredOptions) {
265-
const value = values[option.names[0]]
266+
const value = values[option.names[0].split('.')[0]]
266267
if (typeof value === 'boolean') {
267268
console.error(`error: option \`${option.rawName}\` argument is missing`)
268269
process.exit(1)

yarn.lock

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ debug@^4.0.0, debug@^4.0.1:
14511451
dependencies:
14521452
ms "^2.1.1"
14531453

1454-
debuglog@*, debuglog@^1.0.1:
1454+
debuglog@^1.0.1:
14551455
version "1.0.1"
14561456
resolved "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
14571457
integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
@@ -2647,7 +2647,7 @@ import-local@^1.0.0:
26472647
pkg-dir "^2.0.0"
26482648
resolve-cwd "^2.0.0"
26492649

2650-
imurmurhash@*, imurmurhash@^0.1.4:
2650+
imurmurhash@^0.1.4:
26512651
version "0.1.4"
26522652
resolved "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
26532653
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
@@ -3892,11 +3892,6 @@ lockfile@^1.0.4:
38923892
dependencies:
38933893
signal-exit "^3.0.2"
38943894

3895-
lodash._baseindexof@*:
3896-
version "3.1.0"
3897-
resolved "https://registry.npmjs.org/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
3898-
integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=
3899-
39003895
lodash._baseuniq@~4.6.0:
39013896
version "4.6.0"
39023897
resolved "https://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
@@ -3905,33 +3900,11 @@ lodash._baseuniq@~4.6.0:
39053900
lodash._createset "~4.0.0"
39063901
lodash._root "~3.0.0"
39073902

3908-
lodash._bindcallback@*:
3909-
version "3.0.1"
3910-
resolved "https://registry.npmjs.org/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
3911-
integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4=
3912-
3913-
lodash._cacheindexof@*:
3914-
version "3.0.2"
3915-
resolved "https://registry.npmjs.org/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
3916-
integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=
3917-
3918-
lodash._createcache@*:
3919-
version "3.1.2"
3920-
resolved "https://registry.npmjs.org/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
3921-
integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=
3922-
dependencies:
3923-
lodash._getnative "^3.0.0"
3924-
39253903
lodash._createset@~4.0.0:
39263904
version "4.0.3"
39273905
resolved "https://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
39283906
integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY=
39293907

3930-
lodash._getnative@*, lodash._getnative@^3.0.0:
3931-
version "3.9.1"
3932-
resolved "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
3933-
integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=
3934-
39353908
lodash._root@~3.0.0:
39363909
version "3.0.1"
39373910
resolved "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692"
@@ -3982,11 +3955,6 @@ lodash.pick@^4.4.0:
39823955
resolved "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3"
39833956
integrity sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=
39843957

3985-
lodash.restparam@*:
3986-
version "3.6.1"
3987-
resolved "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
3988-
integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=
3989-
39903958
lodash.set@^4.3.2:
39913959
version "4.3.2"
39923960
resolved "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"
@@ -5661,7 +5629,7 @@ readable-stream@~1.1.10:
56615629
isarray "0.0.1"
56625630
string_decoder "~0.10.x"
56635631

5664-
readdir-scoped-modules@*, readdir-scoped-modules@^1.0.0:
5632+
readdir-scoped-modules@^1.0.0:
56655633
version "1.0.2"
56665634
resolved "https://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747"
56675635
integrity sha1-n6+jfShr5dksuuve4DDcm19AZ0c=

0 commit comments

Comments
 (0)