Commit 07860bc5 authored by Roman Inflianskas's avatar Roman Inflianskas Committed by Bruno Pinto

bak plugin: tabs -> spaces

parent 5b861f5c
......@@ -4,6 +4,16 @@ function __bak_help
$argv[1] SOURCE..."
end
function __bak_parse_help
function has_help_arg
# non implemented
end
if [ (count $argv) -lt 3 ]; or has_help_arg $argv
__bak_help $argv[1]
end
end
function __bak_name
# trim / for directories
set file (echo $argv[1] | sed 's/\/$//')
......@@ -11,13 +21,12 @@ function __bak_name
end
function __bak
__bak_parse_help $argv
or begin
set program $argv[2]
if [ (count $argv) -gt 2 ]
for file in $argv[3..-1]
eval $program $file (__bak_name $file)
end
else
__bak_help $argv[1]
end
end
......@@ -34,8 +43,9 @@ function __bak_normalized
end
function __unbak
__bak_parse_help $argv
or begin
set program $argv[2]
if [ (count $argv) -gt 2 ]
for file in $argv[3..-1]
set normalized (__bak_normalized $file)
if test ! -e $file
......@@ -48,7 +58,5 @@ function __unbak
eval $program $file $normalized
end
end
else
__bak_help $argv[1]
end
end
# 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
function cpbak --description 'Copy files to make a backup copies'
__bak cpbak 'cp -a' $argv
end
# 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
function mvbak --description 'Rename files to make a backup copies'
__bak mvbak mv $argv
end
function suite_bak
function setup
return 0
return 0
end
function teardown
......
# Function to copy files and directories (a.txt.20140608_195859.bak copy to a.txt)
# (c) Roman Inflianskas (rominf) <infroma@gmail.com>, 2014
function uncpbak
function uncpbak --description 'Copy files to revert a backup copies to a normal files'
__unbak uncpbak 'cp -a' $argv
end
# Function to move files and directories (a.txt.20140608_195859.bak move to a.txt)
# (c) Roman Inflianskas (rominf) <infroma@gmail.com>, 2014
function unmvbak
function unmvbak --description 'Move files to revert a backup copies to a normal files'
__unbak unmvbak mv $argv
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment