equal
deleted
inserted
replaced
1 #!/bin/bash -norc |
1 #!/bin/bash -norc |
2 # |
2 # |
3 # $Id$ |
3 # $Id$ |
4 # |
4 # |
5 # Isabelle tool starter -- provides settings environment, |
5 # Isabelle tool starter -- provides settings environment, |
6 # also keeps your PATH name space clean. |
6 # and keeps your PATH name space clean. |
7 |
7 |
8 |
8 |
9 ## settings |
9 ## settings |
10 |
10 |
11 PRG=$(basename $0) |
11 PRG=$(basename $0) |
15 { echo "$PRG probably not called from its original place!"; exit 2 } |
15 { echo "$PRG probably not called from its original place!"; exit 2 } |
16 |
16 |
17 |
17 |
18 ## diagnostics |
18 ## diagnostics |
19 |
19 |
|
20 TOOLDIRS=$(echo $ISABELLE_TOOLS | tr : " ") |
|
21 |
20 function usage() |
22 function usage() |
21 { |
23 { |
22 echo |
24 echo |
23 echo "Usage: $PRG TOOL [ARGS ...]" |
25 echo "Usage: $PRG TOOL [ARGS ...]" |
24 echo |
26 echo |
25 echo " Start Isabelle utility program TOOL with ARGS. Pass \"-?\" to TOOL" |
27 echo " Start Isabelle utility program TOOL with ARGS. Pass \"-?\" to TOOL" |
26 echo " for specific help." |
28 echo " for more specific help." |
27 echo |
29 echo |
28 echo " Availabe tools are:" |
30 echo " Availabe tools are:" |
29 echo |
|
30 ( |
31 ( |
31 cd "$ISABELLE_HOME/lib/Tools" |
32 for DIR in $TOOLDIRS |
32 for T in * |
|
33 do |
33 do |
34 if [ -f "$T" -a -x "$T" ]; then |
34 cd $DIR |
35 DESCRLINE=$(grep DESCRIPTION: "$T" | sed -e 's/^.*DESCRIPTION: *//') |
35 echo |
36 echo " $T - $DESCRLINE" |
36 for T in * |
37 fi |
37 do |
|
38 if [ -f "$T" -a -x "$T" ]; then |
|
39 DESCRLINE=$(grep DESCRIPTION: "$T" | sed -e 's/^.*DESCRIPTION: *//') |
|
40 echo " $T - $DESCRLINE" |
|
41 fi |
|
42 done |
38 done |
43 done |
39 ) |
44 ) |
40 echo |
45 echo |
41 exit 1 |
46 exit 1 |
42 } |
47 } |
46 echo "$1" >&2 |
51 echo "$1" >&2 |
47 exit 2 |
52 exit 2 |
48 } |
53 } |
49 |
54 |
50 |
55 |
51 ## main |
56 ## args |
52 |
57 |
53 [ $# -lt 1 -o "$1" = "-?" ] && usage |
58 [ $# -lt 1 -o "$1" = "-?" ] && usage |
54 |
59 |
55 TOOL_BASE="$1" |
60 TOOLNAME="$1" |
56 TOOL="$ISABELLE_HOME/lib/Tools/$1" |
|
57 shift |
61 shift |
58 |
62 |
59 [ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@" |
|
60 |
63 |
61 fail "Tool not found: $TOOL_BASE" |
64 ## main |
|
65 |
|
66 for DIR in $TOOLDIRS |
|
67 do |
|
68 TOOL=$DIR/$TOOLNAME |
|
69 [ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@" |
|
70 done |
|
71 |
|
72 fail "Unknown isabelle tool: $TOOLNAME" |