feat(cli): refine default table output and introduce "default" column alias

Simplify the default table view by moving verbose columns to the verbose mode and allow users to explicitly request the default layout using `--columns default`.
This commit is contained in:
Nils Andreas Svee committed 2026-06-22 13:25:16 +07:00
1 parent b02bc53cd8
commit 9c63a03454
2 files changed
+15 -8

No files matched your search

+8 -4
View File
@@ -138,10 +138,14 @@ Aliases are accepted for readability: `receive_delay` for `rd`, `send_delay`
for `sd`, `server_processing` for `proc`, `server_received_count` for for `sd`, `server_processing` for `proc`, `server_received_count` for
`server_received`, and `server_received_window` for `server_window`. `server_received`, and `server_received_window` for `server_window`.
The default table output favors readability and omits `echo_sent` rows. Custom The default table output favors readability with compact columns:
table column selections and machine-friendly formats include all event rows. `event,seq,rtt,rd,sd,ipdv,proc,message`. It omits `echo_sent` rows. Passing
Missing table values render as `-`; missing CSV and TSV values render as empty `--columns default` is the same as omitting `--columns`, including the default
fields; missing JSONL values render as `null`. table row filtering. Custom table column selections include all event rows.
CSV, TSV, and JSONL default to all columns for structured export; use
`--columns all` explicitly to request every column in any format. Missing table
values render as `-`; missing CSV and TSV values render as empty fields;
missing JSONL values render as `null`.
Use JSON Lines for structured event streaming: Use JSON Lines for structured event streaming:
+7 -4
View File
@@ -27,7 +27,10 @@ impl OutputConfig {
header: HeaderMode, header: HeaderMode,
verbose: bool, verbose: bool,
) -> Result<Self, String> { ) -> Result<Self, String> {
let default_table_rows = format == OutputFormat::Table && columns.is_none(); let uses_default_columns = columns
.map(|columns| columns.trim() == "default")
.unwrap_or(true);
let default_table_rows = format == OutputFormat::Table && uses_default_columns;
let columns = match columns { let columns = match columns {
Some(columns) => parse_columns(columns, format, verbose)?, Some(columns) => parse_columns(columns, format, verbose)?,
None => default_columns(format, verbose), None => default_columns(format, verbose),
@@ -740,18 +743,18 @@ fn default_columns(format: OutputFormat, verbose: bool) -> Vec<Column> {
let mut columns = vec![ let mut columns = vec![
Column::Event, Column::Event,
Column::Seq, Column::Seq,
Column::Remote,
Column::Rtt, Column::Rtt,
Column::ReceiveDelay, Column::ReceiveDelay,
Column::SendDelay, Column::SendDelay,
Column::Ipdv, Column::Ipdv,
Column::ServerProcessing, Column::ServerProcessing,
Column::ServerReceivedCount,
Column::ServerReceivedWindow,
Column::Message, Column::Message,
]; ];
if verbose { if verbose {
columns.extend([ columns.extend([
Column::Remote,
Column::ServerReceivedCount,
Column::ServerReceivedWindow,
Column::RawRttUs, Column::RawRttUs,
Column::AdjustedRttUs, Column::AdjustedRttUs,
Column::Bytes, Column::Bytes,