cmd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SpinnerFrames = []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}

SpinnerFrames contains the Braille animation frames for loading spinners. Used consistently across chat.go and video.go for visual feedback.

Functions

func Execute

func Execute()

func ProcessImageResult

func ProcessImageResult(result *ImageResult, cfg ImageOutputConfig, handler ImageOutputHandler, saver *ImageSaver) error

ProcessImageResult processes the image result and handles all output operations.

Types

type AudioCache

type AudioCache struct {
	Chunks map[int]string `json:"chunks"` // chunk index -> transcribed text
}

AudioCache stores partial transcription results for resume support.

type DefaultImageOutputHandler

type DefaultImageOutputHandler struct{}

DefaultImageOutputHandler prints to stdout/stderr.

func (*DefaultImageOutputHandler) PrintCopyError

func (h *DefaultImageOutputHandler) PrintCopyError(err error)

func (*DefaultImageOutputHandler) PrintCopySuccess

func (h *DefaultImageOutputHandler) PrintCopySuccess()

func (*DefaultImageOutputHandler) PrintSaveError

func (h *DefaultImageOutputHandler) PrintSaveError(err error)

func (*DefaultImageOutputHandler) PrintSaveSuccess

func (h *DefaultImageOutputHandler) PrintSaveSuccess(path string)

func (*DefaultImageOutputHandler) PrintSuccess

func (h *DefaultImageOutputHandler) PrintSuccess(result *ImageResult)

func (*DefaultImageOutputHandler) PrintViewerError

func (h *DefaultImageOutputHandler) PrintViewerError(err error)

type ImageOutputConfig

type ImageOutputConfig struct {
	Copy   bool
	Show   bool
	Output string
}

ImageOutputConfig holds configuration for image output operations.

type ImageOutputHandler

type ImageOutputHandler interface {
	PrintSuccess(result *ImageResult)
	PrintSaveError(err error)
	PrintCopyError(err error)
	PrintViewerError(err error)
	PrintSaveSuccess(path string)
	PrintCopySuccess()
}

ImageOutputHandler handles output operations for image results.

type ImageResult

type ImageResult struct {
	Data       app.ImageData
	Prompt     string
	Size       string
	OutputPath string
	SaveError  error
}

ImageResult represents the structured result of image generation.

type ImageSaveResult

type ImageSaveResult struct {
	FilePath string
	URL      string
	Size     int64
	Error    error
}

ImageSaveResult contains the result of saving an image.

type ImageSaver

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

ImageSaver handles saving images to disk.

func NewImageSaver

func NewImageSaver(httpClient app.HTTPDoer) *ImageSaver

NewImageSaver creates an ImageSaver with the provided HTTP client.

func (*ImageSaver) Save

func (s *ImageSaver) Save(url, filePath string) *ImageSaveResult

Save downloads an image from URL and saves to file.

type ImageSource

type ImageSource int

ImageSource represents the type of image source (URL or local file)

const (
	ImageSourceURL ImageSource = iota
	ImageSourceFile
)

type RunConfig

type RunConfig struct {
	FilePath   string
	Think      bool
	JSONOutput bool
	Search     bool
	Verbose    bool
}

RunConfig holds runtime configuration collected from flags and config file. Passed to functions instead of accessing globals directly.

func NewRunConfig

func NewRunConfig() RunConfig

NewRunConfig creates RunConfig from viper settings (collected after flag parsing).

type TempFileManager

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

TempFileManager tracks temporary files for cleanup.

func (*TempFileManager) Add

func (m *TempFileManager) Add(path string)

Add registers a file for cleanup.

func (*TempFileManager) AddAll

func (m *TempFileManager) AddAll(paths []string)

AddAll registers multiple files for cleanup.

func (*TempFileManager) Cleanup

func (m *TempFileManager) Cleanup()

Cleanup removes all registered files.

type Theme

type Theme struct {
	// Colors
	Primary lipgloss.Color
	Success lipgloss.Color
	Error   lipgloss.Color
	Subtle  lipgloss.Color
	Accent  lipgloss.Color
	White   lipgloss.Color
	Gold    lipgloss.Color
	Dark    lipgloss.Color

	// Common styles
	Title     lipgloss.Style
	Section   lipgloss.Style
	Divider   lipgloss.Style
	Dim       lipgloss.Style
	Info      lipgloss.Style
	ErrorText lipgloss.Style
	HelpText  lipgloss.Style

	// Chat-specific styles
	Prompt  lipgloss.Style
	AILabel lipgloss.Style

	// Command/flag styles (for help)
	Command     lipgloss.Style
	Flag        lipgloss.Style
	Description lipgloss.Style
	Example     lipgloss.Style

	// Search result styles
	ResultTitle lipgloss.Style
	ResultLink  lipgloss.Style
	ResultDate  lipgloss.Style
}

Theme holds all lipgloss styles for consistent UI across commands. Centralizes color definitions and style configuration.

func DefaultTheme

func DefaultTheme() *Theme

DefaultTheme returns the default theme with Z.AI colors.

func (*Theme) SpinnerStyle

func (t *Theme) SpinnerStyle() lipgloss.Style

SpinnerStyle returns a style for the thinking spinner.

Jump to

Keyboard shortcuts

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