plectrum.application

class plectrum.application.AbstractSelectApplication(items, message=None, validator=None)[source]

Bases: prompt_toolkit.application.Application

Provide interactive selection of items.

__init__(items, message=None, validator=None)[source]

Initialise application.

items should be a list of items that can be selected from. message should be a string to display ahead of the selection (to instruct the user for example).

validator should be an optional callable with signature (items, selection). It should be called when the selection is confirmed and is expected to return a list of validation errors found. If the returned list is empty then the selection is approved and confirmation continues. Otherwise the errors are displayed to the user and confirmation prevented.

class plectrum.application.SingleSelectApplication(items, message=None, validator=None)[source]

Bases: plectrum.application.AbstractSelectApplication

Provide interactive selection of single item.

class plectrum.application.MultiSelectApplication(items, message=None, validator=None)[source]

Bases: plectrum.application.AbstractSelectApplication

Provide interactive selection of multple items.