bookshelf-doc/Main.lean

31 lines
887 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
2022-04-06 23:31:27 +00:00
-- let root := p.positionalArg! "root" |>.as! String
2022-02-23 21:54:10 +00:00
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:
2022-04-06 23:31:27 +00:00
-- root : String; "The root URL to generate the HTML for (will be relative in the future)"
2022-02-23 21:54:10 +00:00
...modules : String; "The modules to generate the HTML for"
]
def main (args : List String) : IO UInt32 :=
docGenCmd.validate args