forked from jkubrynski/settings-keeper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfiles.fish
30 lines (28 loc) · 917 Bytes
/
files.fish
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
set script_dir $PWD/configs
function createlinks
echo "Processing \"$argv\""
for file in (ls -A $argv)
set -l current_file_path $argv/$file
set -l current_file_stripped (echo $current_file_path | sed 's|'$script_dir/'||g')
if not test -e ~/$current_file_stripped
echo "Creating ~/$current_file_stripped"
ln -s $current_file_path ~/$current_file_stripped
else if test -d $argv/$file
echo "\"$current_file_stripped\" already exists - going deeper"
createlinks $current_file_path
end
end
end
switch (echo $argv)
case store
echo "storing..."
git add -A configs
set -l now (date +"%Y-%m-%d %H:%M")
git commit -m "Changes from $now"
git push origin master
case load
echo "loading..."
createlinks $script_dir
case '*'
echo "Usage: fish files.fish store or fish files.fish load"
end