mirror of
https://github.com/go-delve/delve.git
synced 2025-10-29 09:46:56 +08:00
Documentation,cmd/dlv: tidy up --help output (#1649)
* scripts: use relative path in gen-cli-docs.go Makes gen-cli-docs.go work outside GOPATH. * Documentation,cmd/dlv: tidy up --help output The description of --log-dest, --log-output and --backend is very verbose and messes up the output of --help, move it to two "additional help" subcommands.
This commit is contained in:
committed by
Derek Parker
parent
282b3e052b
commit
2bd1cd3fa7
@ -3,10 +3,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/go-delve/delve/cmd/dlv/cmds"
|
||||
"github.com/spf13/cobra/doc"
|
||||
)
|
||||
|
||||
const defaultUsageDir = "./Documentation/usage"
|
||||
|
||||
func main() {
|
||||
doc.GenMarkdownTree(cmds.New(true), "./Documentation/usage")
|
||||
usageDir := defaultUsageDir
|
||||
if len(os.Args) > 1 {
|
||||
usageDir = os.Args[1]
|
||||
}
|
||||
root := cmds.New(true)
|
||||
doc.GenMarkdownTree(root, usageDir)
|
||||
// GenMarkdownTree ignores additional help topic commands, so we have to do this manually
|
||||
for _, cmd := range root.Commands() {
|
||||
if cmd.Run == nil {
|
||||
doc.GenMarkdownTree(cmd, usageDir)
|
||||
}
|
||||
}
|
||||
fh, err := os.OpenFile(filepath.Join(usageDir, "dlv.md"), os.O_APPEND|os.O_WRONLY, 0)
|
||||
if err != nil {
|
||||
log.Fatalf("appending to dlv.md: %v", err)
|
||||
}
|
||||
defer fh.Close()
|
||||
fmt.Fprintln(fh, "* [dlv log](dlv_log.md)\t - Help about logging flags")
|
||||
fmt.Fprintln(fh, "* [dlv backend](dlv_backend.md)\t - Help about the `--backend` flag")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user