maestral.cli.output

This module provides classes and methods for beautifully formatted output to stdout. This includes printing tables and grids, formatting dates and eliding strings.

Module Contents

maestral.cli.output.TABLE_STYLE[source]
maestral.cli.output.rich_table(*headers)[source]
Parameters:

headers (rich.table.Column | str)

Return type:

rich.table.Table

class maestral.cli.output.RichDateField(dt, style='')[source]

A datetime renderable.

Parameters:
format(max_width)[source]
Parameters:

max_width (int)

Return type:

str

class maestral.cli.output.Prefix[source]

Bases: enum.Enum

Prefix for command line output

Info = 0[source]
Ok = 1[source]
Warn = 2[source]
NONE = 3[source]
maestral.cli.output.echo(message, nl=True, prefix=Prefix.NONE)[source]

Print a message to stdout.

Parameters:
  • message (str) – The string to output.

  • nl (bool) – Whether to end with a new line.

  • prefix (Prefix) – Any prefix to output before the message,

Return type:

None

maestral.cli.output.info(message, nl=True)[source]

Print an info message to stdout. Will be prefixed with a dash.

Parameters:
  • message (str) – The string to output.

  • nl (bool) – Whether to end with a new line.

Return type:

None

maestral.cli.output.warn(message, nl=True)[source]

Print a warning to stdout. Will be prefixed with an exclamation mark.

Parameters:
  • message (str) – The string to output.

  • nl (bool) – Whether to end with a new line.

Return type:

None

maestral.cli.output.ok(message, nl=True)[source]

Print a confirmation to stdout. Will be prefixed with a checkmark.

Parameters:
  • message (str) – The string to output.

  • nl (bool) – Whether to end with a new line.

Return type:

None

maestral.cli.output.echo_via_pager(text_or_generator, color=None)[source]
Parameters:
  • text_or_generator (Iterable[str] | Callable[[], Iterable[str]] | str)

  • color (bool | None)

Return type:

None