Skip to content

Commit b553719

Browse files
committed
feature: opts.unknown
1 parent 815cc91 commit b553719

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎lib/index.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ module.exports = function(args, opts) {
8484
const out = { _: [] };
8585

8686
while (args[idx] !== void 0) {
87-
const val = args[idx];
8887
let incr = 1;
88+
const val = args[idx];
8989

9090
if (val === '--') {
9191
out._ = out._.concat(args.slice(idx + 1));
@@ -103,6 +103,10 @@ module.exports = function(args, opts) {
103103
len = flag.length;
104104
const key = isGroup ? flag[len - 1] : flag;
105105

106+
if (opts.unknown !== void 0 && aliases[key] === void 0) {
107+
return opts.unknown(segs[0]);
108+
}
109+
106110
if (segs.length > 1) {
107111
tmp = segs[1];
108112
} else {

0 commit comments

Comments
 (0)