gen

package
v1.0.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CLI

func CLI(doc *spec.Document, options ...GenCLIOption) (map[string][]byte, error)

CLI generates CLI boilerplate Go files from the given OpenCLI document. It returns a map of relative file paths to their generated byte content. All generated files are placed under the gencli/ directory and belong to a single gencli package, so no cross-package import paths are required.

func Docs

func Docs(doc *spec.Document, options ...GenDocsOption) ([]byte, error)

Docs generates documentation based on the given OpenCLI document

Types

type CLIFramework

type CLIFramework string

CLIFramework is the target framework for CLI code generation.

const (
	// CobraFramework generates code for the github.com/spf13/cobra framework.
	CobraFramework CLIFramework = "COBRA"
)

func (CLIFramework) IsValid

func (f CLIFramework) IsValid() bool

IsValid reports whether f is a supported CLIFramework.

type DocFormat

type DocFormat string

DocFormat is the output format for generated documentation.

const (
	Markdown   DocFormat = "MARKDOWN"
	HTML_PAGE  DocFormat = "HTML_PAGE"
	HTML_EMBED DocFormat = "HTML_EMBED"
	ManPage    DocFormat = "MAN"
)

func (DocFormat) IsValid

func (f DocFormat) IsValid() bool

type GenCLIOption

type GenCLIOption func(*genCLIOptions)

GenCLIOption is a functional option to configure the CLI function.

func GenCLIWithFramework

func GenCLIWithFramework(f CLIFramework) GenCLIOption

GenCLIWithFramework sets the target CLI framework.

type GenDocsOption

type GenDocsOption func(*genDocsOptions)

GenDocsOption is a functional option to configure the GenDocs function

func DocsWithFormat

func DocsWithFormat(format DocFormat) GenDocsOption

DocsWithFormat sets the desired output format of the documentation.

func DocsWithoutBadge

func DocsWithoutBadge() GenDocsOption

DocsWithoutBadge option will remove shields.io badge that indicates compliance with the OpenCLI Spec prepended to markdown documents by default.

func DocsWithoutFooter

func DocsWithoutFooter() GenDocsOption

DocsWithoutFooter option will remove the `generated by OpenCLI` footer appended to the documents by default.

Jump to

Keyboard shortcuts

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