Utilities

Note

The documentation in this section is aimed at people wishing to contribute to histofile, and can be skipped if you are simply using the tool from the command line.

Convenience functions

list_entries(path)
Parameters:path (str) – Path to search
Return type:table
Returns:Matching entries

Text formatting

colourise(text, colour, bold, underline)

Generate coloured output for the terminal.

Parameters:
  • text (str) – Text to colourise
  • colour (str) – Colour to use
  • bold (bool) – Use bold output
  • underline (bool) – Use underline output
Return type:

str

Returns:

Colourised output

success(text, bold)

Standardised success message.

Parameters:
  • text (str) – Text to colourise
  • bold (bool) – Use bold output
Return type:

str

Returns:

Prettified success message

fail(text, bold)

Standardised failure message.

Parameters:
  • text (str) – Text to colourise
  • bold (bool) – Use bold output
Return type:

str

Returns:

Prettified failure message

warn(text, bold)

Standardised warning message.

Parameters:
  • text (str) – Text to colourise
  • bold (bool) – Use bold output
Return type:

str

Returns:

Prettified warning message

wrap_entry(text, width, initial_indent, subsequent_indent)

Wrap text for output

Parameters:
  • text (str) – Text to format
  • int – Width of formatted text
  • initial_indent (str) – String to indent first line with
  • subsequent_indent (str) – String to indent all but the first line with
Return type:

str

Returns:

Line wrapped text