pyGHDL.cli.dom#

Classes

  • Application: A mixin class (interface) to provide class-local terminal writing methods.


Classes

class pyGHDL.cli.dom.Application(debug=False, verbose=False, quiet=False, sphinx=False)[source]#

Inheritance

Inheritance diagram of Application

__init__(debug=False, verbose=False, quiet=False, sphinx=False)[source]#

Initializer of a line based terminal interface.

property Debug: bool#

Returns true, if debug messages are enabled.

ExitOnPreviousErrors()#

Exit application if errors have been printed.

Return type:

None

ExitOnPreviousWarnings()#

Exit application if warnings have been printed.

Return type:

None

Foreground = {'BLUE': '\x1b[94m', 'CYAN': '\x1b[96m', 'DARK_BLUE': '\x1b[34m', 'DARK_CYAN': '\x1b[36m', 'DARK_GRAY': '\x1b[90m', 'DARK_GREEN': '\x1b[32m', 'DARK_RED': '\x1b[31m', 'DARK_YELLOW': '\x1b[33m', 'ERROR': '\x1b[91m', 'GRAY': '\x1b[37m', 'GREEN': '\x1b[92m', 'HEADLINE': '\x1b[95m', 'MAGENTA': '\x1b[95m', 'NOCOLOR': '\x1b[39m', 'RED': '\x1b[91m', 'WARNING': '\x1b[93m', 'WHITE': '\x1b[97m', 'YELLOW': '\x1b[93m'}#

Terminal colors

static GetAttributes(method, filter=<class 'pyAttributes.Attribute'>)#

Returns a list of pyAttributes attached to the given method.

Return type:

List[TypeVar(TAttr, bound= Attribute)]

Parameters:
static GetTerminalSize()#

Returns the terminal size as tuple (width, height) for Windows, Mac OS (Darwin), Linux, cygwin (Windows), MinGW32/64 (Windows).

Return type:

Tuple[int, int]

static HasAttribute(method, filter=<class 'pyAttributes.Attribute'>)#

Returns true, if the given method has pyAttributes attached.

Return type:

bool

Parameters:
property Height: int#

Returns the current terminal window’s height.

property LogLevel: Severity#

Return the current minimal severity level for writing.

property MainParser: ArgumentParser#

Returns the main parser.

property Quiet: bool#

Returns true, if quiet mode is enabled.

property SubParsers#

Returns the sub-parsers.

property Terminal: Terminal#

Return the local terminal instance.

property Verbose: bool#

Returns true, if verbose messages are enabled.

property Width: int#

Returns the current terminal window’s width.

WriteDebug(message, indent=2, appendLinebreak=True)#

Write a debug message if condition is true.

WriteDryRun(message, indent=2, appendLinebreak=True)#

Write a dry-run message if condition is true.

WriteError(message, indent=0, appendLinebreak=True)#

Write an error message if condition is true.

WriteFatal(message, indent=0, appendLinebreak=True, immediateExit=True)#

Write a fatal message if condition is true.

WriteInfo(message, indent=0, appendLinebreak=True)#

Write a info message if condition is true.

WriteLine(line)#

Print a formatted line to the underlying terminal/console offered by the operating system.

Parameters:

line (Line) –

WriteNormal(message, indent=0, appendLinebreak=True)#

Write a normal message if condition is true.

WriteQuiet(message, indent=0, appendLinebreak=True)#

Write a message even in quiet mode if condition is true.

WriteVerbose(message, indent=1, appendLinebreak=True)#

Write a verbose message if condition is true.

WriteWarning(message, indent=0, appendLinebreak=True)#

Write a warning message if condition is true.

_LOG_MESSAGE_FORMAT__ = {Severity.Debug: '{DARK_GRAY}{message}{NOCOLOR}', Severity.Verbose: '{GRAY}{message}{NOCOLOR}', Severity.Normal: '{WHITE}{message}{NOCOLOR}', Severity.DryRun: '{DARK_CYAN}[DRY] {message}{NOCOLOR}', Severity.Info: '{WHITE}{message}{NOCOLOR}', Severity.Warning: '{YELLOW}[WARNING]{message}{NOCOLOR}', Severity.Quiet: '{WHITE}{message}{NOCOLOR}', Severity.Error: '{RED}[ERROR] {message}{NOCOLOR}', Severity.Fatal: '{DARK_RED}[FATAL] {message}{NOCOLOR}'}#

Message formatting rules.

__new__(**kwargs)#
_height: int = None#

Terminal height in characters

_width: int = None#

Terminal width in characters

classmethod deinitColors()#

Uninitialize the terminal for color support by colorama.

Return type:

None

classmethod exit(returnCode=0)#

Exit the terminal application by uninitializing color support and returning an exit code.

Return type:

NoReturn

Parameters:

returnCode (int) –

classmethod fatalExit(returnCode=0)#

Exit the terminal application by uninitializing color support and returning a fatal exit code.

Return type:

NoReturn

Parameters:

returnCode (int) –

classmethod initColors()#

Initialize the terminal for color support by colorama.

Return type:

None

classmethod printException(ex)#

Prints an exception of type Exception.

Return type:

NoReturn

classmethod printNotImplementedError(ex)#

Prints a not-implemented exception of type NotImplementedError.

Return type:

NoReturn

classmethod versionCheck(version)#

Check if the used Python interpreter fulfills the minimum version requirements.

Return type:

None