output

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(w io.Writer, rows []Row, columns []string, format string) error

Format writes rows to w in the requested format. Supported formats: tsv, csv, json, table.

func InferColumns

func InferColumns(rows []Row) []string

InferColumns collects all keys from rows, sorts them alphabetically, and puts sample_accession first if present.

func InferFormatFromPath added in v0.15.0

func InferFormatFromPath(path string) string

InferFormatFromPath returns "tsv", "csv", "json", or "" based on the file extension (after stripping a trailing .gz). Returns "" when the extension is missing or unrecognised so callers can fall through to their own defaults.

Exposed as a separate step (rather than baked into ResolveFormat) so each command can interleave it with config-driven defaults in the correct priority: --format flag > filename hint > configured default > TTY default.

func IsTerminal

func IsTerminal() bool

func OpenWriter added in v0.15.0

func OpenWriter(path string) (io.Writer, func() error, error)

OpenWriter creates the file at path and returns a writer plus a close function. When path ends with .gz (case-insensitive) the returned writer is a gzip.Writer wrapping the file; the close function flushes the gzip stream and closes the underlying file. Callers must invoke close to avoid silently truncating the gzip trailer.

func ResolveFormat

func ResolveFormat(format string) string

Types

type Row

type Row map[string]string

Row is a single result row, mapping column name to string value.

Jump to

Keyboard shortcuts

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