This project is read-only.

Modifying the DefaultCommands

The framework provides a number of default commands such as quit and exit, as well as the help system.

There will always be a DefaultCommands object on the CommandInterpreter, however, you can create your own class that inherits from DefaultCommands and then override the existing methods to change their behavior and/or hide them from the help system.

When you override a method you can redeclare the CommandMethod attribute and specify that the command is hidden. You can then set the line result to a "not implemented" error message instead of executing the base method.

You could also add your own additional command in this class if you so desired.

Custom DefaultCommands Example

Remove Echo Command

Imports CommandConsoleFramework

Module Module1
    Sub Main()
        CommandInterpreter.DefaultCommands = New TestDefaultCommands
    End Sub
End Module

Public NotInheritable Class TestDefaultCommands
    Inherits DefaultCommands

    Overrides Sub Echo(line As CommandConsoleFramework.CommandLine)
        line.SetResultMessage("Not Implemented", True)
    End Sub
End Class

Last edited May 17, 2012 at 11:40 PM by ReedKimble, version 1


No comments yet.