cli

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package cli turns a scaffold service or stack into a small command-line application.

The package intentionally accepts the core scaffold.Service interface. Plain services can be started, stopped, and used with the generated commands. Stacks expose richer commands because they can provide environment variables, endpoints, summaries, running-state discovery, and Docker resource discovery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fprintf

func Fprintf(ctx context.Context, format string, args ...any)

func Fprintln

func Fprintln(ctx context.Context, args ...any)

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func New

func New(name string, service scaffold.Service, options ...Option) *App

New creates a command-line controller for a scaffold service or stack. Stacks expose the richest command set because they can report summaries, environment variables, endpoints, and Docker resources.

func (*App) MustRun

func (app *App) MustRun(args []string)

func (*App) Run

func (app *App) Run(args []string) int

type Command

type Command struct {
	Name string
	Help string
	Run  func(context.Context, scaffold.Service, []string) error
}

type CommandProvider

type CommandProvider interface {
	CLICommands() []Command
}

type Option

type Option func(*App)

func WithCommand

func WithCommand(command Command) Option

func WithCommands

func WithCommands(commands ...Command) Option

func WithDescription

func WithDescription(description string) Option

func WithEnvFile

func WithEnvFile(path string) Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

func WithWriters

func WithWriters(out io.Writer, err io.Writer) Option

type ServiceStatus

type ServiceStatus struct {
	Path    string
	Running bool
	Known   bool
}

type StatusReport

type StatusReport struct {
	Name      string
	Known     bool
	Running   bool
	Services  []ServiceStatus
	Resources scaffold.ResourceStatus
}

Jump to

Keyboard shortcuts

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