mirror of
https://github.com/pnpm/pnpm.git
synced 2026-02-03 11:42:37 -05:00
fix(dlx): regression with --help (#9830)
Fixes https://github.com/pnpm/pnpm/issues/9823
This commit is contained in:
6
.changeset/yummy-walls-find.md
Normal file
6
.changeset/yummy-walls-find.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/parse-cli-args": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Fix a regression in which `pnpm dlx pkg --help` doesn't pass `--help` to `pkg` [#9823](https://github.com/pnpm/pnpm/issues/9823).
|
||||
@@ -4,6 +4,7 @@ import nopt from '@pnpm/nopt'
|
||||
import didYouMean, { ReturnTypeEnums } from 'didyoumean2'
|
||||
|
||||
const RECURSIVE_CMDS = new Set(['recursive', 'multi', 'm'])
|
||||
const SPECIALLY_ESCAPED_CMDS = new Set(['run', 'dlx'])
|
||||
|
||||
export interface ParsedCliArgs {
|
||||
argv: {
|
||||
@@ -60,7 +61,7 @@ export async function parseCliArgs (
|
||||
commandName = opts.fallbackCommand!
|
||||
inputArgv.unshift(opts.fallbackCommand!)
|
||||
// The run command has special casing for --help and is handled further below.
|
||||
} else if (cmd !== 'run') {
|
||||
} else if (!SPECIALLY_ESCAPED_CMDS.has(cmd!)) {
|
||||
if (noptExploratoryResults['help']) {
|
||||
return {
|
||||
...getParsedArgsForHelp(),
|
||||
@@ -109,7 +110,7 @@ export async function parseCliArgs (
|
||||
}
|
||||
|
||||
function getEscapeArgsWithSpecialCases (): string[] | undefined {
|
||||
if (cmd !== 'run' && cmd !== 'dlx') {
|
||||
if (!SPECIALLY_ESCAPED_CMDS.has(cmd!)) {
|
||||
return opts.escapeArgs
|
||||
}
|
||||
|
||||
@@ -145,7 +146,7 @@ export async function parseCliArgs (
|
||||
|
||||
// For the run command, it's not clear whether --help should be passed to the
|
||||
// underlying script or invoke pnpm's help text until an additional nopt call.
|
||||
if (cmd === 'run' && options['help']) {
|
||||
if (SPECIALLY_ESCAPED_CMDS.has(cmd!) && options['help']) {
|
||||
return {
|
||||
...getParsedArgsForHelp(),
|
||||
workspaceDir,
|
||||
|
||||
Reference in New Issue
Block a user