mirror of
https://github.com/oh-my-fish/oh-my-fish
synced 2024-11-03 15:40:32 +00:00
bak plugin: fixed directories handling
This commit is contained in:
parent
07860bc556
commit
acf3206297
@ -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]
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user