Skip to content

Commit f8e021f

Browse files
committed
update
1 parent 2997b16 commit f8e021f

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

src/index.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -337,28 +337,13 @@ export class Completion {
337337
previousArgs: string[],
338338
toComplete: string
339339
) {
340-
const commandParts = [...previousArgs].filter(arg => arg !== '');
341-
342-
// When we have no real command parts (just empty or showing root commands)
343-
const isRootCompletion = commandParts.length === 0;
340+
const commandParts = [...previousArgs].filter(Boolean);
344341

345342
for (const [k, command] of this.commands) {
346343
if (k === '') continue;
347344

348345
const parts = k.split(' ');
349346

350-
// For root completion, just match the first part of each command
351-
if (isRootCompletion) {
352-
if (parts[0].startsWith(toComplete)) {
353-
this.completions.push({
354-
value: parts[0],
355-
description: command.description,
356-
});
357-
}
358-
continue;
359-
}
360-
361-
// For subcommand completion, match the parts against commandParts
362347
let match = true;
363348
let i = 0;
364349

0 commit comments

Comments
 (0)