Documentation
¶
Index ¶
- Constants
- Variables
- func AnonymizeString(s string) string
- func AnonymizedAlias(device *model.Device) string
- func FormatBytes(bytes int64) string
- func FormatDuration(d time.Duration) string
- func IsContainer() bool
- func Notify(title, body string)
- func PickDevice(devices []*model.Device, private bool) *model.Device
- func PrintError(format string, a ...any)
- func PrintHeader(text string)
- func PrintInfo(format string, a ...any)
- func PrintSuccess(format string, a ...any)
- func PrintWarning(format string, a ...any)
- func TruncateString(s string, maxLen int) string
- type DeviceInfo
- type MultiProgress
- type OutputFormat
- type OutputWriter
- func (ow *OutputWriter) Flush() error
- func (ow *OutputWriter) WriteDeviceInfo(info DeviceInfo) error
- func (ow *OutputWriter) WriteDevices(devices []*model.Device, method string) error
- func (ow *OutputWriter) WriteError(err error)
- func (ow *OutputWriter) WriteMessage(message string)
- func (ow *OutputWriter) WriteProgress(message string)
- func (ow *OutputWriter) WriteSuccess(message string)
- func (ow *OutputWriter) WriteWarning(message string)
- type ProgressBar
Constants ¶
const ( IconCheck = "\uf00c" // nf-fa-check (✓) IconCross = "\uf00d" // nf-fa-times (✗) IconInfo = "\uf129" // nf-fa-info (ℹ) IconWarning = "\uf071" // nf-fa-exclamation_triangle (⚠) IconSpinner = "\uf110" // nf-fa-spinner IconFile = "\uf15b" // nf-fa-file_alt IconDownload = "\uf019" // nf-fa-download IconUpload = "\uf093" // nf-fa-upload IconFolder = "\uf07b" // nf-fa-folder IconFolderOpen = "\uf07c" // nf-fa-folder_open IconServer = "\uf233" // nf-fa-server IconNetwork = "\uf0ec" // nf-fa-exchange IconDevice = "\uf109" // nf-fa-laptop IconBell = "\uf0f3" // nf-fa-bell IconLock = "\uf023" // nf-fa-lock IconRocket = "\uf135" // nf-fa-rocket IconStop = "\uf04d" // nf-fa-stop IconGear = "\uf013" // nf-fa-cog IconHash = "\uf292" // nf-fa-hashtag IconChain = "\uf0c1" // nf-fa-link IconStar = "\uf005" // nf-fa-star IconHeart = "\uf004" // nf-fa-heart IconBolt = "\uf0e7" // nf-fa-bolt IconSearch = "\uf002" // nf-fa-search IconPlus = "\uf067" // nf-fa-plus IconMinus = "\uf068" // nf-fa-minus IconArrow = "\uf061" // nf-fa-arrow_left IconArrowR = "\uf178" // nf-fa-long_arrow_right IconArrowUp = "\uf062" // nf-fa-arrow_up IconArrowDn = "\uf063" // nf-fa-arrow_down )
Nerd Font v3 icons (Requires a Nerd Font patched terminal font, e.g. JetBrainsMono NF, FiraCode NF). These glyphs are selected from standard NFv3 codepoints (FontAwesome 6) for maximum compatibility.
Variables ¶
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 AnonymizeString ¶ added in v0.5.5
AnonymizeString returns a stable "Device #XXXXXXXX" identifier from any string.
func AnonymizedAlias ¶ added in v0.5.5
AnonymizedAlias returns a stable "Device #XXXXXXXX" identifier from a device's fingerprint.
func FormatBytes ¶
FormatBytes formats bytes in human readable format
func FormatDuration ¶
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
PickDevice presents an interactive TUI to select a device. Returns the selected device or nil if canceled. When private is true, device aliases are anonymized in the selection list.
func PrintError ¶ added in v0.4.0
func PrintHeader ¶ added in v0.4.0
func PrintHeader(text string)
func PrintSuccess ¶ added in v0.4.0
func PrintWarning ¶ added in v0.4.0
func TruncateString ¶ added in v0.5.0
TruncateString truncates a string to maxLen characters
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) ForceComplete ¶ added in v0.5.5
func (mp *MultiProgress) ForceComplete()
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) 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) Update ¶
func (pb *ProgressBar) Update(current int64)
Update updates the progress bar