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
Field alignments used by tsv-pretty processing.
Field types recognized and tracked by tsv-pretty processing.
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 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 program. Invokes command line arg processing and tsv-pretty to perform the real work. Any errors are caught and reported.
Calculates the expected print width of a string in monospace (fixed-width) fonts.
Returns the number of digits to the right of the decimal point in a numeric string. This routine includes trailing zeros in the count.
Returns the number of significant digits in a numeric string.
tsvPretty is the main loop, operating on input files and passing control to a TSVPrettyProccessor instance.
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 is used to process and store command line options.
TsvPrettyProcessor maintains state of processing and exposes operations for processing individual input lines.