output

package
v0.0.0-...-3199a73 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatRow

func FormatRow(result *speedtester.Result, mode speedtester.SpeedMode, index int) []string

FormatRow formats a single result row without ANSI colors. Returns plain text strings using speedtester.Result's Format* methods.

func GetHeaders

func GetHeaders(mode speedtester.SpeedMode) []string

GetHeaders returns table headers based on speed mode. fast: ID, Name, Type, Latency download: ID, Name, Type, Latency, Jitter, Packet Loss, Download Speed full: ID, Name, Type, Latency, Jitter, Packet Loss, Download Speed, Upload Speed

func IsTerminalFile

func IsTerminalFile(file *os.File) bool

IsTerminalFile checks if the given file is a terminal This is the default implementation used in production

func SortResults

func SortResults(results []*speedtester.Result, mode speedtester.SpeedMode) []*speedtester.Result

SortResults sorts results based on speed mode. fast: latency ascending (lower is better) download/full: download speed descending (higher is better)

Types

type IsTerminal

type IsTerminal func(file *os.File) bool

IsTerminal is a function type for terminal detection to enable testability

type OutputMode

type OutputMode int

OutputMode represents the output format mode

const (
	// OutputModeTSV outputs tab-separated values without ANSI colors
	OutputModeTSV OutputMode = iota
	// OutputModeInteractive outputs interactive UI (currently tablewriter, future TUI)
	OutputModeInteractive
)

func DetermineOutputMode

func DetermineOutputMode(isTerminal IsTerminal) OutputMode

DetermineOutputMode determines the output mode based on terminal detection. Returns TSV mode when stdout is not a terminal (for example, piped output). Otherwise returns Interactive mode. File output is handled separately by the caller.

type TSVWriter

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

TSVWriter writes tab-separated values output without ANSI colors It outputs the header immediately on creation, then streams rows as they complete

func NewTSVWriter

func NewTSVWriter(output io.Writer, mode speedtester.SpeedMode) (*TSVWriter, error)

NewTSVWriter creates a new TSV writer and writes the header immediately

func (*TSVWriter) WriteRow

func (w *TSVWriter) WriteRow(result *speedtester.Result, index int) error

WriteRow writes a single result row to TSV output The index parameter is used for the sequence number column

func (*TSVWriter) WriteRows

func (w *TSVWriter) WriteRows(results []*speedtester.Result) error

WriteRows writes multiple result rows to TSV output

Jump to

Keyboard shortcuts

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