mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-02-17 20:45:03 +08:00
bak plugin: bak renamed to mvbak, cpbak added
This commit is contained in:
parent
7258977424
commit
33b5d64e7f
|
@ -1,10 +0,0 @@
|
|||
# Function to rename files and directories (a.txt -> a.txt.20140608_195859.bak)
|
||||
# (c) Roman Inflianskas (rominf) <infroma@gmail.com>, 2014
|
||||
|
||||
function bak
|
||||
for arg in $argv
|
||||
# trim / for directories
|
||||
set arg (echo $arg | sed "s/\///")
|
||||
mv $arg $arg.(date +"%Y%m%d_%H%M%S").bak
|
||||
end
|
||||
end
|
12
plugins/bak/bak.load
Normal file
12
plugins/bak/bak.load
Normal file
|
@ -0,0 +1,12 @@
|
|||
function __bak_name
|
||||
# trim / for directories
|
||||
set arg (echo $argv[1] | sed "s/\///")
|
||||
echo "$arg.(date +"%Y%m%d_%H%M%S").bak"
|
||||
end
|
||||
|
||||
function __bak
|
||||
set program $argv[1]
|
||||
for arg in $argv[2..-1]
|
||||
eval $program $arg (__bak_name $arg)
|
||||
end
|
||||
end
|
6
plugins/bak/cpbak.fish
Normal file
6
plugins/bak/cpbak.fish
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Function to copy files and directories (a.txt copy to a.txt.20140608_195859.bak)
|
||||
# (c) Roman Inflianskas (rominf) <infroma@gmail.com>, 2014
|
||||
|
||||
function cpbak
|
||||
__bak cp $argv
|
||||
end
|
6
plugins/bak/mvbak.fish
Normal file
6
plugins/bak/mvbak.fish
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Function to rename files and directories (a.txt rename to a.txt.20140608_195859.bak)
|
||||
# (c) Roman Inflianskas (rominf) <infroma@gmail.com>, 2014
|
||||
|
||||
function mvbak
|
||||
__bak mv $argv
|
||||
end
|
Loading…
Reference in New Issue
Block a user