Skip to content

Commit e84767f

Browse files
committed
first commit
0 parents  commit e84767f

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

.dat

Whitespace-only changes.

gchan.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
function get_thread_name() {
4+
return $(git rev-parse --abbrev-ref HEAD)
5+
}
6+
7+
function append_last_dat() {
8+
local SEP="<>"
9+
10+
local name=$(git log -1 --format=%cn)
11+
local email=$(git log -1 --format=%ce)
12+
local timestamp=$(git log -1 --format=%cd)
13+
local response=$(git log -1 --format=%s)
14+
local thread=$1
15+
16+
dat_line="${name}${SEP}${email}${SEP}${timestamp}${SEP}${response}${SEP}${thread}"
17+
echo $dat_line >> "${title}.dat"
18+
}
19+
20+
function create_last_dat() {
21+
local thread=$1
22+
23+
touch "${title}.dat" && append_dat "$title"
24+
}
25+
26+
function update_last_dat() {
27+
local thread=$(get_thread_name)
28+
29+
if [[ -f "${thread}.dat" ]]; then
30+
append_last_dat
31+
else
32+
create_last_dat thread
33+
fi
34+
}
35+
36+
op=$1
37+
message=$2
38+
39+
update_last_dat
40+
41+
case $op in
42+
"r" | "response" )
43+
git add -A && git commit -m "$message" ;;
44+
"b" | "boards" )
45+
git fetch && git branch -a ;;
46+
"c" | "create" )
47+
git checkout -b $2 ;;
48+
"p" | "post" )
49+
git checkout -b $2 && git commit -m "$3" ;;
50+
"s" | "show" )
51+
git checkout $2 && git pull && git log ;;
52+
esac
53+

0 commit comments

Comments
 (0)