feat: add bin/lean_wrapped helper script that chooses the right stage and use it in lean-mode

This commit is contained in:
Sebastian Ullrich 2019-10-28 15:47:37 +01:00 committed by Leonardo de Moura
parent 6912053fcc
commit b3382afa4d
2 changed files with 18 additions and 1 deletions

17
bin/lean_wrapped Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# Call `lean_stage0` when in library/Init; otherwise call `lean`.
bin=$(dirname $(realpath $0))
lib=$(dirname $bin)/library/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

View file

@ -22,7 +22,7 @@
(cl-case system-type
('windows-nt "lean.exe")
('cygwin "lean.exe")
(t "lean"))
(t "lean_wrapped"))
"Default executable name of Lean")
(defcustom lean4-rootdir nil