mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2024-11-21 20:08:48 +00:00
Resurrect file prefix and extension vars
This commit is contained in:
parent
9d81e8d026
commit
fe8390a578
@ -2,6 +2,8 @@ default_resurrect_dir="$HOME/.tmux/resurrect"
|
||||
resurrect_dir_option="@resurrect-dir"
|
||||
|
||||
SUPPORTED_VERSION="1.9"
|
||||
RESURRECT_FILE_PREFIX="tmux_resurrect"
|
||||
RESURRECT_FILE_EXTENSION="txt"
|
||||
_RESURRECT_DIR=""
|
||||
_RESURRECT_FILE_PATH=""
|
||||
|
||||
@ -111,7 +113,7 @@ _RESURRECT_DIR="$(resurrect_dir)"
|
||||
resurrect_file_path() {
|
||||
if [ -z "$_RESURRECT_FILE_PATH" ]; then
|
||||
local timestamp="$(date +"%Y-%m-%dT%H:%M:%S")"
|
||||
echo "$(resurrect_dir)/tmux_resurrect_${timestamp}.txt"
|
||||
echo "$(resurrect_dir)/${RESURRECT_FILE_PREFIX}_${timestamp}.${RESURRECT_FILE_EXTENSION}"
|
||||
else
|
||||
echo "$_RESURRECT_FILE_PATH"
|
||||
fi
|
||||
|
@ -281,7 +281,7 @@ dump_shell_history() {
|
||||
remove_old_backups() {
|
||||
# remove backup files older than 30 days, but keep at least 5 copies of backup.
|
||||
local -a files
|
||||
files=($(ls -t $(resurrect_dir)/*.txt | tail -n +6))
|
||||
files=($(ls -t $(resurrect_dir)/${RESURRECT_FILE_PREFIX}_*.${RESURRECT_FILE_EXTENSION} | tail -n +6))
|
||||
[[ ${#files[@]} -eq 0 ]] || find "${files[@]}" -type f -mtime +30 -delete
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user