fix(cli): support version and help aliases (v, V, -V, h, -h)
This commit is contained in:
1 parent
40b3b29ca5
commit
4fbd737402
3 files changed
+65
-3
No files matched your search
+16
-2
@@ -88,11 +88,25 @@ async function dispatchCli(
|
||||
): Promise<CliResult> {
|
||||
const parsed = parseArgs(rawArgs);
|
||||
|
||||
if (booleanOption(parsed.options, ["help", "h"]) || parsed.area === "help") {
|
||||
if (
|
||||
booleanOption(parsed.options, ["help", "h"]) ||
|
||||
parsed.area === "help" ||
|
||||
parsed.area === "h" ||
|
||||
parsed.area === "-h" ||
|
||||
parsed.area === "--help"
|
||||
) {
|
||||
return { stdout: printHelp() + "\n", stderr: "", exitCode: 0 };
|
||||
}
|
||||
|
||||
if (booleanOption(parsed.options, ["version", "v"]) || parsed.area === "version") {
|
||||
if (
|
||||
booleanOption(parsed.options, ["version", "v", "V"]) ||
|
||||
parsed.area === "version" ||
|
||||
parsed.area === "v" ||
|
||||
parsed.area === "V" ||
|
||||
parsed.area === "-v" ||
|
||||
parsed.area === "-V" ||
|
||||
parsed.area === "--version"
|
||||
) {
|
||||
return { stdout: `hose-use v${VERSION}\n`, stderr: "", exitCode: 0 };
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user