Skip to content

Commit 8da7706

Browse files
committed
fix(command-line-args): handle UNKNOWN_OPTION error
1 parent d972c56 commit 8da7706

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

bin/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ const optionList = [
1515
{ name: 'url', alias: 'u', type: String, description: 'Proxy server redirect url.', defaultValue: config.url },
1616
]
1717

18-
const options = commandLineArgs(optionList)
18+
var options = {}
19+
20+
try {
21+
options = commandLineArgs(optionList)
22+
} catch (e) {
23+
// Assume e is UNKNOWN_OPTION error
24+
options.help = true
25+
}
1926

2027
if (options.help) {
2128
console.log(commandLineUsage([

0 commit comments

Comments
 (0)