fix: execution of shell commands that have -h/--help option

This commit is contained in:
Zoltan Kochan committed 2021-05-28 02:49:00 +03:00
1 parent 9a23fbc712
commit 22f8410393
3 files changed
+24 -10

No files matched your search

+9 -10
View File
@@ -48,16 +48,6 @@ export default async function parseCliArgs (
inputArgv,
0
)
if (noptExploratoryResults['help']) {
return {
argv: noptExploratoryResults.argv,
cmd: 'help',
options: {},
params: noptExploratoryResults.argv.remain,
unknownOptions: new Map(),
fallbackCommandUsed: false,
}
}
const recursiveCommandUsed = RECURSIVE_CMDS.has(noptExploratoryResults.argv.remain[0])
let commandName = getCommandName(noptExploratoryResults.argv.remain)
@@ -67,6 +57,15 @@ export default async function parseCliArgs (
cmd = opts.fallbackCommand!
commandName = opts.fallbackCommand!
inputArgv.unshift(opts.fallbackCommand!)
} else if (noptExploratoryResults['help']) {
return {
argv: noptExploratoryResults.argv,
cmd: 'help',
options: {},
params: noptExploratoryResults.argv.remain,
unknownOptions: new Map(),
fallbackCommandUsed: false,
}
}
const types = {
...opts.universalOptionsTypes,