application

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddConfigurationFlags

func AddConfigurationFlags(cmd *cobra.Command, f *configuration.Flags, p configuration.Params)

func AddLogFlags added in v0.2.2

func AddLogFlags(cmd *cobra.Command, f *logging.Flags, p logging.Params)

func AddLogTargetFlag

func AddLogTargetFlag(cmd *cobra.Command, f *logging.Flags, p logging.Params)

AddLogTargetFlag Flag "logtarget" can be added to subcommands to enable specification of the log target It is not added to the root command by default, as it cannot be hidden from subcommands that want to override the behavior

func AddLogTargetPersistentFlag added in v0.2.5

func AddLogTargetPersistentFlag(cmd *cobra.Command, f *logging.Flags, p logging.Params)

AddLogTargetPersistentFlag "logtarget" will be added as a persistent flag to subcommands to enable specification of the log target

func GetLogger

func GetLogger(cmd *cobra.Command, w io.Writer, p logging.Params) (*slog.Logger, error)

Types

type Application

type Application struct {
	Command *cobra.Command
}

func NewApplication

func NewApplication(p Params) *Application

func (*Application) RegisterCommands

func (a *Application) RegisterCommands(c []Commander, f func(command *cobra.Command))

func (*Application) Run

func (a *Application) Run() error

type Command

type Command struct {
	Cobra       *cobra.Command
	SubCommands []Commander
	Configure   func(cmd *cobra.Command)
}

func (Command) Initialize

func (c Command) Initialize(f func(cmd *cobra.Command)) *cobra.Command

type Commander

type Commander interface {
	Initialize(f func(command *cobra.Command)) *cobra.Command
}

type Flags added in v0.2.2

type Flags struct {
	Config *configuration.Flags
	Log    *logging.Flags
}

func NewFlags added in v0.2.2

func NewFlags() *Flags

type Params added in v0.2.2

type Params struct {
	Use           string
	Short         string
	Long          string
	Version       string
	Configuration configuration.Params
	Log           logging.Params
}
var (
	GlobalParams Params
)

Jump to

Keyboard shortcuts

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