We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 59e2fbc commit a6bc772Copy full SHA for a6bc772
1 file changed
bin/ncm-cli.js
@@ -2,10 +2,12 @@
2
3
'use strict'
4
5
-process.on('unhandledRejection', function (err) {
+function handleError(err){
6
console.error(err)
7
process.exit(1)
8
-})
+}
9
+
10
+process.on('unhandledRejection', handleError)
11
12
const parseArgs = require('minimist')
13
const pkg = require('../package.json')
@@ -39,6 +41,11 @@ async function main () {
39
41
json: 'j'
40
42
}
43
})
44
45
46
+ if(typeof argv.dir !== 'string'){
47
+ handleError('ERR_INVALID_ARG_TYPE: --dir or -d must to be a string')
48
+ }
49
50
let [command = 'help', ...subargs] = argv._
51
if (!Object.keys(commands).includes(command)) {
0 commit comments