cli

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package cli holds the small amount of CLI-level glue the speechkit-server and speechkit-voice binaries share. Each binary keeps its own `cmd/<name>/main.go` (so go install + ldflags work the conventional way), but the actual flag parsing, config loading, logger wiring, and lifecycle handoff to internal/server/core lives here. That keeps the two mains essentially boilerplate — they differ only in the default mode set and the log banner.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(opts Options)

Run is the canonical entry point each cmd/<name>/main.go calls. It owns the entire process lifecycle: parse flags, load config, set up logging, hand off to core.Run, log the exit reason, return. It does not return an exit code — it calls os.Exit on failure so callers stay one line.

The body delegates to runOnce so we can keep `defer` clean: any non-zero exit code goes through os.Exit(code) at the end of Run, after all of runOnce's deferred cleanup has run. Calling os.Exit directly inside runOnce would short-circuit the deferred signal stop() that core.NotifySignals registers.

Types

type Options

type Options struct {
	// Banner is the short program name printed in startup logs and the
	// CLI usage line. "speechkit-server" or "speechkit-voice".
	Banner string

	// Version is set at build time via -ldflags="-X main.version=...".
	// Each binary's main.go forwards its own version string here.
	Version string

	// DefaultModes is the mode set used when neither `[server].modes`
	// in config nor the `--modes` flag are provided. The full server
	// passes nil (= "all three"); the voice-only binary passes
	// []string{"voiceagent"}.
	DefaultModes []string
}

Options describes the per-binary defaults each main supplies.

Jump to

Keyboard shortcuts

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