extension

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: MIT Imports: 6 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewVersionCobraCmd

func NewVersionCobraCmd(opts ...CobraOption) *cobra.Command

NewVersionCobraCmd returns a root cobra.Command for printing CLI version.

Types

type AliasesOptions

type AliasesOptions struct {
	// contains filtered or unexported fields
}

AliasesOptions provides an option to set a custom printer related options across multiple constructors.

func WithAliasesOptions

func WithAliasesOptions(aliases ...string) *AliasesOptions

WithAliasesOptions sets a given aliases for the 'version' command.

func (*AliasesOptions) ApplyToCobraOption

func (c *AliasesOptions) ApplyToCobraOption(options *CobraOptions)

ApplyToCobraOption sets a given option for Cobra.

type CobraOption

type CobraOption interface {
	// ApplyToCobraOption sets a given option for Cobra command.
	ApplyToCobraOption(*CobraOptions)
}

CobraOption provides an option to set a Cobra options.

type CobraOptions

type CobraOptions struct {
	PrinterOptions []printer.ContainerOption
	Aliases        []string
	PreHook        HookFunc
	PostHook       HookFunc
}

CobraOptions holds Cobra command possible customization settings.

type CustomPrinterOptions

type CustomPrinterOptions struct {
	// contains filtered or unexported fields
}

CustomPrinterOptions provides an option to set a custom printer related options across multiple constructors.

func WithPrinterOptions

func WithPrinterOptions(opts ...printer.ContainerOption) *CustomPrinterOptions

WithPrinterOptions sets a custom printer related options.

func (*CustomPrinterOptions) ApplyToCobraOption

func (c *CustomPrinterOptions) ApplyToCobraOption(options *CobraOptions)

ApplyToCobraOption sets a given option for Cobra.

type EnableUpgradeNotice

type EnableUpgradeNotice struct {
	// contains filtered or unexported fields
}

EnableUpgradeNotice provides an option to enable upgrade notice across multiple constructors.

func WithUpgradeNotice

func WithUpgradeNotice(owner, repo string, opts ...upgrade.Options) *EnableUpgradeNotice

WithUpgradeNotice enables upgrade notice.

func (*EnableUpgradeNotice) ApplyToCobraOption

func (c *EnableUpgradeNotice) ApplyToCobraOption(options *CobraOptions)

ApplyToCobraOption sets a given option for Cobra. It's a syntax sugar for:

extension.NewVersionCobraCmd(
	extension.WithPrinterOptions(
		printer.WithUpgradeNotice("mszostok", "codeowners-validator"),
	),
)

so you can just do: extension.NewVersionCobraCmd(

	extension.WithUpgradeNotice("mszostok", "codeowners-validator"),
)

type HookFunc added in v1.1.0

type HookFunc func(ctx context.Context) error

HookFunc represents post execution function signature.

type PostHook added in v1.1.0

type PostHook struct {
	// contains filtered or unexported fields
}

PostHook provides an option to set post execution function across multiple constructors.

func WithPostHook added in v1.1.0

func WithPostHook(fn HookFunc) *PostHook

WithPostHook sets post execution function.

func (*PostHook) ApplyToCobraOption added in v1.1.0

func (c *PostHook) ApplyToCobraOption(options *CobraOptions)

ApplyToCobraOption sets a given option for Cobra.

type PreHook added in v1.1.0

type PreHook struct {
	// contains filtered or unexported fields
}

PreHook provides an option to set pre execution function across multiple constructors.

func WithPreHook added in v1.1.0

func WithPreHook(fn HookFunc) *PreHook

WithPreHook sets pre execution function.

func (*PreHook) ApplyToCobraOption added in v1.1.0

func (c *PreHook) ApplyToCobraOption(options *CobraOptions)

ApplyToCobraOption sets a given option for Cobra.

Jump to

Keyboard shortcuts

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