diff options
author | Robert Griesemer <gri@golang.org> | 2010-03-10 15:22:22 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2010-03-10 15:22:22 -0800 |
commit | 8302a8288535788507436b66dd98db977440fa27 (patch) | |
tree | 80716ecff1adc917e3bc4fe9c1b12ad3c65ec020 /src/cmd/godoc/main.go | |
parent | 2a77c01fc24516c363edae3469cf582b343f8418 (diff) | |
download | golang-8302a8288535788507436b66dd98db977440fa27.tar.gz |
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
http://codereview.appspot.com/376041
Diffstat (limited to 'src/cmd/godoc/main.go')
-rw-r--r-- | src/cmd/godoc/main.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cmd/godoc/main.go b/src/cmd/godoc/main.go index ded1d3607..9f92c6cff 100644 --- a/src/cmd/godoc/main.go +++ b/src/cmd/godoc/main.go @@ -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 { |