lib/Tools/keywords
changeset 58842 22b87ab47d3b
parent 58840 f4bb3068d819
child 58843 521cea5fa777
equal deleted inserted replaced
58840:f4bb3068d819 58842:22b87ab47d3b
     1 #!/usr/bin/env bash
       
     2 #
       
     3 # Author: Makarius
       
     4 #
       
     5 # DESCRIPTION: generate keyword files for Emacs Proof General
       
     6 
       
     7 
       
     8 ## diagnostics
       
     9 
       
    10 PRG="$(basename "$0")"
       
    11 
       
    12 function usage()
       
    13 {
       
    14   echo
       
    15   echo "Usage: isabelle $PRG [OPTIONS] [SESSIONS ...]"
       
    16   echo
       
    17   echo "  Options are:"
       
    18   echo "    -d DIR       include session directory"
       
    19   echo "    -k NAME      specific name of keywords collection (default: empty)"
       
    20   echo
       
    21   echo "  Generate keyword files for Emacs Proof General from Isabelle sessions."
       
    22   echo
       
    23   exit 1
       
    24 }
       
    25 
       
    26 
       
    27 ## process command line
       
    28 
       
    29 # options
       
    30 
       
    31 declare -a DIRS=()
       
    32 KEYWORDS_NAME=""
       
    33 
       
    34 while getopts "d:k:" OPT
       
    35 do
       
    36   case "$OPT" in
       
    37     d)
       
    38       DIRS["${#DIRS[@]}"]="$OPTARG"
       
    39       ;;
       
    40     k)
       
    41       KEYWORDS_NAME="$OPTARG"
       
    42       ;;
       
    43     \?)
       
    44       usage
       
    45       ;;
       
    46   esac
       
    47 done
       
    48 
       
    49 shift $(($OPTIND - 1))
       
    50 
       
    51 
       
    52 ## main
       
    53 
       
    54 isabelle_admin_build jars || exit $?
       
    55 
       
    56 declare -a JAVA_ARGS; eval "JAVA_ARGS=($ISABELLE_BUILD_JAVA_OPTIONS)"
       
    57 
       
    58 "$ISABELLE_TOOL" java "${JAVA_ARGS[@]}" isabelle.Keywords keywords \
       
    59   "$KEYWORDS_NAME" "${DIRS[@]}" $'\n' "$@"
       
    60