cli

package
v0.18.3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig[T Config]() (*T, error)

func SetupConfiguration

func SetupConfiguration(c *cobra.Command)

Types

type AppSettings

type AppSettings struct {
	Name        string
	Description string
	ConfigPath  string // Where this CLI config.yml?
	EnvPrefix   string // environment variable MYAPP_.....
	GitVersion  string
	GitRevision string
}

type CLI

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

func New

func New[T Config](app AppSettings) *CLI

New generates a CLI instance

func (*CLI) Close

func (c *CLI) Close()

func (*CLI) GetRoot

func (c *CLI) GetRoot() *cobra.Command

func (*CLI) GetVersionString

func (c *CLI) GetVersionString() string

func (*CLI) Run

func (c *CLI) Run()

type CleanUpHandler

type CleanUpHandler func()

type Config

type Config interface {
	SetDefaults()
	Validate() error
}

type ConfigMock

type ConfigMock struct {
	Foo string `json:"foo"`
}

func (ConfigMock) SetDefaults

func (c ConfigMock) SetDefaults()

func (ConfigMock) Validate

func (c ConfigMock) Validate() error

type DefaultConfigHandler

type DefaultConfigHandler func()

Jump to

Keyboard shortcuts

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