-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsublsync.sh
executable file
·33 lines (27 loc) · 1.21 KB
/
sublsync.sh
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
31
32
33
#!/bin/bash
usage="$(basename "$0") <options> -- Sync ST3 user settings to || from microcosm.git/HEAD
where <options>:
-P, --pull (-f) \t sync local settings from master; append -f to disregard if ST3 is running
-U, --update \t commit updated settings to master"
if [[ ( "$1" = "-P" ) || ( "$1" = "--pull" ) ]]; then
if [[ ( -z $(pgrep -x sublime_text) ) || ( "$2" = "-f" ) ]]; then
echo "Copying ST3 package and IDE settings"
git pull origin master
cp Preferences.sublime-settings ~/.config/sublime-text-3/Packages/User/
cp Package\ Control.sublime-settings ~/.config/sublime-text-3/Packages/User/
else
echo "Close all running instances of sublime text"
fi
elif [[ ( "$1" = "-C" ) || ( "$1" = "--update" ) ]]; then
echo "Syncing local settings back to Github"
idePreferences=Preferences.sublime-settings
packageControl=Package\ Control.sublime-settings
cp ~/.config/sublime-text-3/Packages/User/${idePreferences} .
cp ~/.config/sublime-text-3/Packages/User/${packageControl} .
git add "${packageControl}" "${idePreferences}"
git commit -m "Updating ST3 user settings"
git push origin master
else
echo -e "Invalid option\n${usage}"
fi
exit