cli

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IconCheck      = "\uf00c" // ✓
	IconCross      = "\uf00d" // ✗
	IconInfo       = "\uf05a" // ℹ
	IconWarning    = "\uf071" // ⚠
	IconSpinner    = "\uf05b" // loading indicator
	IconFile       = "\uf0f9" // file/folder icon
	IconDownload   = "\uf019" // download arrow
	IconUpload     = "\uf093" // upload arrow
	IconFolder     = "\uf07b" // folder
	IconFolderOpen = "\uf07c" // open folder
	IconServer     = "\uf0e2" // server/process
	IconNetwork    = "\uf0c1" // network
	IconDevice     = "\uf537" // device
	IconBell       = "\uf0f3" // notification bell
	IconLock       = "\uf023" // lock/pin
	IconRocket     = "\uf135" // launch/start
	IconStop       = "\uf04d" // stop
	IconGear       = "\uf013" // config/settings
	IconHash       = "\uf489" // fingerprint/hash
	IconChain      = "\uf0c3" // link/chain
	IconStar       = "\uf005" // star/favorite
	IconHeart      = "\uf004" // heart
	IconBolt       = "\uf0e7" // lightning/speed
	IconSearch     = "\uf002" // search/discover
	IconPlus       = "\uf067" // add
	IconMinus      = "\uf068" // remove
	IconArrow      = "\uf061" // arrow left
	IconArrowR     = "\uf178" // arrow right
	IconArrowUp    = "\uf062" // arrow up
	IconArrowDn    = "\uf063" // arrow down
)

Nerd Font icons (requires a Nerd Font patched terminal font). Fallback Unicode emoji equivalents are provided in comments.

Variables

View Source
var (
	SuccessStyle   = lipgloss.NewStyle().Foreground(lipgloss.Color("46")).Bold(true)                  // Green
	ErrorStyle     = lipgloss.NewStyle().Foreground(lipgloss.Color("196")).Bold(true)                 // Red
	WarningStyle   = lipgloss.NewStyle().Foreground(lipgloss.Color("214")).Bold(true)                 // Orange/Yellow
	InfoStyle      = lipgloss.NewStyle().Foreground(lipgloss.Color("39")).Bold(true)                  // Blue
	HeaderStyle    = lipgloss.NewStyle().Foreground(lipgloss.Color("205")).Bold(true).Underline(true) // Pinkish
	MutedStyle     = lipgloss.NewStyle().Foreground(lipgloss.Color("240"))                            // Grey
	HighlightStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("226")).Bold(true)                 // Yellow
)

UI Styles

Functions

func FormatBytes

func FormatBytes(bytes int64) string

FormatBytes formats bytes in human readable format

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats duration in human readable format

func IsContainer added in v0.4.0

func IsContainer() bool

IsContainer returns true if LocalGo is running inside a Docker/Podman container.

func Notify added in v0.4.0

func Notify(title, body string)

Notify sends a native desktop notification. Icon is empty (system default). No-op in container environments.

func PickDevice added in v0.4.0

func PickDevice(devices []*model.Device) *model.Device

PickDevice presents an interactive TUI to select a device. Returns the selected device or nil if canceled.

func PrintError added in v0.4.0

func PrintError(format string, a ...any)

func PrintHeader added in v0.4.0

func PrintHeader(text string)

func PrintInfo added in v0.4.0

func PrintInfo(format string, a ...any)

func PrintSuccess added in v0.4.0

func PrintSuccess(format string, a ...any)

func PrintWarning added in v0.4.0

func PrintWarning(format string, a ...any)

Types

type DeviceInfo

type DeviceInfo struct {
	Alias         string `json:"alias"`
	Version       string `json:"version"`
	DeviceModel   string `json:"deviceModel"`
	DeviceType    string `json:"deviceType"`
	Fingerprint   string `json:"fingerprint"`
	Port          int    `json:"port"`
	Protocol      string `json:"protocol"`
	DownloadDir   string `json:"downloadDir"`
	HasPin        bool   `json:"hasPin"`
	MulticastAddr string `json:"multicastAddr"`
}

DeviceInfo represents device information for output

type MultiProgress added in v0.4.0

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

func NewMultiProgress added in v0.4.0

func NewMultiProgress(totalFiles int64) *MultiProgress

func (*MultiProgress) AddBar added in v0.4.0

func (mp *MultiProgress) AddBar(name string, size int64) func(int64)

func (*MultiProgress) Wait added in v0.4.0

func (mp *MultiProgress) Wait()

type OutputFormat

type OutputFormat string

OutputFormat represents the output format type

const (
	FormatJSON  OutputFormat = "json"
	FormatTable OutputFormat = "table"
	FormatQuiet OutputFormat = "quiet"
)

type OutputWriter

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

OutputWriter handles different output formats

func NewOutputWriter

func NewOutputWriter(format OutputFormat) *OutputWriter

NewOutputWriter creates a new output writer

func (*OutputWriter) Flush

func (ow *OutputWriter) Flush() error

Flush flushes the output writer

func (*OutputWriter) WriteDeviceInfo

func (ow *OutputWriter) WriteDeviceInfo(info DeviceInfo) error

WriteDeviceInfo outputs device information

func (*OutputWriter) WriteDevices

func (ow *OutputWriter) WriteDevices(devices []*model.Device, method string) error

WriteDevices outputs a list of devices in the specified format

func (*OutputWriter) WriteError

func (ow *OutputWriter) WriteError(err error)

WriteError outputs an error message

func (*OutputWriter) WriteMessage

func (ow *OutputWriter) WriteMessage(message string)

WriteMessage outputs a simple message

func (*OutputWriter) WriteProgress

func (ow *OutputWriter) WriteProgress(message string)

WriteProgress outputs progress information

func (*OutputWriter) WriteSuccess

func (ow *OutputWriter) WriteSuccess(message string)

WriteSuccess outputs a success message

func (*OutputWriter) WriteWarning

func (ow *OutputWriter) WriteWarning(message string)

WriteWarning outputs a warning message

type ProgressBar

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

ProgressBar represents a simple progress bar

func NewProgressBar

func NewProgressBar(total int64, prefix string) *ProgressBar

NewProgressBar creates a new progress bar

func (*ProgressBar) Finish

func (pb *ProgressBar) Finish()

Finish completes the progress bar

func (*ProgressBar) Update

func (pb *ProgressBar) Update(current int64)

Update updates the progress bar

Jump to

Keyboard shortcuts

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