Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
oh-my-fish
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
oh-my-fish
Commits
b2549c20
Commit
b2549c20
authored
May 31, 2015
by
Justin Hileman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[split] Move bak plugin to oh-my-fish/plugin-bak
https://github.com/oh-my-fish/plugin-bak
parent
a90b4814
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
0 additions
and
84 deletions
+0
-84
plugins/bak/bak.load
plugins/bak/bak.load
+0
-60
plugins/bak/cpbak.fish
plugins/bak/cpbak.fish
+0
-6
plugins/bak/mvbak.fish
plugins/bak/mvbak.fish
+0
-6
plugins/bak/uncpbak.fish
plugins/bak/uncpbak.fish
+0
-6
plugins/bak/unmvbak.fish
plugins/bak/unmvbak.fish
+0
-6
No files found.
plugins/bak/bak.load
deleted
100644 → 0
View file @
a90b4814
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
plugins/bak/cpbak.fish
deleted
100644 → 0
View file @
a90b4814
# 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
plugins/bak/mvbak.fish
deleted
100644 → 0
View file @
a90b4814
# 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
plugins/bak/uncpbak.fish
deleted
100644 → 0
View file @
a90b4814
# 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
plugins/bak/unmvbak.fish
deleted
100644 → 0
View file @
a90b4814
# 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment