format

package
v0.0.53 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedFormats = []string{
	string(Text),
	string(JSON),
}

SupportedFormats is a list of all supported output formats as strings

Functions

func FormatOutput

func FormatOutput(content string, formatStr string) string

FormatOutput formats the AI response according to the specified format

func GetHelpText

func GetHelpText() string

GetHelpText returns a formatted string describing all supported formats

func IsValid

func IsValid(s string) bool

IsValid checks if the provided format string is supported

Types

type OutputFormat

type OutputFormat string

OutputFormat represents the output format type for non-interactive mode

const (
	// Text format outputs the AI response as plain text.
	Text OutputFormat = "text"

	// JSON format outputs the AI response wrapped in a JSON object.
	JSON OutputFormat = "json"
)

func Parse

func Parse(s string) (OutputFormat, error)

Parse converts a string to an OutputFormat

func (OutputFormat) String

func (f OutputFormat) String() string

String returns the string representation of the OutputFormat

type Spinner

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

Spinner wraps the bubbles spinner for non-interactive mode

func NewSpinner

func NewSpinner(message string) *Spinner

NewSpinner creates a new spinner with the given message

func (*Spinner) Start

func (s *Spinner) Start()

Start begins the spinner animation

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop ends the spinner animation

Jump to

Keyboard shortcuts

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