From 8684d4592bb0dd3565e19895fad2e98be388fa33 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Fri, 17 Oct 2014 22:33:29 +0200 Subject: [PATCH] Flag gate the bash history restore feature --- scripts/helpers.sh | 5 +++++ scripts/restore.sh | 4 +++- scripts/save.sh | 4 +++- scripts/variables.sh | 2 ++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/helpers.sh b/scripts/helpers.sh index 16d8090..1cb9fd1 100644 --- a/scripts/helpers.sh +++ b/scripts/helpers.sh @@ -49,6 +49,11 @@ remove_first_char() { echo "$1" | cut -c2- } +save_bash_history_option_on() { + local option="$(get_tmux_option "$bash_history_option" "off")" + [ "$option" == "on" ] +} + # path helpers resurrect_dir() { diff --git a/scripts/restore.sh b/scripts/restore.sh index 5c714ca..6dd1707 100755 --- a/scripts/restore.sh +++ b/scripts/restore.sh @@ -211,7 +211,9 @@ main() { start_spinner "Restoring..." "Tmux restore complete!" restore_all_panes restore_pane_layout_for_each_window >/dev/null 2>&1 - restore_shell_history + if save_bash_history_option_on; then + restore_shell_history + fi restore_all_pane_processes # below functions restore exact cursor positions restore_active_pane_for_each_window diff --git a/scripts/save.sh b/scripts/save.sh index a458385..07e3d29 100755 --- a/scripts/save.sh +++ b/scripts/save.sh @@ -129,7 +129,9 @@ save_all() { dump_windows >> $resurrect_file_path dump_state >> $resurrect_file_path ln -fs "$resurrect_file_path" "$(last_resurrect_file)" - dump_bash_history + if save_bash_history_option_on; then + dump_bash_history + fi } main() { diff --git a/scripts/variables.sh b/scripts/variables.sh index 8f451c4..f6fc88b 100644 --- a/scripts/variables.sh +++ b/scripts/variables.sh @@ -26,3 +26,5 @@ inline_strategy_token="->" save_command_strategy_option="@resurrect-save-command-strategy" default_save_command_strategy="ps" + +bash_history_option="@resurrect-save-bash-history"