bin/isatool
author wenzelm
Mon Dec 16 09:53:30 1996 +0100 (1996-12-16)
changeset 2395 c24a79fe3651
parent 2344 c3e1eaea4418
child 2434 d3d42a2e7da2
permissions -rwxr-xr-x
now fails if getsettings not found;
     1 #!/bin/bash -norc
     2 #
     3 # $Id$
     4 #
     5 # Isabelle tool starter -- keeps your PATH name space clean.
     6 
     7 
     8 ## settings
     9 
    10 ISABELLE_HOME=$(dirname $(dirname $0))
    11 . $ISABELLE_HOME/lib/scripts/getsettings || exit 2
    12 
    13 
    14 ## diagnostics
    15 
    16 PRG=$(basename $0)
    17 
    18 function usage()
    19 {
    20   echo
    21   echo "Usage: $PRG TOOL [ARGS ...]"
    22   echo
    23   echo "  Start Isabelle utility program TOOL with ARGS."
    24   echo
    25   echo "  Availabe tools are:"
    26   (
    27     cd "$ISABELLE_HOME/lib/Tools"
    28     for T in *
    29     do
    30       if [ -f "$T" -a -x "$T" ]; then
    31         DESCRLINE=$(grep DESCRIPTION: "$T" | sed -e 's/^.*DESCRIPTION: *//')
    32         echo "    $T - $DESCRLINE"
    33       fi
    34     done
    35   )
    36   echo
    37   exit 1
    38 }
    39 
    40 function fail()
    41 {
    42   echo "$1" >&2
    43   exit 2
    44 }
    45 
    46 
    47 ## main
    48 
    49 [ $# -lt 1 ] && usage
    50 
    51 TOOL_BASE="$1"
    52 TOOL="$ISABELLE_HOME/lib/Tools/$1"
    53 shift
    54 
    55 [ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@"
    56 
    57 fail "Tool not found: $TOOL_BASE"