|
|
@ -178,29 +178,6 @@ var helpTemplate = `{{if .Runnable}}usage: go {{.UsageLine}} |
|
|
|
{{end}}{{.Long | trim}} |
|
|
|
{{end}}{{.Long | trim}} |
|
|
|
` |
|
|
|
` |
|
|
|
|
|
|
|
|
|
|
|
var documentationTemplate = `// Copyright 2011 The Go Authors. All rights reserved.
|
|
|
|
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// DO NOT EDIT THIS FILE. GENERATED BY mkdoc.sh.
|
|
|
|
|
|
|
|
// Edit the documentation in other files and rerun mkdoc.sh to generate this one.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
{{range .}}{{if .Short}}{{.Short | capitalize}} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{{end}}{{if .Runnable}}Usage: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
go {{.UsageLine}} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{{end}}{{.Long | trim}} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{{end}}*/ |
|
|
|
|
|
|
|
package main |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// NOTE: cmdDoc is in fmt.go.
|
|
|
|
|
|
|
|
` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// tmpl executes the given template text on data, writing the result to w.
|
|
|
|
// tmpl executes the given template text on data, writing the result to w.
|
|
|
|
func tmpl(w io.Writer, text string, data interface{}) { |
|
|
|
func tmpl(w io.Writer, text string, data interface{}) { |
|
|
|
t := template.New("top") |
|
|
|
t := template.New("top") |
|
|
@ -242,15 +219,6 @@ func help(args []string) { |
|
|
|
|
|
|
|
|
|
|
|
arg := args[0] |
|
|
|
arg := args[0] |
|
|
|
|
|
|
|
|
|
|
|
// 'go help documentation' generates doc.go.
|
|
|
|
|
|
|
|
if arg == "documentation" { |
|
|
|
|
|
|
|
buf := new(bytes.Buffer) |
|
|
|
|
|
|
|
printUsage(buf) |
|
|
|
|
|
|
|
usage := &Command{Long: buf.String()} |
|
|
|
|
|
|
|
tmpl(os.Stdout, documentationTemplate, append([]*Command{usage}, commands...)) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for _, cmd := range commands { |
|
|
|
for _, cmd := range commands { |
|
|
|
if cmd.Name() == arg { |
|
|
|
if cmd.Name() == arg { |
|
|
|
tmpl(os.Stdout, helpTemplate, cmd) |
|
|
|
tmpl(os.Stdout, helpTemplate, cmd) |
|
|
|