mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
godoc: provide mode which shows exported interface in "source form"
- on the commandline: godoc -x big - in a webpage: provide form parameter ?m=src Known issues: - Positioning of comments incorrect in several cases. Separate CL. - Need a link/menu to switch between different modes of presentation in the web view. R=rsc CC=golang-dev https://golang.org/cl/376041
This commit is contained in:
parent
16e6df9807
commit
35aec6c7f7
4 changed files with 37 additions and 16 deletions
|
|
@ -47,7 +47,8 @@ var (
|
|||
httpaddr = flag.String("http", "", "HTTP service address (e.g., ':6060')")
|
||||
|
||||
// layout control
|
||||
html = flag.Bool("html", false, "print HTML in command-line mode")
|
||||
html = flag.Bool("html", false, "print HTML in command-line mode")
|
||||
genAST = flag.Bool("x", false, "print exported source in command-line mode")
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -240,14 +241,14 @@ func main() {
|
|||
relpath = relativePath(path)
|
||||
}
|
||||
|
||||
info := pkgHandler.getPageInfo(abspath, relpath, true)
|
||||
info := pkgHandler.getPageInfo(abspath, relpath, *genAST, true)
|
||||
|
||||
if info.PDoc == nil && info.Dirs == nil {
|
||||
if info.PAst == nil && info.PDoc == nil && info.Dirs == nil {
|
||||
// try again, this time assume it's a command
|
||||
if len(path) > 0 && path[0] != '/' {
|
||||
abspath = absolutePath(path, cmdHandler.fsRoot)
|
||||
}
|
||||
info = cmdHandler.getPageInfo(abspath, relpath, false)
|
||||
info = cmdHandler.getPageInfo(abspath, relpath, false, false)
|
||||
}
|
||||
|
||||
if info.PDoc != nil && flag.NArg() > 1 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue