class Cradare2::Plugin::Router

Overview

Router for mounting multiple command dispatchers or sub-suites under different prefixes. Enables building modular composite plugins (e.g. mounting both "godot" and "lapis" suites) while providing unified command dispatching and help menus.

Defined in:

cradare2/plugin/router.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(client : Client) #

[View source]

Instance Method Detail

def client : Client #

[View source]
def default_prefix : String | Nil #

[View source]
def default_prefix=(default_prefix : String | Nil) #

[View source]
def dispatch(args : Array(String)) : String #

Dispatches an array of command arguments.


[View source]
def dispatch(cmd_line : String) : String #

Dispatches a command string to the appropriate mounted prefix dispatcher.


[View source]
def help : String #

Unified help menu aggregating all mounted command suites.


[View source]
def mount(prefix : String, dispatcher : CommandDispatcher) : self #

Mounts a CommandDispatcher under a specific prefix.


[View source]
def mount(prefix : String, &block : CommandDispatcher -> Nil) : self #

Mounts and creates a new CommandDispatcher for prefix yielding it to a block.


[View source]
def routes : Hash(String, CommandDispatcher) #

[View source]