From fb3bd1056eda01609f54b7d2c7d35efe5b01d5d9 Mon Sep 17 00:00:00 2001 From: John D Pell Date: Sat, 11 Sep 2021 22:06:03 -0700 Subject: [PATCH] lib/helpers: new functions `_bash_it_history_auto_*()` Two new functions `_bash_it_history_auto_save()` and `_bash_it_history_auto_load()`, which append new history to disk and load new history from disk, respectively. See bash-it/bash-it#1595 for discussion. --- lib/helpers.bash | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/helpers.bash b/lib/helpers.bash index 02ec94a595..2930a5d251 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -954,6 +954,12 @@ function safe_append_preexec { fi } +function _save-and-reload-history() +{ + [[ ${autosave:-${HISTORY_AUTOSAVE:-0}} -eq 1 ]] && local HISTCONTROL="${HISTCONTROL:-}${HISTCONTROL:+:}autoshare" + _bash_it_history_auto_save && _bash_it_history_auto_load +} + function _bash_it_history_auto_save() { case $HISTCONTROL in