cli

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 38 Imported by: 0

Documentation

Overview

Package cli is the Cobra command tree for `gombit` (D13 / ADR-014).

The framework binary (`cmd/gombit`) and generated application binaries (`cmd/gombit` inside a `gombit new` app) share NewRoot. Apps attach feature-package management commands with AddCommand — the only supported registration path. There is no second command router and no reflection discovery of commands.

Index

Constants

View Source
const DevVersion = "dev"

DevVersion is reported when the binary carries neither ldflags nor usable module build info (a plain `go run ./cmd/gombit` or `go build` from source).

Variables

View Source
var (
	Version   = ""
	Commit    = ""
	BuildDate = ""
)

Build metadata. Release binaries stamp these with -ldflags, e.g.

-X github.com/gombit-dev/gombit/cli.Version=v0.1.0

When they are empty the values fall back to the module build info recorded by `go install`, so `go install ...@v0.1.0` still self-reports v0.1.0.

View Source
var LoadConfig = config.Load

LoadConfig is the typed config loader used by doctor, config show, db, and dev. Tests may replace it.

View Source
var (

	// MaxOpenAPISize is the fetch cap for gombit openapi generate.
	MaxOpenAPISize int64 = defaultMaxOpenAPISize
)
View Source
var RunBuild = build.Run

RunBuild performs gombit build --embed. Tests may replace it.

View Source
var RunDev = dev.Run

RunDev starts the API and Vite frontend. Tests may replace it.

Functions

func AddCommand

func AddCommand(root *Command, cmds ...*Command)

AddCommand attaches cmds to root via Cobra AddCommand. This is the only supported registration path for app-owned management commands.

func Execute

func Execute(ctx context.Context, args []string, stdout io.Writer, stderr io.Writer) error

Execute runs a fresh framework root. The framework binary uses this.

func ExecuteRoot

func ExecuteRoot(ctx context.Context, root *Command, args []string) error

ExecuteRoot runs an already-configured root (framework tree plus any app-registered commands). Generated cmd/gombit uses this after product.RegisterCommands(root).

Types

type Command

type Command = cobra.Command

Command is the Cobra command type. App-registered management commands attach with AddCommand (D13 / ADR-014).

func NewRoot

func NewRoot(stdout io.Writer, stderr io.Writer) *Command

NewRoot returns the framework Cobra tree (new, dev, build, make, db, openapi, client, routes, doctor, config, createsuperuser, version). Generated apps call NewRoot, then feature-package RegisterCommands, then ExecuteRoot.

Jump to

Keyboard shortcuts

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