lib/history: 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.
This commit is contained in:
John D Pell
2022-01-24 21:37:04 -08:00
parent f6119567e8
commit 5d5858058e
4 changed files with 57 additions and 7 deletions

View File

@@ -584,6 +584,7 @@ function aws_profile {
}
function _save-and-reload-history() {
local autosave=${1:-0}
[[ $autosave -eq 1 ]] && history -a && history -c && history -r
local autosave="${1:-${HISTORY_AUTOSAVE:-0}}"
[[ ${autosave} -eq 1 ]] && local HISTCONTROL="${HISTCONTROL:-}${HISTCONTROL:+:}autoshare"
_bash-it-history-auto-save && _bash-it-history-auto-load
}