cli

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package cli is the core of a Go stack's tool: the commands every stack answers, with what differs by framework in a Preset.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main(args []string, p Preset) int

Main runs the command args name in the working directory, and is the exit code.

func Run

func Run(dir string, args []string, p Preset, stdout, stderr io.Writer) int

Run is Main for the service in dir, writing to stdout and stderr.

func Version

func Version(path string) string

Version is the version the running binary was built with of the module at path, "" where it holds none.

Types

type Command

type Command struct {
	Name string
	// Operands follow the name in the usage.
	Operands    string
	Description string
	Run         func(args []string) error
}

Command is one of an adapter's own. It works where the process does: Run's dir is for rules and agents.

type Preset

type Preset struct {
	// Tool is how a service runs the adapter: `go tool specrig`.
	Tool string
	// Version is the adapter with its version, as specrig.md names what wrote it.
	Version string
	Layout  rules.Layout
	// Areas are the stack's defaults for the service in dir.
	Areas func(dir string) ([]rules.Area, error)
	// Slots are agents/1's, but for those the core fills.
	Slots map[string]string
	// Own are the sections of specrig.md after Rule #11.
	Own []string
	// Commands are the adapter's own, beside init, rules and agents.
	Commands []Command
	// Init lays out what the stack's suite needs, after init's own files, where
	// the process works.
	Init func() error
}

Preset is what a framework's adapter hands the core.

Jump to

Keyboard shortcuts

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