response

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package response provides a structured success-response helper that is symmetric with the error envelope in cmd/internal/errors. When the active --output mode is json or yaml the helper marshals a SuccessEnvelope to stdout; otherwise it falls back to the plain-text logger.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleSuccess

func HandleSuccess(ctx *context.Context, cmd *cobra.Command, message string, data map[string]any)

HandleSuccess emits a structured success response when --output is json or yaml, and falls back to logger.Log().PlainTextSuccess for plain-text mode.

Types

type ResultDetail

type ResultDetail struct {
	Message string         `json:"message"        yaml:"message"`
	Data    map[string]any `json:"data,omitempty" yaml:"data,omitempty"`
}

ResultDetail is the structured body inside a SuccessEnvelope.

type SuccessEnvelope

type SuccessEnvelope struct {
	Result ResultDetail `json:"result" yaml:"result"`
}

SuccessEnvelope is the top-level JSON/YAML payload for structured success responses.

Jump to

Keyboard shortcuts

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