NAME

OSGi::Osgish::CommandHandler - Handler for osgish commands

DESCRIPTION

This object is responsible for managing OSGi::Osgish::Command object which are at the heart of osgish and provide all features. During startup it registeres commands dynamicallt and pushes the OSGi::Osgish context to them for allowing to access the agent and other handlers.

Registration is occurs in two phases:

...

It also keeps a stack of so called navigational context which can be used to provide a menu like structure (think of it like directories which can be entered). If the stack contains elements, the navigational commands .. and / are added to traverse the stack. / will always jump to the top of the stack (the root directory) whereas .. will pop up one level in the stack (the parent directory). Commands which want to manipulate the stack like pushing themselves on the stack should use the methods "push_on_stack" or "reset_stack" (for jumping to the top of the menu).

METHODS

$command_handler = new OSGi::Osgish::CommandHandler($osgish,$shell)

Create a new command handler object. The arguments to be passed are the osgish object ($osgish) and the shell object ($shell) in order to update the shell's current command set.

$comand_handler->push_on_stack($context,$cmds)

Update the stack with an entry of name $context which provides the commands $cmds. $cmds must be a hashref as known to Term::ShellUI, whose commands method is used to update the shell. Additionally it updates the shell's prompt to reflect the state of the stack.

$command_handler->reset_stack

Reset the stack and install the top and global commands as collected from the registered OSGi::Osgish::Command.

$command = $command_handler->command($command_name)

Get a registered command by name