CLI Core

Overview

Path PyPoE/cli/core.py
Version 1.0.0a0
Revision $Id: a5fb3d1ba46d8f546939fc9bb3cbf488d31f5e23 $
Author Omega_K2

Description

CLI core utility classes and functions.

Agreement

See PyPoE/LICENSE

TODO-List

  • Virtual Terminal?
  • console output formatting/linebreaks

Documentation

Classes

class PyPoE.cli.core.Msg[source]

Bases: enum.Enum

Used for :py:func`console` function.

Parameters:
  • default – default
  • warning – yellow warning message
  • error – red error message
class PyPoE.cli.core.OutputHook(show_warning)[source]

Bases: object

Warning hook to reformat / restyle warning messages properly.

Functions

PyPoE.cli.core.run(parser, config)[source]

Run the CLI application with the given parser and config.

It will take care of handling parsing the arguments and calling the appropriate function and print any tracebacks that occurred during the call.

Saves config and exits the python client.

Warning

This function will exist the python client on completion

Parameters:
PyPoE.cli.core.console(message, msg=<Msg.default: '\x1b[0m'>, rtr=False, raw=False)[source]

Send the specified messge to console

Parameters:
  • message (str) – Message to send
  • msg (Msg) – Message type
  • rtr (bool) – Return message instead of printing
  • raw (bool) – Skip timestamp/colour formatting
Returns:

if rtr is specified returns formatted message, None otherwise

Return type:

None or str