From b2549c2005b4d1534a0c4041cf16381b075c5c2b Mon Sep 17 00:00:00 2001 From: Justin Hileman <justin@justinhileman.info> Date: Sun, 31 May 2015 08:30:48 -0700 Subject: [PATCH] [split] Move bak plugin to oh-my-fish/plugin-bak https://github.com/oh-my-fish/plugin-bak --- plugins/bak/bak.load | 60 ---------------------------------------- plugins/bak/cpbak.fish | 6 ---- plugins/bak/mvbak.fish | 6 ---- plugins/bak/uncpbak.fish | 6 ---- plugins/bak/unmvbak.fish | 6 ---- 5 files changed, 84 deletions(-) delete mode 100644 plugins/bak/bak.load delete mode 100644 plugins/bak/cpbak.fish delete mode 100644 plugins/bak/mvbak.fish delete mode 100644 plugins/bak/uncpbak.fish delete mode 100644 plugins/bak/unmvbak.fish diff --git a/plugins/bak/bak.load b/plugins/bak/bak.load deleted file mode 100644 index a1e6a15..0000000 --- a/plugins/bak/bak.load +++ /dev/null @@ -1,60 +0,0 @@ -function __bak_help - echo -e \ -"Usage: - $argv[1] SOURCE..." -end - -function __bak_parse_help - if [ (count $argv) -lt 3 ] - __bak_help $argv[1] - else - return 1 - end -end - -function __bak_name - # trim / for directories - set file (echo $argv[1] | sed 's/\/*$//') - echo "$file."(date +'%Y%m%d_%H%M%S')".bak" -end - -function __bak - __bak_parse_help $argv - or begin - set program $argv[2] - for file in $argv[3..-1] - eval $program $file (__bak_name $file) - end - end -end - -set -g __bak_re '(.*)\.[0-9]{8,8}_[0-9]{6,6}\.bak\/*$' - -function __is_bak - set file $argv[1] - echo "$file" | grep -Eq $__bak_re -end - -function __bak_normalized - set file $argv[1] - echo "$file" | sed -E "s/$__bak_re/\1/g" -end - -function __unbak - __bak_parse_help $argv - or begin - set program $argv[2] - for file in $argv[3..-1] - set normalized (__bak_normalized $file) - if test ! -e $file - echo "File \"$file\" not exists! Cannot unbak \"$file\"." - else if not __is_bak $file - echo "File \"$file\" don't meet bak files convention! Cannot unbak \"$file\"." - else if test -e $normalized - echo "File \"$normalized\" exists! Cannot unbak \"$file\"." - else - eval $program $file $normalized - end - end - end -end diff --git a/plugins/bak/cpbak.fish b/plugins/bak/cpbak.fish deleted file mode 100644 index 1e6d4a4..0000000 --- a/plugins/bak/cpbak.fish +++ /dev/null @@ -1,6 +0,0 @@ -# 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 --description 'Copy files to make a backup copies' - __bak cpbak 'cp -a' $argv -end diff --git a/plugins/bak/mvbak.fish b/plugins/bak/mvbak.fish deleted file mode 100644 index 41eda59..0000000 --- a/plugins/bak/mvbak.fish +++ /dev/null @@ -1,6 +0,0 @@ -# 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 --description 'Rename files to make a backup copies' - __bak mvbak mv $argv -end diff --git a/plugins/bak/uncpbak.fish b/plugins/bak/uncpbak.fish deleted file mode 100644 index 984fad7..0000000 --- a/plugins/bak/uncpbak.fish +++ /dev/null @@ -1,6 +0,0 @@ -# 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 --description 'Copy files to revert a backup copies to a normal files' - __unbak uncpbak 'cp -a' $argv -end diff --git a/plugins/bak/unmvbak.fish b/plugins/bak/unmvbak.fish deleted file mode 100644 index 813e92d..0000000 --- a/plugins/bak/unmvbak.fish +++ /dev/null @@ -1,6 +0,0 @@ -# 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 --description 'Move files to revert a backup copies to a normal files' - __unbak unmvbak mv $argv -end -- GitLab