mirror of https://github.com/docker/cli.git
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>
This commit is contained in:
parent
6393b5fcc7
commit
6f66e15f99
|
@ -33,6 +33,7 @@ func NewCobraAdaptor(clientFlags *cliflags.ClientFlags) CobraAdaptor {
|
||||||
|
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "docker [OPTIONS]",
|
Use: "docker [OPTIONS]",
|
||||||
|
Short: "A self-sufficient runtime for containers",
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
SilenceErrors: true,
|
SilenceErrors: true,
|
||||||
}
|
}
|
||||||
|
@ -131,9 +132,15 @@ func (c CobraAdaptor) Command(name string) func(...string) error {
|
||||||
return nil
|
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}}
|
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:
|
Aliases:
|
||||||
{{.NameAndAliases}}{{end}}{{if .HasExample}}
|
{{.NameAndAliases}}{{end}}{{if .HasExample}}
|
||||||
|
|
Loading…
Reference in New Issue