Skip to content

Commit 4fb3102

Browse files
committed
init
1 parent 71152e6 commit 4fb3102

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

bin/package-manager-completion.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,17 @@ export class PackageManagerCompletion extends RootCommand {
105105
}
106106

107107
async parse(args: string[]) {
108-
const normalizedArgs = this.stripPackageManagerCommands(args);
108+
const isPowerShell = process.platform === 'win32' && process.env.PSModulePath;
109+
const dashIndex = process.argv.indexOf('--');
110+
111+
const completionArgs =
112+
dashIndex !== -1 && (!isPowerShell || dashIndex < process.argv.length - 1)
113+
? process.argv.slice(dashIndex + 1)
114+
: isPowerShell
115+
? process.argv.slice(process.argv.indexOf('complete') + 1)
116+
: args;
117+
118+
const normalizedArgs = this.stripPackageManagerCommands(completionArgs);
109119

110120
if (normalizedArgs.length >= 1 && normalizedArgs[0].trim() !== '') {
111121
const potentialCliName = normalizedArgs[0];

0 commit comments

Comments
 (0)