Changelog
All notable changes to this project will be documented in this file.
0.3.2
Added
- Auto-detect terminal width from stdout via ioctl when no explicit width
is set. Falls back to
COLUMNSenv var, then 80. NO_COLORenvironment variable support: colors are suppressed whenNO_COLORis set (per https://no-color.org). Default behavior is now auto-detect; usecolors_force(true)to override.Table::colors_force— enable or disable colors ignoringNO_COLOR.- Crate-level and derive macro documentation for
cols-derive.
Changed
- Layout engine now prefers shrinking truncatable/wrappable columns when terminal width is constrained. Non-flexible columns get their full content width first, so columns like PID no longer get squeezed when a wide truncatable column (e.g. COMMAND) is present.
Table::colors()default changed fromfalseto auto-detect (enabled unlessNO_COLORis set). Existingcolors_set(true)calls still work but now also respectNO_COLOR.colsandcols-deriveversions are now synced viaworkspace.package.
0.3.1
Added
Column::word_wrap— wrap at word boundaries instead of mid-character; falls back to character wrap for words wider than the column. Supported via builder, setter, and#[column(word_wrap)]in the derive macro.Table::column,column_mut,remove_column, andsortnow acceptimpl ColumnKey— pass a column name (&str) or index (usize)- docs.rs metadata: builds with all features, feature-gated items labeled
automatically via
doc_auto_cfg - 6 new tests for
NO_EXTREMEScolumn layout behavior (4 api, 2 snapshot)
Changed
- Rewrote
filter,json, andwrapexamples to use#[derive(Cols)]
Fixed
- Tree connectors now render on any column with the
treeflag, not only when the tree column is the first visible column - Release builds failed due to
sealed_parentsfield andHashSetimport not being gated behind#[cfg(debug_assertions)] - Stale method names in mdbook documentation (
set_foo()→foo_set())
0.3.0
Added
#[derive(Cols)]proc macro (behind thederivefeature flag) for building tables from structs. Generates column definitions, row conversion, tree children, a typed header enum, and convenience methods (to_table,to_table_with,print_table,stream_to). Field attributes use#[column(...)].ColsandColsHeadertraits inderive_supportmodulecols-deriveproc macro crate- Streaming writer (
Table::streaming_writer) for outputting rows incrementally without buffering the entire table. Supports all output modes and tree rendering. RowBuilder::last()for marking the last child at each tree level, producing correct└─/├─connectors. Debug-mode assertion catches children added after a sibling was marked as last.ColumnKeytrait for indexing columns byusizeor&strnameRowBuilderfor building streaming rows with.set(key, value)- Color and styling support (behind the
colorfeature flag): foreground/ background colors, bold/italic/underline on cells, columns, and lines with cascading precedence header_repeat— repeat the header row everytermheight - 1lines in long output (works in both flat and tree modes)Table::filter_set— set a filter expression on the table; non-matching lines are skipped during printing across all output modesTable::filter_resolver_set— optional custom resolver for filter evaluationColumn::wrap_function— custom wrap function for splitting cell data into logical lines (e.g. splitting mountpoints on\n)Column::json_key/json_key_set— override the JSON object key for a column (default: lowercased column name)column_count(),line_count(),cell_count()replacingncols(),nlines(),ncells()deriveexample- 285 tests (unit + integration + snapshot + doc)
Changed
regexdependency is now optional behind theregexfeature flag (off by default). Filter=~/!~operators require this feature; all other filter operators work without it.- JSON output now lowercases column names for object keys (matches libsmartcols)
- Raw output mode encodes spaces as
\x20and all control chars (matches libsmartcols) - Export output mode encodes control chars in values (matches libsmartcols)
Fixed
- Sort not reordering root lines
- Wrap columns encoding newlines before splitting
0.2.0
Added
- 7 examples:
ls,tree,json,filter,groups,sort,wrap - mdbook documentation with 11 chapters, all code examples sourced from snapshot tests via
{{#include}} - Comparison table with
tabled,comfy-table,cli-table,prettytable-rsin introduction - CSV output mode (
OutputMode::Csv) with RFC 4180 quoting - Markdown table output mode (
OutputMode::Markdown) with pipe/backslash escaping and<br>for newlines - Rustdoc comments on all public methods
- 160 tests (92% line coverage): 22 unit, 80 integration, 47 snapshot, 11 doc
Changed
- Method naming standardized to
noun_verbform:- Setters:
set_foo()→foo_set() - Getters:
get_foo()→foo_get() - Boolean flags on Table:
enable_no_headings(true)→headings_set(false)(polarity flipped) - Same for
encoding,wrap,line_separator_enabled
- Setters:
- Abbreviations removed:
trunc→truncate,cmp_func→order_function,cmp_cells→compare_cells
0.1.0
Initial release, extracted from rustutils/util-linux.
Added
WidthHintenum (Auto,Fixed,Fraction) replacing magicf64width hints- Column builder API:
Column::new("NAME").width_fixed(10).tree(true).right(true) - Convenience methods:
width_fixed(),width_fraction()onColumn &mut selfsetters for all column flags and metadata (for post-construction mutation)LineId::from_raw()/LineId::as_raw()andGroupId::from_raw()/GroupId::as_raw()for FFI and serializationColumnFlagsbitfield flattened into directboolfields onColumn
Removed
bitflagsdependency- FFI remnants:
set_flags_from_bits,with_name_and_flags,new_column_with_flags Column::with_name(name, whint)constructor (useColumn::new(name).width_fixed(n))Column::set_flags()/Column::flags()accessors