mirror of
				https://github.com/tmux-plugins/tmux-resurrect.git
				synced 2025-11-04 00:46:04 +00:00 
			
		
		
		
	Resurrect file prefix and extension vars
This commit is contained in:
		@@ -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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user