doc

package
v0.50.0-beta2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const AnnotationName = "docs_category"

Annotation used in top level commands to define categories

Variables

This section is empty.

Functions

func CollectNames

func CollectNames(cmd *cobra.Command, options *GeneratorOptions) []string

func CreateAssembly

func CreateAssembly(assembliesDir string, files []string) error

func CreateIndexFile

func CreateIndexFile(rootCmd *cobra.Command, generationOptions *GeneratorOptions) error

func CreateModularDocs

func CreateModularDocs() error

CreateModularDocs Create Modular Documentation from the CLI generated docs

func CreateModules

func CreateModules(modulesDir string, commandAdocFiles []string) ([]string, error)

func FlagUsages

func FlagUsages(f *pflag.FlagSet) string

FlagUsages returns a string containing the usage information for all flags in the FlagSet.

func GenAsciidoc

func GenAsciidoc(cmd *cobra.Command, w io.Writer) error

GenAsciidoc creates asciidocs documentation

func GenAsciidocCustom

func GenAsciidocCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error

GenAsciidocCustom creates custom asciidoc documentation

func GenAsciidocTree

func GenAsciidocTree(cmd *cobra.Command, options *GeneratorOptions) error

GenAsciidocTree will generate a markdown page for this command and all descendants in the directory given. The header may be nil. This function may not work correctly if your command names have `-` in them. If you have `cmd` with two subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third`, it is undefined which help output will be in the file `cmd-sub-third.1`.

func GenAsciidocTreeCustom

func GenAsciidocTreeCustom(cmd *cobra.Command, options *GeneratorOptions) error

GenAsciidocTreeCustom

func GetNormalizedCommandPath

func GetNormalizedCommandPath(c *cobra.Command) string

GetNormalizedCommandPath returns name of the command without cmd name and with underscore instead of spaces

func GetShortCommandPath

func GetShortCommandPath(c *cobra.Command) string

Types

type CommandGroup

type CommandGroup struct {
	Description string
	Commands    []string
}

type GeneratorOptions

type GeneratorOptions struct {
	// Directory to write the documentation files
	Dir string

	// FileNameGenerator - provides custom file name for each documentation file
	FileNameGenerator func(cmd *cobra.Command) string

	// FilePrepender - Prepend content to the generated file (add header)
	FilePrepender func(string) string

	// LinkHandler - function to handle links that lets you to transform them to different format
	LinkHandler func(string) string

	// GenerateIndex - generate index file
	GenerateIndex bool

	// IndexLocation - name and folder of the assembly file (typically ./README.adoc)
	IndexFile string
}

GeneratorOptions all modifiers for the generator

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL