-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Description
When a command has multiple paths and the user types a partial command, the error message shows duplicate suggestions instead of listing all available paths.
Reproduce
cli.register(
class X extends Command {
static override paths = [
['ls', 'foo'],
['ls', 'foos'],
['ls', 'bar'],
['ls', 'bars'],
]
async execute() {}
},
)$ cli ls
Unknown Syntax Error: Command not found; did you mean one of:
0. cli ls foo
1. cli ls foo
2. cli ls foo
3. cli ls foo
While running lsAlso affects --help:
$ cli ls --help
Multiple commands match your selection:
0. cli ls foo
1. cli ls foo
2. cli ls foo
3. cli ls foo
Run again with -h=<index> to see the longer details of any of those commands.Expected
Should show all distinct paths:
$ cli ls --help
Multiple commands match your selection:
0. cli ls foo
1. cli ls foos
2. cli ls bar
3. cli ls bars
Run again with -h=<index> to see the longer details of any of those commands.Root Cause
The usage formatter logic appears to be always using the first path, see
Line 795 in 434b5a6
| segments.push(...this.paths[0]); |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels