Skip to content

Commit a6bc772

Browse files
italojsJungMinu
authored andcommitted
bin: fixing bad dx for empty dir param
1 parent 59e2fbc commit a6bc772

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

bin/ncm-cli.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
'use strict'
44

5-
process.on('unhandledRejection', function (err) {
5+
function handleError(err){
66
console.error(err)
77
process.exit(1)
8-
})
8+
}
9+
10+
process.on('unhandledRejection', handleError)
911

1012
const parseArgs = require('minimist')
1113
const pkg = require('../package.json')
@@ -39,6 +41,11 @@ async function main () {
3941
json: 'j'
4042
}
4143
})
44+
45+
46+
if(typeof argv.dir !== 'string'){
47+
handleError('ERR_INVALID_ARG_TYPE: --dir or -d must to be a string')
48+
}
4249

4350
let [command = 'help', ...subargs] = argv._
4451
if (!Object.keys(commands).includes(command)) {

0 commit comments

Comments
 (0)