Skip to content

Commit b7dd1aa

Browse files
committed
fix partial command detection
1 parent 2a7ec8a commit b7dd1aa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

bin/cli.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ async function main() {
4141
const completion = new PackageManagerCompletion(packageManager);
4242
await setupCompletionForPackageManager(packageManager, completion);
4343
let toComplete = args.slice(2);
44-
// Only append -- if there are actual args (PowerShell stripped the trailing --)
45-
if (toComplete.length > 0) {
46-
toComplete.push('--');
44+
// In PowerShell, -- is stripped. Only append it if the last arg is a flag
45+
// (starts with -), meaning we want flag/option completion
46+
if (toComplete.length > 0 && toComplete[toComplete.length - 1].startsWith('-')) {
47+
toComplete = [...toComplete, '--'];
4748
}
4849
await completion.parse(toComplete);
4950
process.exit(0);

0 commit comments

Comments
 (0)