复现
不带 --help 调用这个主命令时,没有可执行的方法:
src/root.command.ts
import { CommandMajor, Handler, Module, createApp } from 'func'
@CommandMajor()
class RootCommand {
@Handler({ flag: 'help' })
help() {}
}
@Module({ commands: [RootCommand] })
class AppModule {}
await createApp(AppModule).bootstrap({ argv: [] })如何修复
添加一个默认处理器,或确保每种合法调用都能选择已声明的 flag 或 path:
src/root.command.ts
class RootCommand {
@Handler({ flag: 'help' })
help() {}
@Handler()
run() {}
}
@Module({ commands: [RootCommand] })
class AppModule {}
await createApp(AppModule).bootstrap({ argv: [] })