bak plugin: fixed directories handling

This commit is contained in:
Roman Inflianskas 2014-08-30 15:44:48 +04:00 committed by Bruno Pinto
parent 07860bc556
commit acf3206297
2 changed files with 10 additions and 2 deletions

View File

@ -16,7 +16,7 @@ end
function __bak_name
# trim / for directories
set file (echo $argv[1] | sed 's/\/$//')
set file (echo $argv[1] | sed 's/\/*$//')
echo "$file."(date +'%Y%m%d_%H%M%S')".bak"
end
@ -30,7 +30,7 @@ function __bak
end
end
set -g __bak_re '(.*)\.[0-9]{8,8}_[0-9]{6,6}\.bak$'
set -g __bak_re '(.*)\.[0-9]{8,8}_[0-9]{6,6}\.bak\/*$'
function __is_bak
set file $argv[1]

View File

@ -72,6 +72,14 @@ function suite_bak
assert_equal (echo -e 'a' (__bak_name a) | sort) (ls | sort)
end
function test_uncp_dir_single
mkdir a
cpbak a/
rmdir a
uncpbak (ls -p)
assert_equal (echo -e 'a/' (__bak_name a)'/' | sort) (ls -p | sort)
end
function test_cp_multiple
set files (seq 4)
touch $files