Compare commits
No commits in common. "1cd41b4993c785c769ab3a13b1f67ecbc897a625" and "1f4f2d7d6de52c4057e0c6a6b6a6dba093e5c515" have entirely different histories.
1cd41b4993
...
1f4f2d7d6d
22
Main.lean
22
Main.lean
|
@ -33,16 +33,11 @@ partial def loop : MainM Unit := do
|
|||
-- Using `Lean.Json.compress` here to prevent newline
|
||||
IO.println error.compress
|
||||
| .ok command =>
|
||||
try
|
||||
let ret ← execute command
|
||||
let str := match state.options.printJsonPretty with
|
||||
| true => ret.pretty
|
||||
| false => ret.compress
|
||||
IO.println str
|
||||
catch e =>
|
||||
let message ← e.toMessageData.toString
|
||||
let error := Lean.toJson ({ error := "main", desc := message }: InteractionError)
|
||||
IO.println error.compress
|
||||
let ret ← execute command
|
||||
let str := match state.options.printJsonPretty with
|
||||
| true => ret.pretty
|
||||
| false => ret.compress
|
||||
IO.println str
|
||||
loop
|
||||
|
||||
|
||||
|
@ -50,7 +45,7 @@ unsafe def main (args: List String): IO Unit := do
|
|||
-- NOTE: A more sophisticated scheme of command line argument handling is needed.
|
||||
-- Separate imports and options
|
||||
if args == ["--version"] then do
|
||||
IO.println s!"{Pantograph.version}"
|
||||
println! s!"{Pantograph.version}"
|
||||
return
|
||||
|
||||
Pantograph.initSearch ""
|
||||
|
@ -67,6 +62,5 @@ unsafe def main (args: List String): IO Unit := do
|
|||
IO.println "ready."
|
||||
discard <| coreM.toIO coreContext coreState
|
||||
catch ex =>
|
||||
let message := ex.toString
|
||||
let error := Lean.toJson ({ error := "io", desc := message }: InteractionError)
|
||||
IO.println error.compress
|
||||
IO.println "Uncaught IO exception"
|
||||
IO.println ex.toString
|
||||
|
|
Loading…
Reference in New Issue