CLI reference

The module provides a command-line interface for managing items.

You can run the commands using the items command followed by the specific subcommand:

items add "My task description" --owner "Veit"
items list
items list --owner "Veit" --state "todo"
items update 1 --owner "Veit" --summary "Update description"
items start 1
items finish 1
items delete 1
items count
items config
items version

If no subcommand is specified, the list command is executed by default.

items.cli.version()[source]

Return the version of the items application.

Returns:

The version string of the items package.

Return type:

str

items.cli.add(summary: list[str], owner: str = <typer.models.OptionInfo object>)[source]

Add an item to the database.

Parameters:
  • summary (list[str]) – The summary of the new item.

  • owner (str, optional) – The owner of the new item. Defaults to None.

items.cli.delete(item_id: int)[source]

Remove an item from the database.

Parameters:

item_id (int) – The ID of the item to delete.

Raises:

InvalidItemIdError – If no item with the given ID exists.

items.cli.list_items(owner: str = <typer.models.OptionInfo object>, state: str = <typer.models.OptionInfo object>)[source]

List items in the database, optionally filtered by owner and/or state.

Parameters:
  • owner (str, optional) – Filter items by this owner. Defaults to None.

  • state (str, optional) – Filter items by this state. Defaults to None.

items.cli.update(item_id: int, owner: str = <typer.models.OptionInfo object>, summary: list[str] = <typer.models.OptionInfo object>)[source]

Update an item in the database.

Parameters:
  • item_id (int) – The ID of the item to update.

  • owner (str, optional) – The new owner of the item. Defaults to None.

  • summary (list[str], optional) – The new summary of the item. Defaults to None.

Raises:

InvalidItemIdError – If no item with the given ID exists.

items.cli.start(item_id: int)[source]

Set an item’s state to ‘in progress’.

Parameters:

item_id (int) – The ID of the item to update.

Raises:

InvalidItemIdError – If no item with the given ID exists.

items.cli.finish(item_id: int)[source]

Set an item’s state to ‘done’.

Parameters:

item_id (int) – The ID of the item to update.

Raises:

InvalidItemIdError – If no item with the given ID exists.

items.cli.config()[source]

Return the path to the Items database.

Returns:

Path to the Items database.

Return type:

str

items.cli.count()[source]

Return the number of items in the database.

Returns:

Number of items in the database.

Return type:

int

items.cli.get_path()[source]

Determine the path to the database.

The path is determined from the environment variable ITEMS_DB_DIR. If it is not defined, $HOME/items_db is used.

Returns:

Path to the database directory.

Return type:

pathlib.Path

items.cli.items_db()[source]

Open and close the database connection.

Yields:

ItemsDB – An ItemsDB instance connected to the database.