From b99d088621cfead8f47e063cb23ed5e5cf89b34c 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 e570f91269..39778b4ab1 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