collateral

package
v0.0.0-...-7635388 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CobraCommand

func CobraCommand(root *cobra.Command, hdr *doc.GenManHeader) *cobra.Command

CobraCommand returns a Cobra command used to output a tool's collateral files (markdown docs, bash completion & man pages) The root argument must be the root command for the tool.

func CobraCommandWithFilter

func CobraCommandWithFilter(root *cobra.Command, hdr *doc.GenManHeader, p Predicates) *cobra.Command

CobraCommandWithFilter returns a Cobra command used to output a tool's collateral files (markdown docs, bash completion & man pages). It allows passing in a set of predicates to filter out and remove items selectively. The root argument must be the root command for the tool.

func DefaultSelectEnvFn

func DefaultSelectEnvFn(_ env.Var) bool

DefaultSelectEnvFn is used to select all environment variables.

func DefaultSelectMetricFn

func DefaultSelectMetricFn(_ metrics.Exported) bool

DefaultSelectMetricFn is used to seelct all metrics.

func EmitCollateral

func EmitCollateral(root *cobra.Command, c *Control) error

EmitCollateral produces a set of collateral files for a CLI command. You can select to emit markdown to describe a command's function, man pages, YAML descriptions, and bash completion files.

Types

type Control

type Control struct {
	// OutputDir specifies the directory to output the collateral files
	OutputDir string

	// EmitManPages controls whether to produce man pages.
	EmitManPages bool

	// EmitYAML controls whether to produce YAML files.
	EmitYAML bool

	// EmitBashCompletion controls whether to produce bash completion files.
	EmitBashCompletion bool

	// EmitZshCompletion controls whether to produce zsh completion files.
	EmitZshCompletion bool

	// EmitMarkdown controls whether to produce markdown documentation files.
	EmitMarkdown bool

	// EmitHTMLFragmentWithFrontMatter controls whether to produce HTML fragments with Jekyll/Hugo front matter.
	EmitHTMLFragmentWithFrontMatter bool

	// ManPageInfo provides extra information necessary when emitting man pages.
	ManPageInfo doc.GenManHeader

	// Predicates to use to filter environment variables and metrics. If not set, all items will be selected.
	Predicates Predicates
}

Control determines the behavior of the EmitCollateral function

type Predicates

type Predicates struct {
	SelectEnv    SelectEnvFn
	SelectMetric SelectMetricFn
}

Predicates are a set of predicates to apply when generating collaterals.

type SelectEnvFn

type SelectEnvFn func(env.Var) bool

SelectEnvFn is a predicate function for selecting environment variables when generating collateral documents.

type SelectMetricFn

type SelectMetricFn func(metrics.Exported) bool

SelectMetricFn is a predicate function for selecting metrics when generating collateral documents.

Directories

Path Synopsis
Package metrics provides utilities for generating metrics-related collateral for a binary.
Package metrics provides utilities for generating metrics-related collateral for a binary.

Jump to

Keyboard shortcuts

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