scripts/mk/gitmk-proxy.mk: echo -e is not portable
[navymail.git] / cmd / navymail-sh-setup
blob3f58c46927f18320568739ff402a19aa98afd517
1 # common stuff for shell commands
2 # Based on git/git-sh-setup.sh
4 die() {
5         echo >&2 "$*"
6         exit 1
10 # usage
11 dashless=$(basename "$0" | sed -e 's/-/ /')
12 usage() {
13         die "Usage: $dashless $USAGE"
16 if [ -z "$LONG_USAGE" ]
17 then
18         LONG_USAGE="Usage: $dashless $USAGE"
19 else
20         LONG_USAGE="Usage: $dashless $USAGE
22 $LONG_USAGE"
26 # process common options
27 while test $# != 0
29         case "$1" in
30                 -h|--help)
31                         echo "$LONG_USAGE"
32                         exit
33                         ;;
34                 --navymail-dir=*)
35                         export NAVYMAIL_DIR="${1#*=}"
36                         ;;
37                 *)
38                         break
39                         ;;
40         esac
41         shift
42 done
45 # by default require a db to work on
46 if test -z "$NONNAVYMAIL_OK"
47 then
48         test -z "$NAVYMAIL_DIR" && die "What is you navymail db?"
52 # run git in navymail store
53 rungit() {
54         git --git-dir="$NAVYMAIL_DIR" "$@"