ui

package
v0.1.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Copyright (c) 2025 Nexlayer. All rights reserved.n// Use of this source code is governed by an MIT-stylen// license that can be found in the LICENSE file.nn

Package ui provides utilities for rendering styled text and UI elements in the CLI. It uses lipgloss and color packages to create a consistent and visually appealing command-line interface with support for colors, borders, and formatted tables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderBox

func RenderBox(text string) string

RenderBox renders text in a box

func RenderError

func RenderError(msg string) string

RenderError formats an error message in a bold red style using errorStyle. Returns the formatted error message string.

func RenderHighlight

func RenderHighlight(text string) string

RenderHighlight renders text in the highlight style

func RenderInfo

func RenderInfo(msg string) string

RenderInfo formats an informational message in blue using color.BlueString. Returns the formatted informational message string.

func RenderSuccess

func RenderSuccess(msg string) string

RenderSuccess formats a success message in a bold green style using successStyle. Returns the formatted success message string.

func RenderTable

func RenderTable(headers []string, rows [][]string) string

RenderTable creates a textual table from headers and rows.

func RenderTitle

func RenderTitle(title string) string

RenderTitle renders a title with an optional subtitle.

func RenderTitleWithBorder

func RenderTitleWithBorder(title string) string

RenderTitleWithBorder renders a title enclosed in a decorative border using titleStyle. Returns the formatted title string with a border.

func RenderWarning

func RenderWarning(msg string) string

RenderWarning formats a warning message in yellow using color.YellowString. Returns the formatted warning message string.

func RenderWelcome

func RenderWelcome() string

RenderWelcome returns the welcome message

func SelectTemplate

func SelectTemplate(detectedTemplate string) (string, error)

Types

type Manager

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

Manager handles UI interactions and progress tracking

func NewManager

func NewManager(out io.Writer) *Manager

NewManager creates a new UI manager

func (*Manager) CompleteProgress

func (m *Manager) CompleteProgress(id string, msg string)

CompleteProgress marks progress as complete for a given ID

func (*Manager) FailProgress

func (m *Manager) FailProgress(id string, msg string)

FailProgress marks progress as failed for a given ID

func (*Manager) StartProgress

func (m *Manager) StartProgress(id string, msg string)

StartProgress starts tracking progress for a given ID

type ProgressTracker

type ProgressTracker interface {
	Update(progress float64, msg string)
	Complete()
}

ProgressTracker defines the interface for tracking progress

Jump to

Keyboard shortcuts

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