diff --git a/cmd/frostfs-adm/internal/modules/root.go b/cmd/frostfs-adm/internal/modules/root.go index fd1517f90..0fa0f7f69 100644 --- a/cmd/frostfs-adm/internal/modules/root.go +++ b/cmd/frostfs-adm/internal/modules/root.go @@ -45,7 +45,7 @@ func init() { rootCmd.AddCommand(storagecfg.RootCmd) rootCmd.AddCommand(autocomplete.Command("frostfs-adm")) - rootCmd.AddCommand(gendoc.Command(rootCmd)) + rootCmd.AddCommand(gendoc.Command(rootCmd, gendoc.Options{})) } func Execute() error { diff --git a/cmd/frostfs-cli/modules/root.go b/cmd/frostfs-cli/modules/root.go index 93513479a..808bd6d07 100644 --- a/cmd/frostfs-cli/modules/root.go +++ b/cmd/frostfs-cli/modules/root.go @@ -85,7 +85,7 @@ func init() { rootCmd.AddCommand(objectCli.Cmd) rootCmd.AddCommand(containerCli.Cmd) rootCmd.AddCommand(tree.Cmd) - rootCmd.AddCommand(gendoc.Command(rootCmd)) + rootCmd.AddCommand(gendoc.Command(rootCmd, gendoc.Options{})) } func entryPoint(cmd *cobra.Command, _ []string) { diff --git a/cmd/frostfs-lens/root.go b/cmd/frostfs-lens/root.go index ab937addc..96ade802c 100644 --- a/cmd/frostfs-lens/root.go +++ b/cmd/frostfs-lens/root.go @@ -38,7 +38,7 @@ func init() { blobovnicza.Root, meta.Root, writecache.Root, - gendoc.Command(command), + gendoc.Command(command, gendoc.Options{}), ) } diff --git a/pkg/util/gendoc/gendoc.go b/pkg/util/gendoc/gendoc.go index e7228d0e0..14361d8f6 100644 --- a/pkg/util/gendoc/gendoc.go +++ b/pkg/util/gendoc/gendoc.go @@ -23,8 +23,25 @@ const ( extensionFlag = "extension" ) +// Options for doc generation. +type Options struct { + // Parameters for man generation. By default use (1) section and `FrostFS` source. + ManHeader *doc.GenManHeader +} + +func (o *Options) fillDefaults() { + if o.ManHeader == nil { + o.ManHeader = &doc.GenManHeader{ + Section: "1", + Source: "FrostFS", + } + } +} + // Command returns command which generates user documentation for the argument. -func Command(rootCmd *cobra.Command) *cobra.Command { +func Command(rootCmd *cobra.Command, opts Options) *cobra.Command { + opts.fillDefaults() + gendocCmd := &cobra.Command{ Use: "gendoc