-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive.sh
executable file
·40 lines (27 loc) · 1.11 KB
/
archive.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
34
35
36
37
38
39
40
#!/bin/zsh
BRANCH=master # Default
BRANCH=$(git branch --show-current)
mkdir .sharing
rm -rf .sharing/archiveBuffer .sharing/archiveWikiBuffer
git clone --depth 1 https://github.com/ChippyPlus/micro-vm.wiki.git .sharing/archiveWikiBuffer
git clone -b "$BRANCH" --depth 1 https://github.com/ChippyPlus/micro-vm.git .sharing/archiveBuffer
rm -rf .sharing/archiveWikiBuffer/.git .sharing/archiveBuffer/.git .sharing/archiveBuffer/archive.sh .sharing/archiveBuffer/gradle .sharing/archiveBuffer/.idea .sharing/archiveBuffer/debug
find .sharing/archiveBuffer > .sharing/archiveOutBuffer.txt
find .sharing/archiveWikiBuffer >> .sharing/archiveOutBuffer.txt
files=""
while IFS= read -r i; do
i=${i%$'\n'}
ext=""
case "$i" in
*.kt) ext="kotlin" ;;
*.md) ext="markdown" ;;
*.sh) ext="shell" ;;
*.json) ext="json" ;;
*.kar) ext="custom assembly" ;;
esac
echo "$i"
if [[ -n "$ext" ]]; then
files+=$'\nfilePath '$i$'\n```'$ext$'\n'$(cat "$i")$'\n-------------------------------\n```'
fi
done < .sharing/archiveOutBuffer.txt
echo "$files" > share.txt