diff --git a/packages/compiler/bin/tempblot.ts b/packages/compiler/bin/tempblot.ts index a8fdd43..5be947c 100755 --- a/packages/compiler/bin/tempblot.ts +++ b/packages/compiler/bin/tempblot.ts @@ -17,6 +17,13 @@ const args = parse(argv, { string: ["url"], }); +const [command] = args._; + +if (command !== getCmd.value) { + console.error(`Usage: tempblot ${getCmd.value} [--url ]`); + process.exit(1); +} + const url = args.url || ((await text({ diff --git a/packages/compiler/tests/bin.spec.ts b/packages/compiler/tests/bin.spec.ts index dc61496..9a48200 100644 --- a/packages/compiler/tests/bin.spec.ts +++ b/packages/compiler/tests/bin.spec.ts @@ -63,7 +63,15 @@ test("the packed binary runs outside the project", async () => { mkdirSync(dirname(installedBinary), { recursive: true }); symlinkSync(binaryPath, installedBinary); - const cli = await render(installedBinary, [], { + const invalidCommandCli = await render(installedBinary, ["compile"], { + cwd: join(temporaryRoot, "consumer"), + }); + + expect( + await invalidCommandCli.findByError("Usage: tempblot get"), + ).toHaveErrorMessage("Usage: tempblot get [--url ]"); + + const cli = await render(installedBinary, ["get"], { cwd: join(temporaryRoot, "consumer"), });