From 568dc3ab211b1d24fd55899ea4e022a0b20e191f Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Mon, 5 Dec 2022 12:13:56 +0200 Subject: [PATCH] fix(licenses): print help when no subcommand is specified (#5751) close #5745 --- .changeset/rotten-mayflies-enjoy.md | 6 ++++++ reviewing/plugin-commands-licenses/src/licenses.ts | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/rotten-mayflies-enjoy.md diff --git a/.changeset/rotten-mayflies-enjoy.md b/.changeset/rotten-mayflies-enjoy.md new file mode 100644 index 00000000000..905f9cce8e7 --- /dev/null +++ b/.changeset/rotten-mayflies-enjoy.md @@ -0,0 +1,6 @@ +--- +"@pnpm/plugin-commands-licenses": patch +"pnpm": patch +--- + +`pnpm licenses` should print help, not just an error message [#5745](https://github.com/pnpm/pnpm/issues/5745). diff --git a/reviewing/plugin-commands-licenses/src/licenses.ts b/reviewing/plugin-commands-licenses/src/licenses.ts index 443193f5ceb..ba2facb4536 100644 --- a/reviewing/plugin-commands-licenses/src/licenses.ts +++ b/reviewing/plugin-commands-licenses/src/licenses.ts @@ -85,7 +85,9 @@ export async function handler ( params: string[] = [] ) { if (params.length === 0) { - throw new PnpmError('LICENCES_NO_SUBCOMMAND', 'Please specify the subcommand') + throw new PnpmError('LICENCES_NO_SUBCOMMAND', 'Please specify the subcommand', { + hint: help(), + }) } switch (params[0]) { case 'list':