bin/isatool
author wenzelm
Thu Mar 06 12:32:58 1997 +0100 (1997-03-06)
changeset 2737 a43320c05e84
parent 2735 29434f9b95dd
child 2787 33931e1023e3
permissions -rwxr-xr-x
Oops, forgot to remove -x again;
     1 #!/bin/bash -norc
     2 #
     3 # $Id$
     4 #
     5 # Isabelle tool starter -- provides settings environment,
     6 #   also keeps your PATH name space clean.
     7 
     8 
     9 ## settings
    10 
    11 PRG=$(basename $0)
    12 
    13 ISABELLE_HOME=$(dirname $0)/..
    14 . $ISABELLE_HOME/lib/scripts/getsettings || \
    15   { echo "$PRG probably not called from its original place!"; exit 2 }
    16 
    17 
    18 ## diagnostics
    19 
    20 function usage()
    21 {
    22   echo
    23   echo "Usage: $PRG TOOL [ARGS ...]"
    24   echo
    25   echo "  Start Isabelle utility program TOOL with ARGS. Pass \"-?\" to TOOL"
    26   echo "  for specific help."
    27   echo
    28   echo "  Availabe tools are:"
    29   echo
    30   (
    31     cd "$ISABELLE_HOME/lib/Tools"
    32     for T in *
    33     do
    34       if [ -f "$T" -a -x "$T" ]; then
    35         DESCRLINE=$(grep DESCRIPTION: "$T" | sed -e 's/^.*DESCRIPTION: *//')
    36         echo "    $T - $DESCRLINE"
    37       fi
    38     done
    39   )
    40   echo
    41   exit 1
    42 }
    43 
    44 function fail()
    45 {
    46   echo "$1" >&2
    47   exit 2
    48 }
    49 
    50 
    51 ## main
    52 
    53 [ $# -lt 1 -o "$1" = "-?" ] && usage
    54 
    55 TOOL_BASE="$1"
    56 TOOL="$ISABELLE_HOME/lib/Tools/$1"
    57 shift
    58 
    59 [ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@"
    60 
    61 fail "Tool not found: $TOOL_BASE"