-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathsnippets.sh
More file actions
executable file
·53 lines (48 loc) · 1.14 KB
/
Copy pathsnippets.sh
File metadata and controls
executable file
·53 lines (48 loc) · 1.14 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
set -e
GitRoot="`dirname \"$0\"`"
Prefix="sst_"
SnippetsDir="${HOME}/Library/Developer/Xcode/UserData/CodeSnippets"
if [ ! -d "${SnippetsDir}" ]; then
mkdir -p "${SnippetsDir}"
fi
case "$1" in
update)
echo Updating...
pushd .
cd ${GitRoot}
git pull
cp ${Prefix}*.codesnippet "${SnippetsDir}"
popd
;;
list)
echo Listing...
ls "${SnippetsDir}"/${Prefix}*.codesnippet
;;
find)
echo Finding...
ls "${SnippetsDir}/*.codesnippet" | grep -v ${Prefix}
;;
import)
echo Importing...
pushd .
cd ${GitRoot}
cp "${SnippetsDir}/${Prefix}*.codesnippet" .
./bin/snippetimporter "${SnippetsDir}" . ${Prefix}
popd
;;
export)
echo Exporting...
cp ${GitRoot}/${Prefix}*.codesnippet "${SnippetsDir}"
;;
clear)
echo Clearing...
pushd .
cd ${GitRoot}
rm "${SnippetsDir}/${Prefix}*.codesnippet"
popd
;;
*)
echo "Usage: `basename $0` { update | list | find | import | export | clear }"
;;
esac