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
- __init__(debug=False, verbose=False, quiet=False, sphinx=False)[source]¶
Initializer of a line based terminal interface.
- 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.
- static GetTerminalSize()¶
Returns the terminal size as tuple (width, height) for Windows, Mac OS (Darwin), Linux, cygwin (Windows), MinGW32/64 (Windows).
- static HasAttribute(method, filter=<class 'pyAttributes.Attribute'>)¶
Returns true, if the given method has pyAttributes attached.
- property LogLevel: Severity¶
Return the current minimal severity level for writing.
- Return type:
Severity
- property MainParser: ArgumentParser¶
Returns the main parser.
- Return type:
- property SubParsers¶
Returns the sub-parsers.
- property Terminal: Terminal¶
Return the local terminal instance.
- Return type:
Terminal
- 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)¶
- classmethod deinitColors()¶
Uninitialize the terminal for color support by colorama.
- Return type:
- classmethod exit(returnCode=0)¶
Exit the terminal application by uninitializing color support and returning an exit code.
- classmethod fatalExit(returnCode=0)¶
Exit the terminal application by uninitializing color support and returning a fatal exit code.
- classmethod printNotImplementedError(ex)¶
Prints a not-implemented exception of type
NotImplementedError
.- Return type: