Skip to content

Commit cf7658d

Browse files
committed
update
1 parent 0489f9d commit cf7658d

File tree

2 files changed

+1
-44
lines changed

2 files changed

+1
-44
lines changed

bin/cli.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,9 @@ async function main() {
3737
dashIndex !== -1 && (!isPowerShell || dashIndex < process.argv.length - 1)
3838
? process.argv.slice(dashIndex + 1)
3939
: isPowerShell
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-
})()
40+
? args.slice(2)
4741
: null;
4842

49-
if (process.env.TAB_DEBUG) {
50-
console.error('COMPLETION ARGS:', completionArgs);
51-
}
52-
5343
if (!completionArgs) {
5444
console.error(`Error: Expected '--' followed by command to complete`);
5545
process.exit(1);

bin/package-manager-completion.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,9 @@ import { RootCommand } from '../src/t.js';
77

88
const noop = () => {};
99

10-
const isTabDebug = Boolean(process.env.TAB_DEBUG);
1110
const isPowerShellEnv =
1211
process.platform === 'win32' && Boolean(process.env.PSModulePath);
1312

14-
function tabDebugLog(...args: unknown[]) {
15-
if (isTabDebug) {
16-
console.error('[TAB_DEBUG]', ...args);
17-
}
18-
}
19-
2013
function debugLog(...args: unknown[]) {
2114
if (process.env.DEBUG) {
2215
console.error('[DEBUG]', ...args);
@@ -38,7 +31,6 @@ function runCompletionCommand(
3831
completionArgs.length === 0 ? [''] : completionArgs;
3932

4033
const args = [...leadingArgs, 'complete', '--', ...safeCompletionArgs];
41-
tabDebugLog('spawn completion:', command, args);
4234

4335
// PowerShell: prefer invoking via powershell.exe so .ps1 shims are resolved.
4436
if (isPowerShellEnv && path.extname(command) === '') {
@@ -47,12 +39,6 @@ function runCompletionCommand(
4739

4840
const result = spawnSync(command, args, completionSpawnOptions);
4941

50-
tabDebugLog('spawn result:', {
51-
status: result.status,
52-
error: result.error?.message,
53-
stdout: result.stdout,
54-
});
55-
5642
// If the direct spawn fails on Windows, retry via PowerShell as a safety net.
5743
if (
5844
getErrnoCode(result.error) === 'ENOENT' &&
@@ -84,8 +70,6 @@ function runCompletionViaPowerShell(command: string, args: string[]): string {
8470
const psArgs = args.map(powerShellQuote);
8571
const psCommand = `& ${command} ${psArgs.join(' ')}`.trimEnd();
8672

87-
tabDebugLog('powershell exec:', psCommand);
88-
8973
const psResult = spawnSync(
9074
'powershell.exe',
9175
[
@@ -99,12 +83,6 @@ function runCompletionViaPowerShell(command: string, args: string[]): string {
9983
completionSpawnOptions
10084
);
10185

102-
tabDebugLog('powershell exec result:', {
103-
status: psResult.status,
104-
error: psResult.error?.message,
105-
stdout: psResult.stdout,
106-
});
107-
10886
if (psResult.error) {
10987
throw psResult.error;
11088
}
@@ -132,18 +110,13 @@ async function checkCliHasCompletions(
132110
const result = runCompletionCommand(cliName, [], []);
133111
if (result) return true;
134112
} catch {
135-
tabDebugLog('checkCliHasCompletions direct call failed for', cliName);
136113
noop();
137114
}
138115

139116
try {
140117
const result = runCompletionCommand(packageManager, [cliName], []);
141118
return !!result;
142119
} catch {
143-
tabDebugLog(
144-
'checkCliHasCompletions package-manager call failed for',
145-
cliName
146-
);
147120
return false;
148121
}
149122
}
@@ -159,19 +132,13 @@ async function getCliCompletions(
159132
return result.split('\n').filter(Boolean);
160133
}
161134
} catch {
162-
tabDebugLog('getCliCompletions direct call failed for', cliName, args);
163135
noop();
164136
}
165137

166138
try {
167139
const result = runCompletionCommand(packageManager, [cliName], args);
168140
return result.split('\n').filter(Boolean);
169141
} catch {
170-
tabDebugLog(
171-
'getCliCompletions package-manager call failed for',
172-
cliName,
173-
args
174-
);
175142
return [];
176143
}
177144
}

0 commit comments

Comments
 (0)