rechu.command.new package¶
Subpackages¶
- rechu.command.new.step package
- Submodules
- rechu.command.new.step.base module
- rechu.command.new.step.discounts module
- rechu.command.new.step.edit module
- rechu.command.new.step.help module
- rechu.command.new.step.meta module
- rechu.command.new.step.products module
- rechu.command.new.step.quit module
- rechu.command.new.step.read module
- rechu.command.new.step.view module
- rechu.command.new.step.write module
- Module contents
Submodules¶
rechu.command.new.input module¶
Input source for new subcommand.
- class rechu.command.new.input.InputSource[source]¶
Bases:
object
Abstract base class for a typed input source.
- get_completion(text: str, state: int) str | None [source]¶
Retrieve a completion option for the current suggestions and text state. The text is a partial input that matches some part of the suggestions and state indicates the position of the suggestion in the sorted list of matching suggestions to choose.
If there is no match found or if the input source does not support completion suggestions, then None is returned.
- get_date(default: datetime | None = None) datetime [source]¶
Retrieve a date input. The default may be used as a fallback if nothing is input or if a partial timestamp is provided.
- get_input(name: str, input_type: type[InputT], options: str | None = None, default: InputT | None = None) InputT [source]¶
Retrieve an input cast to a certain type (string, integer or float). Optionally, the input source provides suggestions from a predefined completion source defined by the options name and may fall back to a default if nothing is input.
- class rechu.command.new.input.Prompt[source]¶
Bases:
InputSource
Standard input prompt.
- EXCEPTIONS: dict[type[object], tuple[type[Exception], ...]] = {<class 'rechu.types.measurable.quantity.Quantity'>: (<class 'ValueError'>, <class 'AssertionError'>)}¶
- display_matches(substitution: str, matches: Sequence[str], longest_match_length: int) None [source]¶
Write a display of matches to the standard output compatible with readline buffers.
- get_completion(text: str, state: int) str | None [source]¶
Retrieve a completion option for the current suggestions and text state. The text is a partial input that matches some part of the suggestions and state indicates the position of the suggestion in the sorted list of matching suggestions to choose.
If there is no match found or if the input source does not support completion suggestions, then None is returned.
- get_date(default: datetime | None = None) datetime [source]¶
Retrieve a date input. The default may be used as a fallback if nothing is input or if a partial timestamp is provided.
Module contents¶
Subcommand to create a new receipt YAML file and import it.
- class rechu.command.new.New[source]¶
Bases:
Base
Create a YAML file for a receipt and import it to the database.
- subparser_arguments: SubparserArguments = [(('-c', '--confirm'), {'action': 'store_true', 'default': False, 'help': 'Confirm before updating database files or exiting'}), (('-m', '--more'), {'action': 'store_true', 'default': False, 'help': 'Allow more discounts and metadata than there are products'})]¶
- subparser_keywords: SubparserKeywords = {'description': 'Interactively fill in a YAML file for a receipt and import it to the database.', 'help': 'Create receipt file and import'}¶