lib/Tools/options
author wenzelm
Fri Jan 01 16:40:47 2016 +0100 (2016-01-01)
changeset 62028 2ecee4679f99
parent 52735 842b5e7dcac8
child 62437 bccad0374407
permissions -rwxr-xr-x
updated for release;
     1 #!/usr/bin/env bash
     2 #
     3 # Author: Makarius
     4 #
     5 # DESCRIPTION: print Isabelle system options
     6 
     7 
     8 ## diagnostics
     9 
    10 PRG="$(basename "$0")"
    11 
    12 function usage()
    13 {
    14   echo
    15   echo "Usage: isabelle $PRG [OPTIONS] [MORE_OPTIONS ...]"
    16   echo
    17   echo "  Options are:"
    18   echo "    -b           include \$ISABELLE_BUILD_OPTIONS"
    19   echo "    -g OPTION    get value of OPTION"
    20   echo "    -l           list options"
    21   echo "    -x FILE      export options to FILE in YXML format"
    22   echo
    23   echo "  Report Isabelle system options, augmented by MORE_OPTIONS given as"
    24   echo "  arguments NAME=VAL or NAME."
    25   echo
    26   exit 1
    27 }
    28 
    29 function fail()
    30 {
    31   echo "$1" >&2
    32   exit 2
    33 }
    34 
    35 
    36 ## process command line
    37 
    38 declare -a BUILD_OPTIONS=()
    39 GET_OPTION=""
    40 LIST_OPTIONS="false"
    41 EXPORT_FILE=""
    42 
    43 while getopts "bg:lx:" OPT
    44 do
    45   case "$OPT" in
    46     b)
    47       eval "BUILD_OPTIONS=($ISABELLE_BUILD_OPTIONS)"
    48       ;;
    49     g)
    50       GET_OPTION="$OPTARG"
    51       ;;
    52     l)
    53       LIST_OPTIONS="true"
    54       ;;
    55     x)
    56       EXPORT_FILE="$OPTARG"
    57       ;;
    58     \?)
    59       usage
    60       ;;
    61   esac
    62 done
    63 
    64 shift $(($OPTIND - 1))
    65 
    66 [ -z "$GET_OPTION" -a "$LIST_OPTIONS" = "false" -a -z "$EXPORT_FILE" ] && usage
    67 
    68 
    69 ## main
    70 
    71 isabelle_admin_build jars || exit $?
    72 
    73 exec "$ISABELLE_TOOL" java isabelle.Options \
    74   "$GET_OPTION" "$EXPORT_FILE" "${BUILD_OPTIONS[@]}" "$@"
    75