fix: support --help and -h flags for 'pnpm create' command (#9624)

close #8545
This commit is contained in:
Abhijeet Singh
2025-06-16 01:47:11 +05:30
committed by GitHub
parent e3b9c25dcd
commit 61e7b0391a
2 changed files with 12 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/plugin-commands-script-runners": patch
pnpm: patch
---
Fix the `--help` and `-h` flags not working as expected for the `pnpm create` command.

View File

@@ -7,7 +7,12 @@ import * as dlx from './dlx'
export const commandNames = ['create']
export async function handler (_opts: dlx.DlxCommandOptions, params: string[]): Promise<{ exitCode: number }> {
export async function handler (_opts: dlx.DlxCommandOptions, params: string[]): Promise<{ exitCode: number } | string> {
// If the first argument is --help or -h, we show the help message.
if (params[0] === '--help' || params[0] === '-h') {
return help()
}
const [packageName, ...packageArgs] = params
if (packageName === undefined) {
throw new PnpmError(