中文
← Errors

F_SYSTEM_NO_MATCHING_HANDLER

No matching handler

A command has handlers, but the current invocation matches no path or flag and no default handler exists.

Updated

Reproduction

Invoking this major command without --help leaves no method to run:

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: [] })

How to fix it

Add one default handler, or ensure every valid invocation selects a declared flag or path:

src/root.command.ts
class RootCommand {
  @Handler({ flag: 'help' })
  help() {}

  @Handler()
  run() {}
}

@Module({ commands: [RootCommand] })
class AppModule {}

await createApp(AppModule).bootstrap({ argv: [] })