isatool: Isabelle tool starter -- keeps your PATH name space clean.
authorwenzelm
Mon Dec 02 18:14:32 1996 +0100 (1996-12-02)
changeset 2293749757db3ead
parent 2292 c1c5652600f1
child 2294 a67343c87db4
isatool: Isabelle tool starter -- keeps your PATH name space clean.
bin/isatool
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/bin/isatool	Mon Dec 02 18:14:32 1996 +0100
     1.3 @@ -0,0 +1,59 @@
     1.4 +#!/bin/bash
     1.5 +#
     1.6 +# Isabelle tool starter -- keeps your PATH name space clean.
     1.7 +#
     1.8 +# $Id$
     1.9 +
    1.10 +
    1.11 +## settings
    1.12 +
    1.13 +ISABELLE_HOME=$(dirname $(dirname $0))
    1.14 +. $ISABELLE_HOME/lib/scripts/getsettings
    1.15 +
    1.16 +
    1.17 +
    1.18 +## diagnostics
    1.19 +
    1.20 +PRG=$(basename $0)
    1.21 +
    1.22 +function usage()
    1.23 +{
    1.24 +  echo
    1.25 +  echo "Usage: $PRG TOOL [ARGS ...]"
    1.26 +  echo
    1.27 +  echo "  Start Isabelle utility program TOOL with ARGS."
    1.28 +  echo
    1.29 +  echo "  Availabe tools are:"
    1.30 +  (
    1.31 +    cd "$ISABELLE_HOME/lib/Tools"
    1.32 +    for T in *
    1.33 +    do
    1.34 +      if [ -f "$T" -a -x "$T" ]; then
    1.35 +        DESCRLINE=$(grep DESCRIPTION: "$T" | sed -e 's/^.*DESCRIPTION: *//')
    1.36 +        echo "    $T - $DESCRLINE"
    1.37 +      fi
    1.38 +    done
    1.39 +  )
    1.40 +  echo
    1.41 +  exit 1
    1.42 +}
    1.43 +
    1.44 +function fail()
    1.45 +{
    1.46 +  echo "$1"
    1.47 +  exit 2
    1.48 +}
    1.49 +
    1.50 +
    1.51 +
    1.52 +## main
    1.53 +
    1.54 +[ $# -lt 1 ] && usage
    1.55 +
    1.56 +TOOL_BASE="$1"
    1.57 +TOOL="$ISABELLE_HOME/lib/Tools/$1"
    1.58 +shift
    1.59 +
    1.60 +[ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@"
    1.61 +
    1.62 +fail "Tool not found: $TOOL_BASE"