geotribu_cli.history module

Store and load CLI history.

class geotribu_cli.history.CliHistory

Bases : object

Module to manipulate CLI history.

HISTORY_FOLDER_PATH: Path = PosixPath('/home/runner/.geotribu/history')
__init__()

Module instanciation.

dump(cmd_name, results_to_dump, request_performed='', key_field='url')

Dump history.

Paramètres:
  • cmd_name (str) – name of the command to save from. Used to customize file name.

  • results_to_dump (list[dict]) – list of results (dict) to dump

  • request_performed (str) – operation performed (search term, etc.). Defaults to « « .

  • key_field (str, optional) – key in results matching the uri (path, url…). Defaults to « url ».

load(cmd_name=None, result_index=-1)

Load from history.

Paramètres:
  • cmd_name (str, optional) – load history from specific command. If not specified, the latest modified history file is used. Defaults to None.

  • result_index (int, optional) – result index to return (index 1). Defaults to -1. If <0, a random integer is used.

Renvoie:

line value from history

Type renvoyé:

str