Add contextual subcommand help to avoid context pollution

This commit is contained in:
gitea committed 2026-09-11 11:02:17 +08:00
1 parent 9d6d11628e
commit 9a7be16d3b
4 files changed
+1213 -125

No files matched your search

+5 -3
View File
@@ -42,6 +42,7 @@ import {
parseArgs,
stringOption
} from "./parser.js";
import { extractHelpRequest } from "./help.js";
import {
formatConsoleOutput,
joinOutput,
@@ -180,12 +181,13 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
return;
}
if (!area || area === "help" || args.options.help) {
printHelp();
const helpRequest = extractHelpRequest(args);
if (helpRequest.isHelp) {
printHelp(helpRequest.target);
return;
}
if (!KNOWN_AREAS.has(area)) {
if (!area || !KNOWN_AREAS.has(area)) {
throw new Error(`Unknown command: ${args.command.join(" ")}. Run 'seal-use help' for available commands.`);
}