This PR adds `Lean.loadPlugin` which exposes functionality similar to the `lean` executable's `--plugin` option to Lean code. This will allow custom Lean frontends (e.g., Lake, the Lean language server) to also load plugins. --------- Co-authored-by: Sebastian Ullrich <sebasti@nullri.ch>
14 lines
336 B
Text
14 lines
336 B
Text
import UserEnvPlugin
|
|
import Lean.LoadDynlib
|
|
|
|
open Lean
|
|
|
|
def main (args : List String) : IO UInt32 := do
|
|
let plugin :: [] := args
|
|
| IO.println "Usage: lean --run testEnv.lean <UserEnvPlugin>"
|
|
return 1
|
|
withImporting do
|
|
loadPlugin plugin
|
|
let env ← mkEmptyEnvironment
|
|
IO.println (valExt.getState env)
|
|
return 0
|