gitmopy.history
User history management.
In particular:
* sort emojis by timestamp
* prepare history for prompt completion (title, scope, message)
Module Contents
-
gitmopy.history.gitmojis_setup()[source]
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)
- Return type:
None
-
gitmopy.history.load_history()[source]
Load history from ${HISTORY_PATH} file.
Returns an empty list if the file does not exist.
- Return type:
List[Dict[str, str]]
-
gitmopy.history.save_to_history(commit_dict)[source]
Writes a commit dictionnary to the history file in ${HISTORY_PATH}.
- Parameters:
commit_dict (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.
history (list, optional) – History to append to. Will use the global one if
None. Defaults to None.
- Return type:
None
-
gitmopy.history.sort_emojis_by_timestamp()[source]
Sort emojis by most recent usage in history.
- Parameters:
gitmojis (list) – All gitmojis available as a list of dicts.
history (list, optional) – History to sort from. Will use the global one if
None. Defaults to None.
- Returns:
Sorted gitmojis.
- Return type:
List[Dict[str, str]]
-
gitmopy.history.timestamp()[source]
Get the current local timestamp as an int.
- Returns:
Current timestamp.
- Return type:
int