]> Git in Space - ssg/blob - lib/core.sh
Add $FILE feature and remove test files
[ssg] / lib / core.sh
1 function include() { # include a file
2 # include FILE
3 cat "$1"
4 }
5
6 function index() { # index current directory
7 for f in .. ./* ; do
8 name="$(basename "$f")"
9 [[ "$(stat -c %F "$f")" == "directory" ]] && name+='/'
10 printf "%s <a href=\"%s\">%s</a>%$((34 - ${#name}))s %-17s %16s<br/>" \
11 "$(stat -c %A "$f")" \
12 "$name" "$name" "" \
13 "$(date '+%d-%m-%Y %H:%M' -d "@$(stat -c %Y "$f")")" \
14 "$(stat -c %s "$f")"
15 done
16 }
17
18 function indexh() { # index with header
19 printf "<b>---------- %-34s %-17s %16s</b><br/>" "name" "date" "size"
20 index
21 }
22
23 function git-history() {
24 git log --follow --format='%h %ad: %s<br/>' \
25 --date='format:%d-%m-%Y' "$FILE" \
26 | tr -d "\n"
27 }