bin/isatool
author wenzelm
Wed, 18 Dec 1996 12:45:54 +0100
changeset 2434 d3d42a2e7da2
parent 2395 c24a79fe3651
child 2505 50abca9d4043
permissions -rwxr-xr-x
improved usage msg;

#!/bin/bash -norc
#
# $Id$
#
# Isabelle tool starter -- keeps your PATH name space clean.


## settings

ISABELLE_HOME=$(dirname $(dirname $0))
. $ISABELLE_HOME/lib/scripts/getsettings || exit 2


## diagnostics

PRG=$(basename $0)

function usage()
{
  echo
  echo "Usage: $PRG TOOL [ARGS ...]"
  echo
  echo "  Start Isabelle utility program TOOL with ARGS. Pass \"-?\" to TOOL"
  echo "  for specific help."
  echo
  echo "  Availabe tools are:"
  echo
  (
    cd "$ISABELLE_HOME/lib/Tools"
    for T in *
    do
      if [ -f "$T" -a -x "$T" ]; then
        DESCRLINE=$(grep DESCRIPTION: "$T" | sed -e 's/^.*DESCRIPTION: *//')
        echo "    $T - $DESCRLINE"
      fi
    done
  )
  echo
  exit 1
}

function fail()
{
  echo "$1" >&2
  exit 2
}


## main

[ $# -lt 1 ] && usage

TOOL_BASE="$1"
TOOL="$ISABELLE_HOME/lib/Tools/$1"
shift

[ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@"

fail "Tool not found: $TOOL_BASE"