sdk

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package sdk is the public entry point for building Commodore-based CLI binaries.

The package exposes the Commander facade and intentionally keeps internal adapter and role wiring hidden from consumers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	// Use defines the command invocation name.
	Use string
	// Short defines the command summary shown in help output.
	Short string
	// RunE executes command logic and returns an error on failure.
	RunE func(context Context) error
}

Command describes a custom command attached to the generated CLI.

type Commander

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

Commander is the primary SDK facade that bootstraps a Commodore command tree.

func NewCommander

func NewCommander(options Options) *Commander

NewCommander creates a Commander with lazy configuration discovery.

func (*Commander) AddCommand

func (commander *Commander) AddCommand(command *Command)

AddCommand registers a custom command to be attached during Execute.

func (*Commander) Execute

func (commander *Commander) Execute() error

Execute discovers configuration, builds the command tree, and executes it.

func (*Commander) Logger

func (commander *Commander) Logger() Logger

Logger returns the Commander logger.

type Context

type Context struct {
	// WorkingDirectory is the discovered execution root for this Commander.
	WorkingDirectory string
	// contains filtered or unexported fields
}

Context is passed to custom command handlers.

func (Context) Log

func (commandContext Context) Log() Logger

Log returns the configured logger for this command context.

func (Context) Shell

func (commandContext Context) Shell(command string) error

Shell executes command in a shell in the discovered working directory.

type Logger

type Logger = logging.Logger

Logger is the public logging contract used by the Commander facade.

func NewTerminalLogger

func NewTerminalLogger() Logger

NewTerminalLogger creates a logger that writes styled output to stdout/stderr.

type Options

type Options struct {
	// Version sets the root command version shown by Cobra.
	Version string
	// Binary overrides the binary name from configuration.
	Binary string
	// ConfigurationPath explicitly points to a squadron/unit configuration file.
	ConfigurationPath string
	// WorkingDirectory overrides runtime discovery start path.
	WorkingDirectory string
	// Logger sets the logger implementation used by Context.Log and Commander.Logger.
	Logger Logger
}

Options configures Commander initialization and execution behavior.

Jump to

Keyboard shortcuts

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