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

output

package
v0.6.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: 9 Imported by: 0

Documentation

Overview

Package output provides output formatting for the OmniVault CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatListItem

func FormatListItem(item *daemon.SecretListItem, showFullTags bool) string

FormatListItem formats a secret list item as a string.

func ShellExport

func ShellExport(key, value string) string

ShellExport formats a key-value pair as a shell export statement.

func ShellQuote

func ShellQuote(s string) string

ShellQuote quotes a string for safe shell use. Uses single quotes with proper escaping of embedded single quotes.

func ShellSafeKey

func ShellSafeKey(s string) string

ShellSafeKey converts a string to a safe shell variable name. - Replaces non-alphanumeric characters with underscores - Prepends underscore if string starts with a digit - Converts to uppercase

Types

type Format

type Format int

Format represents the output format type.

const (
	// FormatText is the default human-readable format.
	FormatText Format = iota
	// FormatJSON outputs JSON.
	FormatJSON
	// FormatYAML outputs YAML.
	FormatYAML
	// FormatShell outputs shell-sourceable format.
	FormatShell
)

func ParseFormat

func ParseFormat(s string) Format

ParseFormat parses a format string into a Format. Returns FormatText for unrecognized formats.

func (Format) IsStructured

func (f Format) IsStructured() bool

IsStructured returns true if the format outputs structured data (JSON/YAML).

func (Format) String

func (f Format) String() string

String returns the string representation of the format.

type Writer

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

Writer writes formatted output.

func NewWriter

func NewWriter(format Format) *Writer

NewWriter creates a new Writer with the specified format.

func NewWriterWithOutput

func NewWriterWithOutput(format Format, w io.Writer) *Writer

NewWriterWithOutput creates a new Writer with a custom output destination.

func (*Writer) Format

func (w *Writer) Format() Format

Format returns the writer's format.

func (*Writer) WriteList

func (w *Writer) WriteList(resp *daemon.ListResponse, showMetadata bool) error

WriteList writes a list response in the configured format.

func (*Writer) WriteSearch

func (w *Writer) WriteSearch(resp *daemon.SearchResponse) error

WriteSearch writes a search response in the configured format.

func (*Writer) WriteSecret

func (w *Writer) WriteSecret(secret *daemon.SecretResponse, fieldName string) error

WriteSecret writes a secret in the configured format. If fieldName is non-empty, only that field is output.

func (*Writer) WriteStatus

func (w *Writer) WriteStatus(status *daemon.StatusResponse, daemonRunning bool) error

WriteStatus writes a status response in the configured format.

Jump to

Keyboard shortcuts

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