3 # my projects all have README or --help with a short single line
4 # description which I parse and put into the gitweb description.
6 # If it's a repo with just a single bash script or *-function script,
7 # then call it with --help, grap the 2nd line.
8 # else, parse the readme, find the first non blank, not starting with [#*],
12 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
15 echo "need gitroot arg"
25 while read -r line
; do
26 [[ $line ]] ||
continue
27 if echo "$line" |
grep "^ *[#*]" &>/dev
/null
; then
30 echo "$line" > .git
/description
36 for d
in $gitroot/*; do
37 if [[ -d $d && ! -L $d ]]; then
46 gitweb-descriptions
() {
47 for d
in ${dirs[@]}; do
52 f
=(!(LICENSE|COPYING|README|.git
))
54 if [[ ${#f[@]} == 1 && ! -d $f ]]; then
55 if [[ ! -x $f ]]; then
56 if [[ $f == *-function ]]; then
57 ${f%-function} --help |
sed -n '2p' > .git
/description
62 $f --help |
sed -n '2p' > .git
/description
69 gitweb-descriptions
"$@"