-
Notifications
You must be signed in to change notification settings - Fork 0
/
gnostr-patch
executable file
·94 lines (72 loc) · 2.06 KB
/
gnostr-patch
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env bash
declare REPO
REPO=$(pwd | grep -o '[^/]*$')
mkdir -p $REPO
declare BRANCH
BRANCH=$(git branch --show-current)
declare UTC_SECS
UTC_SECS=$(date +%s)
declare REMOTE_PATH
REMOTE_PATH=$REPO/$BRANCH/$UTC_SECS
echo $REMOTE_PATH;
declare FILES
declare PATCHES
## examples:
## ./patch.demo.sh | jq .[0].contents | jq .[0].contents | jq .[].name
## ./patch.demo.sh | jq -c
##
## tree -aC -I '' --dirsfirst "$@" | less -FRNX;
## tree -aC -I '' --dirsfirst "$@";
## tree -faCR -I '' --dirsfirst .gnostr | tr -d "|--" | tr -d "\`"
function gnostr-tree(){
FILES=$(tree --noreport -faCRJ -I '.DS_Store' --dirsfirst .gnostr | tr -d "|--" | tr -d "\`")
## echo $FILES
for f in $FILES; do
[ -L "${f%/}" ] && continue
echo $f;
done
}
function gnostr-patches(){
PATCHES=$(ls .gnostr/patches/*.json)
}
## for d in .*/ ; do
## [ -L "${d%/}" ] && continue
## echo "$d"
## done
for td in .gnostr/ ; do
[ -L "${td%/}" ] && continue
for d in $td ; do
[ -L "${d%/}" ] && continue
gnostr-patches
for f in $PATCHES; do
echo "git remote add $REMOTE_PATH $PWD/$REMOTE_PATH"
# exit
git clone . .gnostr/$REMOTE_PATH
git remote add $REMOTE_PATH .gnostr/$REMOTE_PATH
cat $f | jq -rM .content
cat $f | jq -rM .content >/tmp/gnostr-patch.log
git apply --allow-empty <(cat $f)
## -m "$(date +%s)/$(pwd | grep -o '[^/]*$')/$(git branch --show-current)" | \
gnostr-legit . \
-p 00000 \
-m "$REPO_PATH" | \
gnostr-cat -u wss://relay.damus.io | \
$(grep 'OK') || echo "working..."
done
done
done
## function gnostr-git-apply(){
##
## gnostr-git apply \
## --ignore-whitespace \
## --ignore-space-change \
## --allow-empty \
## --allow-overlap -Nv \
## --inaccurate-eof \
## --reverse \
## --recount \
## --cached \
## --exclude README.md \
## --exclude .gnostr/config.json \
## <(cat .gnostr/patches/* | jq -rM .content)
## }