1
0
mirror of https://github.com/docker/cli.git synced 2026-01-18 08:21:31 +03:00

Add a script to generate man pages from cobra commands.

Use the generate.sh script instead of md2man directly.
Update Dockerfile for generating man pages.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 6f66e15f99
Component: cli
This commit is contained in:
Daniel Nephin
2016-06-09 11:33:28 -04:00
parent 80a0e584b9
commit a303f0b676

View File

@@ -33,6 +33,7 @@ func NewCobraAdaptor(clientFlags *cliflags.ClientFlags) CobraAdaptor {
var rootCmd = &cobra.Command{
Use: "docker [OPTIONS]",
Short: "A self-sufficient runtime for containers",
SilenceUsage: true,
SilenceErrors: true,
}
@@ -131,9 +132,15 @@ func (c CobraAdaptor) Command(name string) func(...string) error {
return nil
}
// GetRootCommand returns the root command. Required to generate the man pages
// and reference docs from a script outside this package.
func (c CobraAdaptor) GetRootCommand() *cobra.Command {
return c.rootCmd
}
var usageTemplate = `Usage: {{if not .HasSubCommands}}{{.UseLine}}{{end}}{{if .HasSubCommands}}{{ .CommandPath}} COMMAND{{end}}
{{with or .Long .Short }}{{. | trim}}{{end}}{{if gt .Aliases 0}}
{{ .Short | trim }}{{if gt .Aliases 0}}
Aliases:
{{.NameAndAliases}}{{end}}{{if .HasExample}}