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-2021, eBay Inc. 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(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(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(char[] str)

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

precisionDigits
size_t precisionDigits(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(char[] numericString)

Returns the number of significant digits in a numeric string.

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

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

Static variables

rt_options
string[] rt_options;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

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.

Variables

helpText
auto helpText;
Undocumented in source.
helpTextVerbose
auto helpTextVerbose;
Undocumented in source.

Meta

License

Boost License 1.0 (http://boost.org/LICENSE_1_0.txt)