feat(lib): Search path function
This commit is contained in:
parent
863c6d9e7d
commit
4706df2217
|
@ -48,8 +48,7 @@ unsafe def main (args: List String): IO Unit := do
|
||||||
println! s!"{version}"
|
println! s!"{version}"
|
||||||
return
|
return
|
||||||
|
|
||||||
Lean.enableInitializersExecution
|
initSearch ""
|
||||||
Lean.initSearchPath (← Lean.findSysroot)
|
|
||||||
|
|
||||||
let coreContext ← args.filterMap (λ s => if s.startsWith "--" then .some <| s.drop 2 else .none)
|
let coreContext ← args.filterMap (λ s => if s.startsWith "--" then .some <| s.drop 2 else .none)
|
||||||
|>.toArray |> createCoreContext
|
|>.toArray |> createCoreContext
|
||||||
|
|
|
@ -38,6 +38,12 @@ namespace Pantograph
|
||||||
@[export pantograph_version]
|
@[export pantograph_version]
|
||||||
def pantographVersion: String := version
|
def pantographVersion: String := version
|
||||||
|
|
||||||
|
/-- Adds the given paths to Lean package search path -/
|
||||||
|
@[export pantograph_init_search]
|
||||||
|
unsafe def initSearch (sp: String): IO Unit := do
|
||||||
|
Lean.enableInitializersExecution
|
||||||
|
Lean.initSearchPath (← Lean.findSysroot) (sp := System.SearchPath.parse sp)
|
||||||
|
|
||||||
/-- Creates a Core.Context object needed to run all monads -/
|
/-- Creates a Core.Context object needed to run all monads -/
|
||||||
@[export pantograph_create_core_context]
|
@[export pantograph_create_core_context]
|
||||||
def createCoreContext (options: Array String): IO Lean.Core.Context := do
|
def createCoreContext (options: Array String): IO Lean.Core.Context := do
|
||||||
|
|
Loading…
Reference in New Issue