cli

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Colorize

func Colorize(text string, color ColorCode) string

Colorize applies color to text if stdout is a terminal

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

Types

type ColorCode

type ColorCode string

ColorCode represents ANSI color codes

const (
	ColorReset  ColorCode = "\033[0m"
	ColorRed    ColorCode = "\033[31m"
	ColorGreen  ColorCode = "\033[32m"
	ColorYellow ColorCode = "\033[33m"
	ColorBlue   ColorCode = "\033[34m"
	ColorPurple ColorCode = "\033[35m"
	ColorCyan   ColorCode = "\033[36m"
	ColorWhite  ColorCode = "\033[37m"
	ColorBold   ColorCode = "\033[1m"
)

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 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