bin/isatool
author wenzelm
Fri, 28 Feb 1997 16:58:42 +0100
changeset 2705 d6e83a02061d
parent 2703 5ce1310560ff
child 2735 29434f9b95dd
permissions -rwxr-xr-x
*** empty log message ***

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


## settings

PRG=$(basename $0)

ISABELLE_HOME=$(dirname $(dirname $0))
case "$ISABELLE_HOME" in
  /*)
    if [ -f $ISABELLE_HOME/lib/scripts/getsettings ]; then
      . $ISABELLE_HOME/lib/scripts/getsettings || exit 2
    else
      echo "ERROR: $PRG probably not called from its original place!"
      exit 1
    fi
    ;;
  *)
    echo "ERROR: $PRG not called with absolute path specification!"
    exit 1
    ;;
esac


## diagnostics

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 -o "$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"