When multiple commands with common prefix are registered, calling `--help` with the prefix should list them all
Closed this issue · 2 comments
jakub-g commented
Context
Consider this code:
const { Command } = require('clipanion');
class TypecheckCommand extends Command {
static paths = [['typecheck']];
...
}
class TypecheckStopCommand extends Command {
static paths = [['typecheck', 'stop']];
...
}
module.exports = [TypecheckCommand, TypecheckStopCommand];
Current behavior
yarn cli typecheck --help
prints only info about typecheck
itself.
Expected behavior
It should at least indicate the existence of the other subcommands (in this case yarn cli typecheck stop
).
Drarig29 commented
In the same vein, I think that with this code:
const { Command } = require('clipanion');
class TypecheckStartCommand extends Command {
static paths = [['typecheck', 'start']]; // I know it doesn't make sense, but that's for the example
...
}
class TypecheckStopCommand extends Command {
static paths = [['typecheck', 'stop']];
...
}
module.exports = [TypecheckStartCommand, TypecheckStopCommand];
The output should not show:
Unknown Syntax Error: Command not found; did you mean one of:
- yarn cli typecheck start
- yarn cli typecheck stop
While running cli typecheck --help
But rather exactly the same output as the built-in --help
, but just filtered out.