author | wenzelm |
Sat, 03 Feb 2001 15:21:57 +0100 | |
changeset 11044 | 5873a05b4d21 |
parent 10555 | 2323ec838401 |
child 14981 | e73f8140af78 |
permissions | -rwxr-xr-x |
10555 | 1 |
#!/usr/bin/env bash |
2293
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
2 |
# |
2307 | 3 |
# $Id$ |
9786 | 4 |
# Author: Markus Wenzel, TU Muenchen |
5 |
# License: GPL (GNU GENERAL PUBLIC LICENSE) |
|
2307 | 6 |
# |
9786 | 7 |
# Isabelle tool starter -- provides settings environment |
8 |
# and keeps your PATH name space clean. |
|
2293
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
9 |
|
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
10 |
|
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
11 |
## settings |
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
12 |
|
10511 | 13 |
PRG="$(basename "$0")" |
2703 | 14 |
|
10511 | 15 |
ISABELLE_HOME="$(dirname "$0")/.." |
9786 | 16 |
. "$ISABELLE_HOME/lib/scripts/getsettings" || \ |
2936
bd33e7aae062
fixed { ... } shell syntax to accomodate bash 2.x;
wenzelm
parents:
2787
diff
changeset
|
17 |
{ echo "$PRG probably not called from its original place!"; exit 2; } |
2293
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
18 |
|
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
19 |
|
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
20 |
## diagnostics |
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
21 |
|
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
22 |
function usage() |
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
23 |
{ |
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
24 |
echo |
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
25 |
echo "Usage: $PRG TOOL [ARGS ...]" |
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
26 |
echo |
2434 | 27 |
echo " Start Isabelle utility program TOOL with ARGS. Pass \"-?\" to TOOL" |
2787 | 28 |
echo " for more specific help." |
2293
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
29 |
echo |
3276 | 30 |
echo " Available tools are:" |
2293
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
31 |
( |
9786 | 32 |
ORIG_IFS="$IFS" |
33 |
IFS=":" |
|
34 |
for DIR in $ISABELLE_TOOLS |
|
2293
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
35 |
do |
9786 | 36 |
cd "$DIR" |
2787 | 37 |
echo |
38 |
for T in * |
|
39 |
do |
|
40 |
if [ -f "$T" -a -x "$T" ]; then |
|
11044 | 41 |
DESCRLINE=$(fgrep DESCRIPTION: "$T" | sed -e 's/^.*DESCRIPTION: *//') |
2787 | 42 |
echo " $T - $DESCRLINE" |
43 |
fi |
|
44 |
done |
|
2293
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
45 |
done |
9786 | 46 |
IFS="$ORIG_IFS" |
2293
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
47 |
) |
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
48 |
echo |
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
49 |
exit 1 |
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
50 |
} |
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
51 |
|
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
52 |
function fail() |
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
53 |
{ |
2344 | 54 |
echo "$1" >&2 |
2293
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
55 |
exit 2 |
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
56 |
} |
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
57 |
|
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
58 |
|
2787 | 59 |
## args |
2293
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
60 |
|
9786 | 61 |
[ "$#" -lt 1 -o "$1" = "-?" ] && usage |
2293
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
62 |
|
2787 | 63 |
TOOLNAME="$1" |
2293
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
64 |
shift |
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
65 |
|
2787 | 66 |
|
67 |
## main |
|
2293
749757db3ead
isatool: Isabelle tool starter -- keeps your PATH name space clean.
wenzelm
parents:
diff
changeset
|
68 |
|
9786 | 69 |
ORIG_IFS="$IFS" |
70 |
IFS=":" |
|
71 |
for DIR in $ISABELLE_TOOLS |
|
2787 | 72 |
do |
9786 | 73 |
TOOL="$DIR/$TOOLNAME" |
2787 | 74 |
[ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@" |
75 |
done |
|
9786 | 76 |
IFS="$ORIG_IFS" |
2787 | 77 |
|
7971 | 78 |
fail "Unknown Isabelle tool: $TOOLNAME" |