diff --git a/src/cli/directory-cli.test.ts b/src/cli/directory-cli.test.ts index cd7f4069265a..d7de9abc7909 100644 --- a/src/cli/directory-cli.test.ts +++ b/src/cli/directory-cli.test.ts @@ -317,5 +317,7 @@ describe("registerDirectoryCli", () => { await expect(program.parseAsync(args, { from: "user" })).rejects.toThrow("exit:1"); expect(runtimeErrors().join("\n")).toContain("--limit must be a positive integer."); + expect(mocks.resolveInstallableChannelPlugin).not.toHaveBeenCalled(); + expect(mocks.replaceConfigFile).not.toHaveBeenCalled(); }); }); diff --git a/src/cli/directory-cli.ts b/src/cli/directory-cli.ts index 1ccb0ac7aba9..650190e64d21 100644 --- a/src/cli/directory-cli.ts +++ b/src/cli/directory-cli.ts @@ -155,6 +155,7 @@ export function registerDirectoryCli(program: Command) { title: string; emptyMessage: string; }) => { + const limit = parseLimit(params.opts.limit); const { cfg, channelId, accountId, plugin } = await resolve({ channel: params.opts.channel as string | undefined, account: params.opts.account as string | undefined, @@ -170,7 +171,7 @@ export function registerDirectoryCli(program: Command) { cfg, accountId, query: (params.opts.query as string | undefined) ?? null, - limit: parseLimit(params.opts.limit), + limit, runtime: defaultRuntime, }); if (params.opts.json) { @@ -266,6 +267,7 @@ export function registerDirectoryCli(program: Command) { .option("--limit ", "Limit results") .action(async (opts) => { try { + const limit = parseLimit(opts.limit); const { cfg, channelId, accountId, plugin } = await resolve({ channel: opts.channel as string | undefined, account: opts.account as string | undefined, @@ -282,7 +284,7 @@ export function registerDirectoryCli(program: Command) { cfg, accountId, groupId, - limit: parseLimit(opts.limit), + limit, runtime: defaultRuntime, }); if (opts.json) {