cli

package module
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlags

func AddFlags(cmd HasFlags, def any) error

func FillSecrets

func FillSecrets(ctx context.Context, client SecretClient, out any) error

func GetConfig

func GetConfig(cmd HasFlags, out any) error

func MustFillSecrets

func MustFillSecrets(ctx context.Context, c SecretClient, out any)

func MustGetConfig

func MustGetConfig(cmd HasFlags, out any)

func RunMain added in v0.4.0

func RunMain[T any](cfg CommandConfig[T], commands ...Registerable)

Types

type CommandConfig added in v0.4.0

type CommandConfig[T any] struct {
	Use           string
	Short         string
	Long          string
	Version       string
	DefaultConfig T
	Filesystems   []fs.FS
}

type CommandRunConfig added in v0.4.0

type CommandRunConfig[T any] struct {
	Config      T
	Filesystems []fs.FS
	Version     string
}

type HasFlags

type HasFlags interface {
	Flags() *pflag.FlagSet
	PersistentFlags() *pflag.FlagSet
	Name() string
}

type Registerable added in v0.4.0

type Registerable interface {
	Register() *cobra.Command
}

func WrapCommand added in v0.4.0

func WrapCommand[T any](cfg CommandConfig[T], cmd func(CommandRunConfig[T])) Registerable

type SecretClient

type SecretClient interface {
	Secret(context.Context, string, any) (secrets.Handle, error)
}

SecretClient is the pared down subset of a secrets.Client that is used by this package.

Jump to

Keyboard shortcuts

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