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