neomacli

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package neomacli provides a CLI harness for running neoma-based API servers with graceful shutdown, signal handling, and customizable options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithOptions

func WithOptions[Options any](f func(cmd *cobra.Command, args []string, options *Options)) func(*cobra.Command, []string)

WithOptions returns a cobra run function that extracts the parsed options from the command context and passes them to f.

Types

type CLI

type CLI interface {
	Run()
	Root() *cobra.Command
}

CLI is the interface for a runnable command-line application.

func New

func New[O any](onParsed func(Hooks, *O), opts ...Option) CLI

New creates a new CLI instance that parses the given options type from flags and environment variables, then calls onParsed to set up the server.

type Hooks

type Hooks interface {
	OnStart(func())
	OnStop(func())
}

Hooks allows registering callbacks that run when the server starts and stops.

type Logger

type Logger interface {
	Println(args ...any)
}

Logger is the interface used by the CLI for printing status messages.

type Option

type Option func(*cliConfig)

Option is a functional option for configuring the CLI.

func WithLogger

func WithLogger(l Logger) Option

WithLogger returns an Option that sets the logger used by the CLI.

Jump to

Keyboard shortcuts

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