Browse Source

Add home directory support to dotfiles.sh get

master
Riyyi 7 years ago
parent
commit
f09fb07c1f
  1. 1
      .config/i3/config
  2. 13
      dotfiles.sh

1
.config/i3/config

@ -131,6 +131,7 @@ bindsym $mod+Shift+0 move container to workspace 10
assign [class="Firefox"] $workspace1
assign [class="Chromium"] $workspace1
assign [class="Gedit"] $workspace2
assign [class="URxvt"] $workspace3
assign [class="Thunar"] $workspace4

13
dotfiles.sh

@ -40,8 +40,17 @@ elif [ "$1" == "list" ]; then
elif [ "$1" == "get" ] && [ "$2" != "" ]; then
FILE=$(readlink -f $2)
mkdir -p $(pwd)/$(dirname $FILE)
cp $FILE $(pwd)/$FILE
FILE_CUT_HOME="$(echo $FILE | sed -nr 's/^\/home\/'$USER'\/(.*)$/\1/p')"
# /home/<user>/
if [ -n "$FILE_CUT_HOME" ]; then
mkdir -p $(pwd)/$(dirname $FILE_CUT_HOME)
cp $FILE $(pwd)/$FILE_CUT_HOME
# /
else
mkdir -p $(pwd)/$(dirname $FILE)
cp $FILE $(pwd)/$FILE
fi
elif [ "$1" == "pull" ] || [ "$1" == "push" ]; then
for f in $FILES; do

Loading…
Cancel
Save