From 9c63a03454a14a184c7df33b50794e5c0e5995f4 Mon Sep 17 00:00:00 2001 From: Nils Andreas Svee Date: Mon, 22 Jun 2026 13:25:16 +0700 Subject: [PATCH] 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`. --- README.md | 12 ++++++++---- crates/irtt-cli/src/cmd/client/output.rs | 11 +++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 65afa2f..c13711e 100644 --- a/README.md +++ b/README.md @@ -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 `server_received`, and `server_received_window` for `server_window`. -The default table output favors readability and omits `echo_sent` rows. Custom -table column selections and machine-friendly formats include all event rows. -Missing table values render as `-`; missing CSV and TSV values render as empty -fields; missing JSONL values render as `null`. +The default table output favors readability with compact columns: +`event,seq,rtt,rd,sd,ipdv,proc,message`. It omits `echo_sent` rows. Passing +`--columns default` is the same as omitting `--columns`, including the default +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: diff --git a/crates/irtt-cli/src/cmd/client/output.rs b/crates/irtt-cli/src/cmd/client/output.rs index a3ee717..536bfbc 100644 --- a/crates/irtt-cli/src/cmd/client/output.rs +++ b/crates/irtt-cli/src/cmd/client/output.rs @@ -27,7 +27,10 @@ impl OutputConfig { header: HeaderMode, verbose: bool, ) -> Result { - 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 { Some(columns) => parse_columns(columns, format, verbose)?, None => default_columns(format, verbose), @@ -740,18 +743,18 @@ fn default_columns(format: OutputFormat, verbose: bool) -> Vec { let mut columns = vec![ Column::Event, Column::Seq, - Column::Remote, Column::Rtt, Column::ReceiveDelay, Column::SendDelay, Column::Ipdv, Column::ServerProcessing, - Column::ServerReceivedCount, - Column::ServerReceivedWindow, Column::Message, ]; if verbose { columns.extend([ + Column::Remote, + Column::ServerReceivedCount, + Column::ServerReceivedWindow, Column::RawRttUs, Column::AdjustedRttUs, Column::Bytes,