angelos.server.cmd¶
Server terminal and command classes.
-
class
angelos.server.cmd.
Command
(cmd, io)¶ Bases:
angelos.common.utils.FactoryInterface
Representation of one executable command.
-
abbr
= ''¶
-
description
= ''¶
-
execute
(opts)¶ Execute a command with current options.
-
-
class
angelos.server.cmd.
ConsoleIO
(process: asyncssh.process.SSHServerProcess)¶ Bases:
object
IO helper class.
With this class commands can prompt the user and format output.
-
classmethod
blink
(text)¶ Make terminal text blink.
-
classmethod
bold
(text)¶ Make terminal text bold.
-
choose
(msg='', choices=[], em=False)¶ Ask for user choice.
-
confirm
(msg='', em=True)¶ Ask for user choice.
-
classmethod
dim
(text)¶ Make terminal text dim.
-
exception
(e)¶ Print exception error message to console.
-
classmethod
format
(text, b=False, d=False, i=False, u=False, bl=False, nv=False)¶ Format terminal text in several ways.
-
classmethod
inverse
(text)¶ Make terminal text inverse.
-
classmethod
italic
(text)¶ Make terminal text italic.
Print menu with entries.
-
multiline
(msg='', t=<class 'str'>) → Any¶ Prompt for multiline user input.
- Parameters
msg (str) – Output printed as prompt.
t (callable) – Method for input type casting.
- Returns
The input in desirable format.
-
presskey
(msg='Press any key to continue...')¶ Press a key to continue.
-
prompt
(msg: unicode = '', t=<class 'str'>) → Any¶ Prompt for user input.
- Parameters
msg (str) – Output printed as prompt.
t (callable) – Method for input type casting.
- Returns
The input in desirable format.
-
secret
(msg='Enter password')¶ Print menu with entries.
-
property
stdin
¶ Property access to the process input stream.
- Returns
The input stream
- Return type
asyncssh.SSHReader
-
property
stdout
¶ Property access to the process output stream.
- Returns
The output stream
- Return type
asyncssh.SSHWriter
-
classmethod
underline
(text)¶ Make terminal text underline.
-
upd_size
() → None¶ Update terminal size at event.
-
classmethod
-
class
angelos.server.cmd.
Option
(name, abbr=None, type=3, choices=[], default=None, help='')¶ Bases:
object
Class representation of one Command option.
-
TYPE_BOOL
= 1¶
-
TYPE_CHOICES
= 2¶
-
TYPE_VALUE
= 3¶
-
evaluate
(opts)¶ Evaluate options.
-
-
class
angelos.server.cmd.
Shell
(commands, ioc, process)¶ Bases:
angelos.lib.ioc.ContainerAware
Shell that represents a PTY.
-
class
ClearCommand
(io)¶ Bases:
angelos.server.cmd.Command
Clear the screen.
-
abbr
= 'Clear the terminal window.'¶
-
description
= 'Clear clears the console screen/window'¶
-
-
EOL
= '\r\n'¶
-
class
ExitCommand
(io)¶ Bases:
angelos.server.cmd.Command
Exit the shell.
-
abbr
= 'Exit the current terminal session.'¶
-
description
= 'Exit will exit the console session and restore the\nscreen'¶
-
-
class
HelpCommand
(io, cmds)¶ Bases:
angelos.server.cmd.Command
Print help text about a command.
-
abbr
= 'Print available commands and how to use them.'¶
-
description
= 'Help will print all the available commands loaded in\nthe console shell'¶
-
-
cmd_regex
= '^(\\w+)'¶
-
execute
(line)¶ Interpret one line of text in the shell.
-
opt_regex
= '(?<=\\s)((?:-\\w(?!\\w))|(?:--\\w+))(?:(?:[ ]+|=)(?:(?:"((?<=")\\S+(?="))")|(?![\\-|"])(:?\\S+)))?'¶
-
class
-
class
angelos.server.cmd.
Terminal
(commands, ioc, process)¶ Bases:
angelos.server.cmd.Shell
Asynchronoius instance of Shell.
-
run
()¶ Looping the Shell interpreter.
-