中文
← Errors

F_SYSTEM_DUPLICATE_COMMAND_TOKEN

Duplicate command token

Two registered commands use the same name or alias.

Updated 2 weeks ago

Reproduction

Command names and aliases share one application-wide namespace:

src/commands.ts
import { Command, Container, Handler } from 'func'

@Command({ name: 'build' })
class BuildCommand {
  @Handler()
  run() {}
}

@Command({ name: 'build' })
class RebuildCommand {
  @Handler()
  run() {}
}

new Container([BuildCommand, RebuildCommand])

How to fix it

Give every command name and alias a unique token:

src/commands.ts
@Command({ name: 'build' })
class BuildCommand {
  @Handler()
  run() {}
}

@Command({ name: 'rebuild' })
class RebuildCommand {
  @Handler()
  run() {}
}

new Container([BuildCommand, RebuildCommand])