Difference between revisions of "Unit Shell"
Line 61: | Line 61: | ||
</div></div> | </div></div> | ||
<br /> | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Shell cursor mode''' <code> SHELL_CURSOR_MODE_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>SHELL_CURSOR_MODE_INSERT = 0;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>SHELL_CURSOR_MODE_OVERWRITE = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Shell cursor shape''' <code> SHELL_CURSOR_SHAPE_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>SHELL_CURSOR_SHAPE_LINE = 0;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>SHELL_CURSOR_SHAPE_BAR = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>SHELL_CURSOR_SHAPE_BLOCK = 2;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
<div style="font-size: 14px; padding-left: 12px;">'''Shell session flag''' <code> SHELL_SESSION_FLAG_* </code></div> | <div style="font-size: 14px; padding-left: 12px;">'''Shell session flag''' <code> SHELL_SESSION_FLAG_* </code></div> | ||
Line 94: | Line 125: | ||
| <code>SHELL_COMMAND_FLAG_EXTENDED = $00000008;</code> | | <code>SHELL_COMMAND_FLAG_EXTENDED = $00000008;</code> | ||
| Extended command, pass command name to command for extended handling | | Extended command, pass command name to command for extended handling | ||
+ | |- | ||
+ | | <code>SHELL_COMMAND_FLAG_COMPLETION = $00000008;</code> | ||
+ | | Command supports auto completion | ||
|- | |- | ||
|} | |} | ||
Line 175: | Line 209: | ||
| <code>SHELL_ALIAS_REBOOT = 'REBOOT';</code> | | <code>SHELL_ALIAS_REBOOT = 'REBOOT';</code> | ||
| | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Shell history''' <code> SHELL_HISTORY_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>SHELL_HISTORY_MAX_COUNT = 100;</code> | ||
+ | | style="width: 50%;"| | ||
|- | |- | ||
|} | |} | ||
Line 189: | Line 234: | ||
| <code>SHELL_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code> | | <code>SHELL_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code> | ||
| Shell informational messages | | Shell informational messages | ||
+ | |- | ||
+ | | <code>SHELL_LOG_LEVEL_WARN = LOG_LEVEL_WARN;</code> | ||
+ | | Shell warning messages | ||
|- | |- | ||
| <code>SHELL_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code> | | <code>SHELL_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code> | ||
Line 476: | Line 524: | ||
|- | |- | ||
| <code>function DoSetCoordinates(ASession:TShellSession; ARow,ACol:LongWord):Boolean; virtual;</code> | | <code>function DoSetCoordinates(ASession:TShellSession; ARow,ACol:LongWord):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function DoGetCursorMode(ASession:TShellSession; var AMode:LongWord):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoSetCursorMode(ASession:TShellSession; AMode:LongWord):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function DoGetCursorShape(ASession:TShellSession; var AShape:LongWord):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoSetCursorShape(ASession:TShellSession; AShape:LongWord):Boolean; virtual;</code> | ||
| | | | ||
|- | |- | ||
Line 523: | Line 587: | ||
|colspan="2"| | |colspan="2"| | ||
|- | |- | ||
− | | <code>function MatchCommand(const ACommand:String; var AContinue:Boolean):TShellCommand; virtual;</code> | + | | <code>function MatchCommand(const ACommand:String; var AName:String; var AParameters:TStrings; var AContinue:Boolean):TShellCommand; virtual;</code> |
| | | | ||
+ | |- | ||
+ | | <code>function CompleteCommand(ASession:TShellSession; const ACommand:String; var AError:Boolean):String; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
|- | |- | ||
| <code>function ProcessCommand(ASession:TShellSession; const ACommand:String):Boolean; virtual;</code> | | <code>function ProcessCommand(ASession:TShellSession; const ACommand:String):Boolean; virtual;</code> | ||
Line 535: | Line 604: | ||
|- | |- | ||
| <code>function CommandSplit(const ACommand:String):TStrings;</code> | | <code>function CommandSplit(const ACommand:String):TStrings;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CommandJoin(AParameters:TStrings):String;</code> | ||
| | | | ||
|- | |- | ||
| <code>function CommandParse(const ACommand:String; var AName:String; var AParameters:TStrings):Boolean;</code> | | <code>function CommandParse(const ACommand:String; var AName:String; var AParameters:TStrings):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CommandConcat(const AName:String; AParameters:TStrings):String;</code> | ||
| | | | ||
|- | |- | ||
Line 568: | Line 643: | ||
|- | |- | ||
|} | |} | ||
− | </div></div> | + | </div></div> |
'''Shell session''' | '''Shell session''' | ||
Line 613: | Line 688: | ||
| <code>FData:Pointer;</code> | | <code>FData:Pointer;</code> | ||
| Shell private data for this session | | Shell private data for this session | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FHistories:TLinkedObjList;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FCurrentHistory:TShellHistory;</code> | ||
+ | | | ||
|- | |- | ||
|colspan="2"| | |colspan="2"| | ||
Line 659: | Line 742: | ||
|- | |- | ||
| <code>property Data:Pointer read FData write SetData;</code> | | <code>property Data:Pointer read FData write SetData;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AddHistory(const ACommand:String):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure ClearHistory;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function FirstHistory:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function LastHistory:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function NextHistory:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function PrevHistory:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CurrentHistory:String;</code> | ||
| | | | ||
|- | |- | ||
Line 756: | Line 862: | ||
|- | |- | ||
| <code>function DoExtended(AShell:TShell; ASession:TShellSession; const AName:String; AParameters:TStrings):Boolean; virtual;</code> | | <code>function DoExtended(AShell:TShell; ASession:TShellSession; const AName:String; AParameters:TStrings):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function DoCompletion(AShell:TShell; ASession:TShellSession; const AName:String; AParameters:TStrings; var AError:Boolean):String; virtual;</code> | ||
| | | | ||
|- | |- | ||
Line 772: | Line 883: | ||
|- | |- | ||
| <code>function DeregisterAlias(AAlias:TShellAlias):Boolean;</code> | | <code>function DeregisterAlias(AAlias:TShellAlias):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function MatchAlias(const AName:String; var AContinue:Boolean):TShellAlias;</code> | ||
| | | | ||
|- | |- | ||
Line 837: | Line 953: | ||
|- | |- | ||
| <code>property Flags:LongWord read FFlags write SetFlags;</code> | | <code>property Flags:LongWord read FFlags write SetFlags;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell history''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellHistory = class(TListObject)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FCommand:String;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>FLength:Integer;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Command:String read FCommand write FCommand;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Length:Integer read FLength write FLength;</code> | ||
| | | | ||
|- | |- | ||
Line 1,337: | Line 1,480: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
− | <pre style="border: 0; padding-bottom:0px;">procedure ShellLogInfo(const AText:String);</pre> | + | <pre style="border: 0; padding-bottom:0px;">procedure ShellLogInfo(const AText:String); inline;</pre> |
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure ShellLogWarn(const AText:String); inline;</pre> | ||
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
Line 1,349: | Line 1,504: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
− | <pre style="border: 0; padding-bottom:0px;">procedure ShellLogError(const AText:String);</pre> | + | <pre style="border: 0; padding-bottom:0px;">procedure ShellLogError(const AText:String); inline;</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
Line 1,361: | Line 1,516: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
− | <pre style="border: 0; padding-bottom:0px;">procedure ShellLogDebug(const AText:String);</pre> | + | <pre style="border: 0; padding-bottom:0px;">procedure ShellLogDebug(const AText:String); inline;</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> |
Revision as of 00:59, 27 March 2018
Return to Unit Reference
Contents
[hide]Description
Ultibo Generic Shell unit
To be documented
Constants
SHELL_*
SHELL_FLAG_*
SHELL_CURSOR_MODE_*
SHELL_CURSOR_SHAPE_*
SHELL_SESSION_FLAG_*
SHELL_COMMAND_FLAG_*
SHELL_ALIAS_FLAG_*
SHELL_COMMAND_*
SHELL_ALIAS_*
SHELL_HISTORY_*
SHELL_LOG_*
Type definitions
None defined
Class definitions
Shell manager
TShellManager = class(TObject)
Shell
TShell = class(TListObject)
Shell session
TShellSession = class(TListObject)
Shell command
TShellCommand = class(TListObject)
Shell alias
TShellAlias = class(TListObject)
Shell history
TShellHistory = class(TListObject)
Shell command help
TShellCommandHelp = class(TShellCommand)
Shell command information
TShellCommandInfo = class(TShellCommand)
Shell command version
TShellCommandVer = class(TShellCommand)
Shell command time
TShellCommandTime = class(TShellCommand)
Shell command clear
TShellCommandClear = class(TShellCommand)
Shell command restart
TShellCommandRestart = class(TShellCommand)
Shell command shutdown
TShellCommandShutdown = class(TShellCommand)
Shell command uptime
TShellCommandUptime = class(TShellCommand)
Shell command threads
TShellCommandThreads = class(TShellCommand)
Shell command memory
TShellCommandMemory = class(TShellCommand)
Shell command devices
TShellCommandDevices = class(TShellCommand)
Public variables
Shell logging
SHELL_DEFAULT_LOG_LEVEL:LongWord = SHELL_LOG_LEVEL_DEBUG;
|
Minimum level for Shell messages. Only messages with level greater than or equal to this will be printed. |
SHELL_LOG_ENABLED:Boolean;
|
Function declarations
Initialization functions
Shell functions
function ShellGetShell(APrevious:TShell; ALock,AUnlock:Boolean):TShell;
function ShellGetCommand(APrevious:TShellCommand; ALock,AUnlock:Boolean):TShellCommand;
function ShellRegisterCommand(ACommand:TShellCommand):Boolean;
function ShellDeregisterCommand(ACommand:TShellCommand):Boolean;
Shell helper functions
Return to Unit Reference