mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
If $HOME/cvs-list.txt exists, it is used as whitelist for the list-projects command Signed-off-by: Jan Lindemann <jan@janware.com>
41 lines
570 B
Bash
41 lines
570 B
Bash
#!/bin/bash
|
|
|
|
log()
|
|
{
|
|
echo $@
|
|
}
|
|
|
|
err()
|
|
{
|
|
echo $@ >&2
|
|
}
|
|
|
|
fatal()
|
|
{
|
|
err $@
|
|
exit 1
|
|
}
|
|
|
|
cmd_list_projects()
|
|
{
|
|
local all_proj proj p
|
|
(
|
|
cd $projroot || fatal Failed to change to $projroot
|
|
all_proj=`find . -maxdepth 1 -mindepth 1 -type d`
|
|
for p in $all_proj; do
|
|
test -x $p || continue
|
|
test -r $p || continue
|
|
p=${p##./}
|
|
test -f $HOME/cvs-list.txt && grep -q "^$p$" $HOME/cvs-list.txt || continue
|
|
proj="$proj $p"
|
|
done
|
|
[ "$proj" ] && echo $proj
|
|
)
|
|
}
|
|
|
|
# ---------- here we go
|
|
cvsroot=/srv/cvs
|
|
projroot=$cvsroot/proj
|
|
cmd=${1/-/_}
|
|
shift
|
|
eval cmd_$cmd $@
|