中文
← Errors

F_SYSTEM_MULTIPLE_MAJOR_COMMANDS

Multiple major commands

The application registers more than one command as its root command.

Updated 2 weeks ago

Reproduction

Only one command can own invocations that do not start with a command name:

src/app.module.ts
import { CommandMajor, Container, Handler } from 'func'

@CommandMajor()
class FirstMajor {
  @Handler()
  run() {}
}

@CommandMajor()
class SecondMajor {
  @Handler()
  run() {}
}

new Container([FirstMajor, SecondMajor])

How to fix it

Keep one major command and register the other with a name:

src/app.module.ts
import { Command, CommandMajor, Container, Handler } from 'func'

@CommandMajor()
class FirstMajor {
  @Handler()
  run() {}
}

@Command({ name: 'second' })
class SecondCommand {
  @Handler()
  run() {}
}

new Container([FirstMajor, SecondCommand])