bookshelf-doc/Main.lean

29 lines
737 B
Plaintext
Raw Normal View History

2021-11-27 15:19:56 +00:00
import DocGen4
import Lean
2022-02-23 21:54:10 +00:00
import Cli
2021-11-27 15:19:56 +00:00
2022-02-23 21:54:10 +00:00
open DocGen4 Lean Cli
2021-11-27 15:19:56 +00:00
2022-02-23 21:54:10 +00:00
def runDocGenCmd (p : Parsed) : IO UInt32 := do
let modules : List String := p.variableArgsAs! String |>.toList
2022-03-06 17:51:06 +00:00
let res ← lakeSetup modules
match res with
| Except.ok (ws, leanHash) =>
IO.println s!"Loading modules from: {←searchPathRef.get}"
let doc ← load $ modules.map Name.mkSimple
IO.println "Outputting HTML"
2022-04-06 23:31:27 +00:00
htmlOutput doc ws leanHash
2022-03-06 17:51:06 +00:00
pure 0
| Except.error rc => pure rc
2022-02-23 21:54:10 +00:00
def docGenCmd : Cmd := `[Cli|
"doc-gen4" VIA runDocGenCmd; ["0.0.1"]
"A documentation generator for Lean 4."
ARGS:
...modules : String; "The modules to generate the HTML for"
]
def main (args : List String) : IO UInt32 :=
docGenCmd.validate args