lean4-htt/bin/lean_wrapped
2019-12-09 13:07:33 +01:00

17 lines
399 B
Bash
Executable file

#!/usr/bin/env bash
# Call `lean_stage0` when in src/Init; otherwise call `lean`.
bin=$(dirname $(realpath $0))
lib=$(dirname $bin)/src/Init
# use dir of input file, or pwd if stdin
if [[ "$*" == *--stdin* ]]; then
dir=$(pwd)
else
dir=$(dirname $(realpath ${@:$#}))
fi
# check if `dir` starts with `$lib`
if [[ ${dir##$lib} != $dir ]]; then
$bin/lean_stage0 $*
else
$bin/lean $*
fi