Skip to main content
Version: Next

CommandsRouter

CommandsRouter

Handles discovery and parsing of command and middleware files in the filesystem.

Signature
class CommandsRouter {
constructor(options: CommandsRouterOptions)
populate(data: ParsedCommandData) => ;
isValidPath() => boolean;
clear() => ;
scan() => ;
getData() => ;
toJSON() => ;
}

constructor

method
(options: CommandsRouterOptions) => CommandsRouter

Creates a new CommandsRouter instance.

populate

method
(data: ParsedCommandData) =>

Populates the router with existing command and middleware data.

isValidPath

method
() => boolean

Checks if the configured entrypoint path exists.

clear

method
() =>

Clears all loaded commands and middleware.

scan

method
() =>

Scans the filesystem for commands and middleware files.

getData

method
() =>

Gets the raw command and middleware collections.

toJSON

method
() =>

Converts the loaded data to a JSON-serializable format.