lib/Tools/keywords
author Lars Hupel <lars.hupel@mytum.de>
Thu, 06 Mar 2014 17:55:39 +0100
changeset 55946 5163ed3a38f5
parent 52443 725916b7dee5
permissions -rwxr-xr-x
tuned

#!/usr/bin/env bash
#
# Author: Makarius
#
# DESCRIPTION: generate keyword files for Emacs Proof General


## diagnostics

PRG="$(basename "$0")"

function usage()
{
  echo
  echo "Usage: isabelle $PRG [OPTIONS] [SESSIONS ...]"
  echo
  echo "  Options are:"
  echo "    -d DIR       include session directory"
  echo "    -k NAME      specific name of keywords collection (default: empty)"
  echo
  echo "  Generate keyword files for Emacs Proof General from Isabelle sessions."
  echo
  exit 1
}


## process command line

# options

declare -a DIRS=()
KEYWORDS_NAME=""

while getopts "d:k:" OPT
do
  case "$OPT" in
    d)
      DIRS["${#DIRS[@]}"]="$OPTARG"
      ;;
    k)
      KEYWORDS_NAME="$OPTARG"
      ;;
    \?)
      usage
      ;;
  esac
done

shift $(($OPTIND - 1))


## main

isabelle_admin_build jars || exit $?

declare -a JAVA_ARGS; eval "JAVA_ARGS=($ISABELLE_BUILD_JAVA_OPTIONS)"

"$ISABELLE_TOOL" java "${JAVA_ARGS[@]}" isabelle.Keywords keywords \
  "$KEYWORDS_NAME" "${DIRS[@]}" $'\n' "$@"