Help us shape the future of Go! Take the 2026 Go Developer Survey

command

package
v0.0.0-...-4a6edd7 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitCode

func ExitCode(err error) int

ExitCode maps a command error to the process status used by devctl.

func Shutdown

func Shutdown(ctx context.Context, container *deps.Container) error

Shutdown closes resources with the common fresh bounded context convention.

Types

type CommonCmdOpts

type CommonCmdOpts struct {
	// ManifestPath selects a manifest explicitly; an empty value enables project discovery.
	ManifestPath string
	// JSON selects JSON events instead of the default console encoding.
	JSON bool
	// Verbose enables debug diagnostics and raw error causes.
	Verbose bool
}

CommonCmdOpts contains the delivery options shared by every executable leaf.

func (*CommonCmdOpts) CommonFlags

func (o *CommonCmdOpts) CommonFlags() []cli.Flag

CommonFlags binds shared flags directly to the owning leaf's options.

func (*CommonCmdOpts) NewStderrLogger

func (o *CommonCmdOpts) NewStderrLogger(command *cli.Command) *zap.Logger

NewStderrLogger creates the leaf diagnostic logger using the selected encoding and verbosity.

func (*CommonCmdOpts) NewStdoutLogger

func (o *CommonCmdOpts) NewStdoutLogger(command *cli.Command) *zap.Logger

NewStdoutLogger creates the leaf result logger using the selected encoding.

type ErrorOption

type ErrorOption func(*errorReport)

ErrorOption adds caller-approved facts to an error event.

func WithPartialResult

func WithPartialResult(result any) ErrorOption

WithPartialResult attaches caller-approved completed work to recovery details.

type ErrorReporter

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

ErrorReporter owns safe CLI error presentation and process exit classification.

func NewErrorReporter

func NewErrorReporter(logger *zap.Logger, verbose bool) *ErrorReporter

NewErrorReporter creates a reporter that writes final errors through logger.

func (*ErrorReporter) ReportError

func (r *ErrorReporter) ReportError(err error, options ...ErrorOption) error

ReportError writes one final safe error event and returns a silent error with the same cause.

type ValidationIssueDTO

type ValidationIssueDTO struct {
	// Code identifies the stable validation rule that failed.
	Code string `json:"code"`
	// Path identifies the affected project file when available.
	Path string `json:"path,omitempty"`
	// Line and Column are one-based source coordinates; zero means unavailable.
	Line   int `json:"line,omitempty"`
	Column int `json:"column,omitempty"`
	// Field identifies the affected manifest field when available.
	Field string `json:"field,omitempty"`
	// Parameters contains rule-specific, presentation-safe facts.
	Parameters *ValidationParametersDTO `json:"parameters,omitempty"`
}

ValidationIssueDTO is the safe CLI representation of one project validation issue.

func ValidationIssueDTOs

func ValidationIssueDTOs(values []projectdomain.Issue) []ValidationIssueDTO

ValidationIssueDTOs maps presentation-neutral issues to their shared CLI form.

type ValidationParametersDTO

type ValidationParametersDTO struct {
	Expected string `json:"expected,omitempty"`
	Actual   string `json:"actual,omitempty"`
	Value    string `json:"value,omitempty"`
}

ValidationParametersDTO carries issue-specific facts safe for CLI output.

Jump to

Keyboard shortcuts

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