CLI

Module escpos.cli

This module acts as a command line interface for python-escpos. It mirrors closely the available ESCPOS commands while adding a couple extra ones for convenience.

It requires you to have a configuration file. See documentation for details.

escpos.cli.str_to_bool(string)[source]

Convert string to bool.

Used as a type in argparse so that we get back a proper bool instead of always True.

Return type:

bool

escpos.cli.print_extended_information()[source]

Print diagnostic information for bug reports.

Return type:

None

escpos.cli.generate_parser()[source]

Generate an argparse parser.

Return type:

ArgumentParser

escpos.cli.main()[source]

Handle main entry point of CLI script.

Handles loading of configuration and creating and processing of command line arguments. Called when run from a CLI.

Return type:

None

escpos.cli.demo(printer, **kwargs)[source]

Print demos.

Called when CLI is passed demo. This function uses the DEMO_FUNCTIONS dictionary.

Parameters:
  • printer (Escpos) – A printer from escpos.printer

  • kwargs – A dict with a key for each function you want to test. It’s in this format since it usually comes from argparse.

Return type:

None