hermes.commands.init.slim_click

Slim, self-made version of click so we don’t need to use it for simple console questions.

Attributes

PRINT_DEBUG

If this is true, echo() will print texts with debug=True.

current_steps

max_steps

USE_FANCY_HYPERLINKS

If true links will be hidden in the console. Not all consoles support this however.

Classes

Formats

Generic enumeration.

Functions

echo(text[, debug, formatting])

param text:

The printed text.

debug_info(*args, **kwargs)

confirm(→ bool)

The user gets to decide between yes (y) and no (n). The answer will be returned as bool.

answer(→ str)

Returns the user's response to the given text. It is just a wrapper for input().

press_enter_to_continue(→ None)

choose(→ int)

The user gets to make a choice between predefined answers.

headline(text)

next_step(description)

create_console_hyperlink(→ str)

Use this to have a consistent display of hyperlinks.

Module Contents

hermes.commands.init.slim_click.PRINT_DEBUG = False

If this is true, echo() will print texts with debug=True.

class hermes.commands.init.slim_click.Formats

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

HEADER = '\x1b[95m'
OKBLUE = '\x1b[94m'
OKCYAN = '\x1b[96m'
OKGREEN = '\x1b[92m'
WARNING = '\x1b[93m'
FAIL = '\x1b[91m'
ENDC = '\x1b[0m'
BOLD = '\x1b[1m'
UNDERLINE = '\x1b[4m'
EMPTY = ''
__add__(other)
get_ansi() str
hermes.commands.init.slim_click.echo(text: str, debug: bool = False, formatting: Formats = Formats.EMPTY)
Parameters:
  • text – The printed text.

  • debug – If debug, the text will only be printed when slim_click.PRINT_DEBUG is true.

  • formatting – You can use the Formats Enum to give the text a special color or formatting.

hermes.commands.init.slim_click.debug_info(*args, **kwargs)
hermes.commands.init.slim_click.confirm(text: str, default: bool = True) bool

The user gets to decide between yes (y) and no (n). The answer will be returned as bool.

hermes.commands.init.slim_click.answer(text: str) str

Returns the user’s response to the given text. It is just a wrapper for input().

hermes.commands.init.slim_click.press_enter_to_continue(text: str = 'Press ENTER to continue') None
hermes.commands.init.slim_click.choose(text: str, options: list[str], default: int = 0) int

The user gets to make a choice between predefined answers.

Parameters:
  • text – Displayed text / question

  • options – List with possible answers

  • default – Selected answer (index) if the user doesn’t enter anything

Returns:

The index of the selected option

hermes.commands.init.slim_click.headline(text: str)
hermes.commands.init.slim_click.current_steps = 0
hermes.commands.init.slim_click.max_steps = 0
hermes.commands.init.slim_click.next_step(description: str)

If true links will be hidden in the console. Not all consoles support this however.

Use this to have a consistent display of hyperlinks.