Documentation ¶
Overview ¶
Package app provides structures and functions to create and manage CLI applications.
Index ¶
- type App
- func (a *App) LoadDefaultLogger() error
- func (a *App) LoadDefaultOptions(paths []string, skipFlags bool) (*options.Options, error)
- func (a *App) LoadDefaultServices(exclude ...service.ServiceType) error
- func (a *App) RegisterCommands(commands []*cli.Command) error
- func (a *App) Run(args []string) error
- type Descriptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { *cli.App // contains filtered or unexported fields }
App represents an application with CLI commands. It embeds *cli.App from the urfave/cli package and adds context support.
func New ¶
func New(ctx context.Context, desc Descriptor) (*App, error)
New initializes a new App instance with the provided context and descriptor. It returns an error if the initialization fails.
func NewDefaultApp ¶
NewDefaultApp creates and returns a new instance of the App configured with default settings. This function sets up the application with predefined descriptors such as the application name, usage, version, and authors. The ctx parameter is the context to control the application lifecycle, while the version parameter specifies the current version of the application. It returns a pointer to an initialized App and any error encountered during the App creation process.
func (*App) LoadDefaultLogger ¶
func (*App) LoadDefaultOptions ¶
func (*App) LoadDefaultServices ¶
func (a *App) LoadDefaultServices(exclude ...service.ServiceType) error
LoadDefaultServices loads services in the order specified by orderedServiceTypes
func (*App) RegisterCommands ¶
RegisterCommands adds a slice of *cli.Command to the application. It returns an error if the application is not initialized.