bin/isatool
author wenzelm
Thu, 09 Oct 1997 15:06:49 +0200
changeset 3822 a17f9b8dca93
parent 3276 f8bf5e5c1641
child 7971 023778c8a029
permissions -rwxr-xr-x
no longer handles consts "" -- use syntax instead; pretty printer: changed order of mixfix annotation preference (again!);

#!/bin/bash
#
# $Id$
#
# Isabelle tool starter -- provides settings environment,
#   and keeps your PATH name space clean.


## settings

PRG=$(basename $0)

ISABELLE_HOME=$(dirname $0)/..
. $ISABELLE_HOME/lib/scripts/getsettings || \
  { echo "$PRG probably not called from its original place!"; exit 2; }


## diagnostics

TOOLDIRS=$(echo $ISABELLE_TOOLS | tr : " ")

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

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


## args

[ $# -lt 1 -o "$1" = "-?" ] && usage

TOOLNAME="$1"
shift


## main

for DIR in $TOOLDIRS
do
  TOOL=$DIR/$TOOLNAME
  [ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@"
done

fail "Unknown isabelle tool: $TOOLNAME"