Skip to content

Commit

Permalink
lib/helpers: new functions _bash_it_history_auto_*()
Browse files Browse the repository at this point in the history
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#1595 for discussion.
  • Loading branch information
gaelicWizard committed Sep 12, 2021
1 parent 7612a3f commit b99d088
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b99d088

Please sign in to comment.