tsv_utils.tsv_pretty

Command line tool that prints TSV data aligned for easier reading on consoles and traditional command-line environments.

Copyright (c) 2017-2019, eBay Software Foundation Initially written by Jon Degenhardt

Members

Enums

FieldAlignment
enum FieldAlignment

Field alignments used by tsv-pretty processing.

FieldType
enum FieldType

Field types recognized and tracked by tsv-pretty processing.

Functions

formatExponentValue
string formatExponentValue(const char[] value, size_t precision)

formatExponentValue returns the printed representation of a raw value formatted using exponential notation and a specific precision. If the value cannot be interpreted as a double then the a copy of the original value is returned.

formatFloatingPointValue
string formatFloatingPointValue(const char[] value, size_t precision)

formatFloatingPointValue returns the printed representation of a raw value formatted as a fixed precision floating number. This includes zero padding or truncation of trailing digits as necessary to meet the desired precision.

main
int main(string[] cmdArgs)

Main program. Invokes command line arg processing and tsv-pretty to perform the real work. Any errors are caught and reported.

monospacePrintWidth
size_t monospacePrintWidth(const char[] str)

Calculates the expected print width of a string in monospace (fixed-width) fonts.

precisionDigits
size_t precisionDigits(const char[] numericString)

Returns the number of digits to the right of the decimal point in a numeric string. This routine includes trailing zeros in the count.

significantDigits
size_t significantDigits(const char[] numericString)

Returns the number of significant digits in a numeric string.

tsvPretty
void tsvPretty(in ref TsvPrettyOptions options, string[] files)

tsvPretty is the main loop, operating on input files and passing control to a TSVPrettyProccessor instance.

Structs

FieldFormat
struct FieldFormat

FieldFormat holds all the formatting info needed to format data values in a specific column. e.g. Field 1 may be text, field 2 may be a float, etc. This is calculated during the caching phase. Each FieldFormat instance is part of a vector representing the full row, so each includes the start position on the line and similar data.

TsvPrettyOptions
struct TsvPrettyOptions

TsvPrettyOptions is used to process and store command line options.

TsvPrettyProcessor
struct TsvPrettyProcessor

TsvPrettyProcessor maintains state of processing and exposes operations for processing individual input lines.

Meta