Skip to main content

Type Alias: CommandFunction()<FLAGS, ARGS, CONTEXT>

CommandFunction<FLAGS, ARGS, CONTEXT>: (this, flags, ...args) => void | Error | Promise<void | Error>

All command functions are required to have a general signature:

(flags: {...}, ...args: [...]) => void | Promise<void>
  • args should be an array/tuple of any length or type.
  • flags should be an object with any key-value pairs.

The specific types of args and flags are customizable to the individual use case and will be used to determine the structure of the positional arguments and flags.

Type Parameters

FLAGS extends BaseFlags

ARGS extends BaseArgs

CONTEXT extends CommandContext

Parameters

this: CONTEXT

flags: FLAGS

• ...args: ARGS

Returns

void | Error | Promise<void | Error>

Defined in

packages/core/src/routing/command/types.ts:19