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 root := p.positionalArg! "root" |>.as! String
|
|
|
|
let modules : List String := p.variableArgsAs! String |>.toList
|
|
|
|
let path ← lakeSetupSearchPath (←getLakePath) modules
|
2021-12-05 13:56:25 +00:00
|
|
|
IO.println s!"Loading modules from: {path}"
|
|
|
|
let doc ← load $ modules.map Name.mkSimple
|
2021-12-15 11:02:05 +00:00
|
|
|
IO.println "Outputting HTML"
|
2022-01-07 09:56:39 +00:00
|
|
|
htmlOutput doc root
|
2022-02-23 21:54:10 +00:00
|
|
|
pure 0
|
|
|
|
|
|
|
|
def docGenCmd : Cmd := `[Cli|
|
|
|
|
"doc-gen4" VIA runDocGenCmd; ["0.0.1"]
|
|
|
|
"A documentation generator for Lean 4."
|
|
|
|
|
|
|
|
ARGS:
|
|
|
|
root : String; "The root URL to generate the HTML for (will be relative in the future)"
|
|
|
|
...modules : String; "The modules to generate the HTML for"
|
|
|
|
]
|
|
|
|
|
|
|
|
def main (args : List String) : IO UInt32 :=
|
|
|
|
docGenCmd.validate args
|