This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
slapd-supann/slapd-supann

47 lines
845 B
Plaintext
Raw Permalink Normal View History

2014-11-07 14:49:16 +01:00
#!/bin/sh
2014-11-09 14:57:00 +01:00
ME=`basename $0`
2014-11-09 22:06:20 +01:00
COMMANDDIR=`dirname $0`/lib
2014-11-09 14:57:00 +01:00
test -d ${COMMANDDIR} || COMMANDDIR=/usr/lib/`basename $0`
help() {
msg="$1"
test -n "$msg" && echo $msg
2014-11-26 13:38:45 +01:00
echo "syntaxe: $ME commande ..."
2014-11-09 14:57:00 +01:00
echo ""
2014-11-26 13:38:45 +01:00
echo "commandes disponibles:"
echo " help cette aide"
2014-11-09 14:57:00 +01:00
for fcom in $COMMANDDIR/*.help
do
com=`basename $fcom .help`
descr=`head -1 $fcom`
2014-11-09 14:57:00 +01:00
echo " "$com" "$descr
done
test -n "$msg" && exit 1
exit 0
}
helpcmd() {
command=$1
xcommand=$COMMANDDIR/$command
2014-11-26 13:38:45 +01:00
test -x $xcommand || help "ERR: commande inconnue ($command)"
2014-11-09 14:57:00 +01:00
echo "$ME $command"
cat $xcommand.help
}
command=$1
2014-11-26 13:38:45 +01:00
test -z $command && help "ERR: commande manquante"
2014-11-09 14:57:00 +01:00
shift
case $command in
help)
test -z "$1" && help
helpcmd $1
;;
*)
xcommand=$COMMANDDIR/$command
2014-11-26 13:38:45 +01:00
test -x $xcommand || help "ERR: commande inconnue ($command)"
$xcommand "$@"
2014-11-09 14:57:00 +01:00
;;
esac