#!/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' "$@"