Documentation
¶
Overview ¶
Package cli provides the command-line interface for the batterdb application. It includes functionality for starting the server, outputting the OpenAPI specification, and handling various command-line options such as setting the port, enabling HTTPS, and persisting the database to disk.
The package uses the kong library for command-line parsing and integrates with the handlers package to manage the server service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CLI ¶
type CLI struct {
Port int32 `short:"p" default:"1205" help:"Port to listen on."`
Store bool `short:"s" help:"Persist the database to disk."`
RepoFile string ` default:"${RepoFile}" help:"The file to persist the database to."`
Secure bool `short:"S" help:"Enable HTTPS."`
Server ServerCmd `default:"1" help:"Start the server." cmd:""`
OpenAPI OpenAPICmd `help:"Output the OpenAPI specification version." cmd:"" optional:""`
Version kong.VersionFlag `short:"v" help:"Show version."`
}
CLI defines the structure for the command-line interface, including options for port, persistence, repository file, and HTTPS, as well as commands for starting the server and outputting the OpenAPI specification.
func (*CLI) AfterApply ¶
AfterApply applies the command-line options to the context and initializes the service.
type OpenAPICmd ¶
type OpenAPICmd struct {
Spec string `default:"3.1" help:"OpenAPI specification version." enum:"3.1,3.0.3"`
}
OpenAPICmd represents the command to output the OpenAPI specification.
func (*OpenAPICmd) Run ¶
func (cmd *OpenAPICmd) Run(ctx *Ctx) error
Run outputs the OpenAPI specification to the context writer.