mes/scripts/include.mes
Jan Nieuwenhuizen ac4b1eed3f Add --help, --version.
* mes.c (main): Handle --help, --version.
* scripts/include.mes: Handle --help.
* scripts/elf.mes: Pass any arguments on to mes.
* scripts/mescc.mes: Likewise.
* scripts/paren.mes: Likewise.
* scripts/repl.mes: Likewise.
2016-10-19 00:36:12 +02:00

16 lines
390 B
Bash
Executable file

#! /bin/sh
if [ "$1" == "--help" ]; then
echo "Usage: include.mes FILE"
exit 0
fi
for prefix in $(dirname $(dirname $0))/share/mes . $(dirname $(dirname $0)); do
if [ -d ${prefix}/module ]; then
break;
fi
done
cat $1 \
| grep -Eo '(mes-use-module \([^()]+ [^()]+))' \
| grep -Eo ' \([^)]+\)' \
| sed -e "s@^ *(@${prefix}/module/@" -e 's@ @/@g' -e 's@)@.mes@'