[READ-ONLY] Mirror of https://github.com/bombshell-dev/tab. shell autocompletions for javascript CLIs
4

Configure Feed

Select the types of activity you want to include in your feed.

fix: use pwsh stop parsing operator --% (#86)

* use pwsh stop parsing operator

* fix: cli detect pwsh

* remove operator

* add debug log

* exclude pwsh from having -- required

* update

* add -- manually

* add -- manually

* fix partial command detection

* test empty string

* i bet this will work

* test

* test

* separator

* add changeset

* prettier

* update

* pwsh.ts

* rm log

authored by

AmirHossein Sakhravi and committed by
GitHub
(Dec 7, 2025, 8:48 AM +0330) 060c025e 70593867

+28 -7
+5
.changeset/curvy-clouds-hide.md
··· 1 + --- 2 + '@bomb.sh/tab': patch 3 + --- 4 + 5 + Fix PowerShell completion argument parsing
+23 -7
bin/cli.ts
··· 9 9 10 10 async function main() { 11 11 const args = process.argv.slice(2); 12 + const isPowerShell = process.platform === 'win32' && process.env.PSModulePath; 13 + 14 + if (process.env.TAB_DEBUG) { 15 + console.error('RAW ARGS:', process.argv); 16 + } 12 17 13 18 // <packageManager> complete -- <args> 14 19 if (args.length >= 2 && args[1] === 'complete') { ··· 23 28 } 24 29 25 30 const dashIndex = process.argv.indexOf('--'); 26 - if (dashIndex !== -1) { 27 - const completion = new PackageManagerCompletion(packageManager); 28 - await setupCompletionForPackageManager(packageManager, completion); 29 - const toComplete = process.argv.slice(dashIndex + 1); 30 - await completion.parse(toComplete); 31 - process.exit(0); 32 - } else { 31 + // PowerShell's argument parsing can normalize or drop a `--` 32 + // our "<pm> complete -- <query>" POSIX-style contract doesn't work the same way. 33 + // so we need to handle the PowerShell case separately. 34 + // gh issue discussion: https://github.com/bombshell-dev/tab/issues/82 35 + 36 + const completionArgs = 37 + dashIndex !== -1 && (!isPowerShell || dashIndex < process.argv.length - 1) 38 + ? process.argv.slice(dashIndex + 1) 39 + : isPowerShell 40 + ? args.slice(2) 41 + : null; 42 + 43 + if (!completionArgs) { 33 44 console.error(`Error: Expected '--' followed by command to complete`); 34 45 process.exit(1); 35 46 } 47 + 48 + const completion = new PackageManagerCompletion(packageManager); 49 + await setupCompletionForPackageManager(packageManager, completion); 50 + await completion.parse(completionArgs); 51 + process.exit(0); 36 52 } 37 53 38 54 // <packageManager> <shell>