stagit

improve example, remove sort hack

Hiltjo Posthuma contact@arjunchoudhary.com

commit: 7e0f926 parent: 9176b2a
1 files changed, 4 insertions(+), 17 deletions(-)
Mexample.sh+4-17
M · example.sh +4, -17
 1@@ -17,26 +17,13 @@ curdir=$(pwd)
 2 
 3 # make index.
 4 cd "${reposdir}"
 5-find . -maxdepth 1 -type d | grep -v "^.$" | sort | xargs stagit-index |
 6-        sed 's@<td>Last commit</td>@<td><a href="index-time.html">Last commit</a></td>@g' | \
 7-        sed 's@<td>Name</td>@<td><a href="index.html">Name</a></td>@g' > "${curdir}/index.html"
 8-
 9-# make index (sort by last commit author time).
10-find . -maxdepth 1 -type d | grep -v "^.$" | while read -r dir; do
11-	d=$(basename "${dir}")
12-	cd "${reposdir}/${d}"
13-	timestamp=$(git show -s --pretty="format:%at" || true)
14-
15-	printf "%d %s\n" "${timestamp}" "${d}"
16-done | sort -n -k 1 | cut -f 2- -d ' ' | xargs stagit-index | \
17-	sed 's@<td>Last commit</td>@<td><a href="index-time.html">Last commit</a></td>@g' | \
18-	sed 's@<td>Name</td>@<td><a href="index.html">Name</a></td>@g' > "${curdir}/index-time.html"
19+find . -maxdepth 1 -type d | grep -v "^.$" | xargs stagit-index > "${curdir}/index.html"
20 
21 # make files per repo.
22 cd "${reposdir}"
23-find . -maxdepth 1 -type d | grep -v "^.$" | sort | while read -r dir; do
24+find . -maxdepth 1 -type d | grep -v "^.$" | while read -r dir; do
25 	d=$(basename "${dir}")
26-	printf "%s..." "${d}"
27+	printf "%s... " "${d}"
28 
29 	mkdir -p "${curdir}/${d}"
30 	cd "${curdir}/${d}"
31@@ -48,5 +35,5 @@ find . -maxdepth 1 -type d | grep -v "^.$" | sort | while read -r dir; do
32 	ln -sf ../logo.png logo.png
33 	ln -sf ../favicon.png favicon.png
34 
35-	printf " done\n"
36+	printf "done\n"
37 done