simplify example.sh, thanks emg for the suggestion! - stagit-gopher - A git gopher frontend. (mirror)
HTML git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
DIR LICENSE
---
DIR commit de7f5fc76dedf8c4f178226a920837d2476ed493
DIR parent e19351cdb8805ed2c5a130c01742167183d7435c
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 15 Sep 2016 20:44:47 +0200
simplify example.sh, thanks emg for the suggestion!
Diffstat:
M example.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
DIR diff --git a/example.sh b/example.sh
@@ -12,16 +12,16 @@
# - mkdir -p htmldir && cd htmldir
# - sh example.sh
+# path must be absolute.
reposdir="/var/www/domains/git.codemadness.nl/home/src"
curdir=$(pwd)
# make index.
-cd "${reposdir}"
-find . -maxdepth 1 -type d | grep -v "^.$" | sort | xargs stagit-index > "${curdir}/index.html"
+stagit-index "${reposdir}/"*/ > "${curdir}/index.html"
# make files per repo.
-cd "${reposdir}"
-find . -maxdepth 1 -type d | grep -v "^.$" | sort | while read -r dir; do
+for dir in "${reposdir}/"*/; do
+ # strip .git suffix.
r=$(basename "${dir}")
d=$(basename "${dir}" ".git")
printf "%s... " "${d}"