2 # Copyright (C) 2016 Ian Kelling
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # my projects all have README or --help with a short single line
18 # description which I parse and put into the gitweb description.
20 # If it's a repo with just a single bash script or *-function script,
21 # then call it with --help, grap the 2nd line.
22 # else, parse the readme, find the first non blank, not starting with [#*],
25 set -e; .
/usr
/local
/lib
/bash-bear
; set +e
28 echo "need gitroot arg"
41 echo "$1: error: no README at $PWD"
44 while read -r line
; do
45 [[ $line ]] ||
continue
46 if echo "$line" |
grep "^ *[#*]" &>/dev
/null
; then
49 echo "$line" > .git
/description
54 gitweb-descriptions
() {
55 for d
in ${dirs[@]}; do
57 cd $
(readlink
-f $d)/..
58 [[ -e .git
]] ||
echo $d
59 if [[ ${personalized[${d##*/}]} ]]; then
60 echo "$pcategory" >.git
/category
62 if [[ ${unmaintained[${d##*/}]} ]]; then
63 echo "$ucategory" >.git
/category
65 if [[ ${historicalarchive[${d##*/}]} ]]; then
66 echo "$hcategory" >.git
/category
68 f
=(!(LICENSE|COPYING|README|.git
))
69 if [[ ${#f[@]} == 1 && ! -d $f ]]; then
70 if [[ ! -x $f ]]; then
71 if [[ $f == *-function ]]; then
72 ${f%-function} --help |
sed -n '2p' > .git
/description
77 .
/$f --help |
sed -n '2p' > .git
/description
87 automated-distro-installer
96 declare -A personalized
97 for p
in ${tmp[@]}; do personalized
[$p]=true
; done
98 pcategory
="Personalized for my use. Useful as examples or to copy specific parts"
104 ucategory
="I don't use these anymore, they may or may not work, patches welcome"
105 declare -A unmaintained
106 for p
in ${tmp[@]}; do unmaintained
[$p]=true
; done
113 mediawiki-librejs-patch
114 mediawiki-sidebar-patch
116 hcategory
="Historical archive. They don't work or have been superseded."
117 declare -A historicalarchive
118 for p
in ${tmp[@]}; do historicalarchive
[$p]=true
; done
121 for d
in $gitroot/*; do
122 if [[ ! -L $d ]]; then
128 gitweb-descriptions
"$@"