mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
ea0d7e5271
Use the generate.sh script instead of md2man directly.
Update Dockerfile for generating man pages.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
(cherry picked from commit 00a8a40398
)
Signed-off-by: Tibor Vass <tibor@docker.com>
39 lines
873 B
Go
39 lines
873 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/docker/docker/cli/cobraadaptor"
|
|
cliflags "github.com/docker/docker/cli/flags"
|
|
"github.com/spf13/cobra/doc"
|
|
)
|
|
|
|
func generateManPages(path string) error {
|
|
header := &doc.GenManHeader{
|
|
Title: "DOCKER",
|
|
Section: "1",
|
|
Source: "Docker Community",
|
|
}
|
|
flags := &cliflags.ClientFlags{
|
|
Common: cliflags.InitCommonFlags(),
|
|
}
|
|
cmd := cobraadaptor.NewCobraAdaptor(flags).GetRootCommand()
|
|
cmd.DisableAutoGenTag = true
|
|
return doc.GenManTreeFromOpts(cmd, doc.GenManTreeOptions{
|
|
Header: header,
|
|
Path: path,
|
|
CommandSeparator: "-",
|
|
})
|
|
}
|
|
|
|
func main() {
|
|
path := "/tmp"
|
|
if len(os.Args) > 1 {
|
|
path = os.Args[1]
|
|
}
|
|
fmt.Printf("Generating man pages into %s\n", path)
|
|
if err := generateManPages(path); err != nil {
|
|
fmt.Fprintf(os.Stderr, "Failed to generate man pages: %s\n", err.Error())
|
|
}
|
|
}
|