Skip to content

Commit b5d271c

Browse files
committed
test
1 parent cdf031a commit b5d271c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

bin/cli.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ async function main() {
3737
dashIndex !== -1 && (!isPowerShell || dashIndex < process.argv.length - 1)
3838
? process.argv.slice(dashIndex + 1)
3939
: isPowerShell
40-
? args.slice(2)
40+
? (() => {
41+
const fallback = args.slice(2);
42+
// PowerShell shim can drop both the separator and empty placeholders.
43+
// Add two empty strings to preserve cursor-position intent.
44+
fallback.push('', '');
45+
return fallback;
46+
})()
4147
: null;
4248

4349
if (process.env.TAB_DEBUG) {

bin/package-manager-completion.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ function runCompletionCommand(
3131
leadingArgs: string[],
3232
completionArgs: string[]
3333
): string {
34-
const args = [...leadingArgs, 'complete', '--', ...completionArgs];
34+
const safeCompletionArgs =
35+
completionArgs.length === 0 ? [''] : completionArgs;
36+
37+
const args = [...leadingArgs, 'complete', '--', ...safeCompletionArgs];
3538
tabDebugLog('spawn completion:', command, args);
3639

3740
const result = spawnSync(

0 commit comments

Comments
 (0)