cli

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 50 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 LoadConfigFromDir = config.LoadFromDir

LoadConfigFromDir loads configuration for a specific project directory without mutating the process (see config.LoadFromDir). Used by gombit contract app --dir. A test var so commands can stub 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, worker, jobs, build, make, generate, db, openapi, contract, client, routes, doctor, config, createsuperuser, version, upgrade). 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