FreeNOS
Public Member Functions | Protected Attributes
ShellCommand Class Referenceabstract
bin » sh

Builtin command for the Shell. More...

#include <ShellCommand.h>

Inheritance diagram for ShellCommand:
ChangeDirCommand ExitCommand HelpCommand StdioCommand TimeCommand WriteCommand

Public Member Functions

 ShellCommand (const char *name, const Size minParams=0)
 Constructor. More...
 
virtual ~ShellCommand ()
 Destructor. More...
 
const char * getName () const
 Get command name. More...
 
const char * getHelp () const
 Get command help. More...
 
Size getMinimumParams () const
 Get the minimum number of parameters required. More...
 
virtual int execute (const Size nparams, const char **params)=0
 Executes the command. More...
 

Protected Attributes

const char * m_name
 Unique name of the command. More...
 
const char * m_help
 Command help text. More...
 
const Size m_minParams
 Minimum number of parameters required. More...
 

Detailed Description

Builtin command for the Shell.

See also
Shell

Definition at line 38 of file ShellCommand.h.

Constructor & Destructor Documentation

◆ ShellCommand()

ShellCommand::ShellCommand ( const char *  name,
const Size  minParams = 0 
)

Constructor.

Parameters
nameUnique name of the command.
minParamsMinimum number of parameters required by this command.

Definition at line 20 of file ShellCommand.cpp.

◆ ~ShellCommand()

ShellCommand::~ShellCommand ( )
virtual

Destructor.

Definition at line 27 of file ShellCommand.cpp.

Member Function Documentation

◆ execute()

virtual int ShellCommand::execute ( const Size  nparams,
const char **  params 
)
pure virtual

Executes the command.

Parameters
nparamsNumber of parameters given.
paramsArray of parameters.
Returns
Error code or zero on success.

Implemented in HelpCommand, TimeCommand, WriteCommand, ChangeDirCommand, ExitCommand, and StdioCommand.

Referenced by Shell::executeInput().

◆ getHelp()

const char * ShellCommand::getHelp ( ) const

Get command help.

Returns
Command help

Definition at line 36 of file ShellCommand.cpp.

References m_help.

◆ getMinimumParams()

Size ShellCommand::getMinimumParams ( ) const

Get the minimum number of parameters required.

Returns
Minimum number of parameters required.

Definition at line 41 of file ShellCommand.cpp.

References m_minParams.

Referenced by Shell::executeInput().

◆ getName()

const char * ShellCommand::getName ( ) const

Get command name.

Returns
Command name

Definition at line 31 of file ShellCommand.cpp.

References m_name.

Referenced by ChangeDirCommand::execute(), Shell::executeInput(), and Shell::registerCommand().

Field Documentation

◆ m_help

const char* ShellCommand::m_help
protected

◆ m_minParams

const Size ShellCommand::m_minParams
protected

Minimum number of parameters required.

Definition at line 94 of file ShellCommand.h.

Referenced by getMinimumParams().

◆ m_name

const char* ShellCommand::m_name
protected

Unique name of the command.

Definition at line 88 of file ShellCommand.h.

Referenced by getName().


The documentation for this class was generated from the following files: