Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 COLUMNS env var, then 80.
  • NO_COLOR environment variable support: colors are suppressed when NO_COLOR is set (per https://no-color.org). Default behavior is now auto-detect; use colors_force(true) to override.
  • Table::colors_force — enable or disable colors ignoring NO_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 from false to auto-detect (enabled unless NO_COLOR is set). Existing colors_set(true) calls still work but now also respect NO_COLOR.
  • cols and cols-derive versions are now synced via workspace.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, and sort now accept impl 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_EXTREMES column layout behavior (4 api, 2 snapshot)

Changed

  • Rewrote filter, json, and wrap examples to use #[derive(Cols)]

Fixed

  • Tree connectors now render on any column with the tree flag, not only when the tree column is the first visible column
  • Release builds failed due to sealed_parents field and HashSet import 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 the derive feature 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(...)].
  • Cols and ColsHeader traits in derive_support module
  • cols-derive proc 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.
  • ColumnKey trait for indexing columns by usize or &str name
  • RowBuilder for building streaming rows with .set(key, value)
  • Color and styling support (behind the color feature flag): foreground/ background colors, bold/italic/underline on cells, columns, and lines with cascading precedence
  • header_repeat — repeat the header row every termheight - 1 lines 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 modes
  • Table::filter_resolver_set — optional custom resolver for filter evaluation
  • Column::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() replacing ncols(), nlines(), ncells()
  • derive example
  • 285 tests (unit + integration + snapshot + doc)

Changed

  • regex dependency is now optional behind the regex feature 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 \x20 and 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-rs in 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_verb form:
    • 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
  • Abbreviations removed: trunctruncate, cmp_funcorder_function, cmp_cellscompare_cells

0.1.0

Initial release, extracted from rustutils/util-linux.

Added

  • WidthHint enum (Auto, Fixed, Fraction) replacing magic f64 width hints
  • Column builder API: Column::new("NAME").width_fixed(10).tree(true).right(true)
  • Convenience methods: width_fixed(), width_fraction() on Column
  • &mut self setters for all column flags and metadata (for post-construction mutation)
  • LineId::from_raw() / LineId::as_raw() and GroupId::from_raw() / GroupId::as_raw() for FFI and serialization
  • ColumnFlags bitfield flattened into direct bool fields on Column

Removed

  • bitflags dependency
  • FFI remnants: set_flags_from_bits, with_name_and_flags, new_column_with_flags
  • Column::with_name(name, whint) constructor (use Column::new(name).width_fixed(n))
  • Column::set_flags() / Column::flags() accessors