gitmopy.history =============== .. py:module:: gitmopy.history .. autoapi-nested-parse:: User history management. In particular: * sort emojis by timestamp * prepare history for prompt completion (title, scope, message) Module Contents --------------- .. py:function:: gitmojis_setup() Setup the emoji list. * loads the config * adds ``name`` and ``value`` keys to each emoji (for prompt Choices) * loads the history (if enabled) * sorts the emojis by most recent usage in history (if enabled) .. py:function:: load_history() Load history from ``${HISTORY_PATH}`` file. Returns an empty list if the file does not exist. .. py:function:: save_to_history(commit_dict) Writes a commit dictionnary to the history file in ``${HISTORY_PATH}``. :param commit_dict: The commit details to write to the history file. Keys must be "emoji", "scope", "title" and "message". A "timestamp" key will be added automatically. :type commit_dict: dict :param history: History to append to. Will use the global one if ``None``. Defaults to ``None``. :type history: list, optional .. py:function:: sort_emojis_by_timestamp() Sort emojis by most recent usage in history. :param gitmojis: All gitmojis available as a list of dicts. :type gitmojis: list :param history: History to sort from. Will use the global one if ``None``. Defaults to ``None``. :type history: list, optional :returns: Sorted gitmojis. :rtype: List[Dict[str, str]] .. py:function:: timestamp() Get the current local timestamp as an int. :returns: Current timestamp. :rtype: int