mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-23 11:29:54 +00:00
fix(cli): report an empty catalog --type= as a usage error (#8130)
`catalog --type=` passed an empty string, which the truthiness check read as no filter: it listed every item and exited 0. Any given value other than block or component is now a usage error (exit 2), as #7669 made it for other bad values. Follow-up to #7678 review. Claude-Session: https://claude.ai/code/session_01M3Xbw44WYGyVqg4AjkzFxj Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -235,6 +235,7 @@ describe("agent-mode contract", () => {
|
||||
["compare a.html b.html --timeout -1", "--timeout must be a positive integer"],
|
||||
["grade-compare --for frame.png", "Exactly one of --grades or --luts"],
|
||||
["catalog --type widget", 'Invalid --type: "widget". Use "block" or "component".'],
|
||||
["catalog --type=", 'Invalid --type: "". Use "block" or "component".'],
|
||||
["check --range 5,1", "Invalid --range"],
|
||||
["check --samples ten", "Invalid --samples"],
|
||||
["check --tolerance=-1", "Invalid --tolerance"],
|
||||
|
||||
@@ -225,7 +225,8 @@ export default defineCommand({
|
||||
let typeFilter: ItemType | undefined;
|
||||
if (args.type === "block") typeFilter = "hyperframes:block";
|
||||
else if (args.type === "component") typeFilter = "hyperframes:component";
|
||||
else if (args.type) {
|
||||
// An empty `--type=` is a typo too, not a request for no filter.
|
||||
else if (args.type !== undefined) {
|
||||
throw new CliUsageError(`Invalid --type: "${args.type}". Use "block" or "component".`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user