Skip to content

Add group-by, count, and unflatten commands (0.5.0) - #7

Merged
rmkr-dev merged 1 commit into
mainfrom
feat/group-by-count-unflatten
Sep 30, 2026
Merged

rmkr-dev merged 1 commit into
mainfrom
feat/group-by-count-unflatten

Conversation

@rmkr-dev

Copy link
Copy Markdown
Owner

Three new shaping commands:

  • group-by KEY groups a list of objects by a top-level key into {value: [items]}, keeping first-seen order. Non-string values are labelled as compact JSON, and items without the key are dropped.
  • count [KEY] prints the length of a list. With KEY it prints per-value counts, and when run on group-by output it prints the size of each group.
  • unflatten [--sep] is the inverse of flatten. It rebuilds nested objects from joined keys and round-trips flatten output.

Each command has a pure helper in shape.py (group_rows, count_rows, unflatten_object) with unit tests, plus CLI tests. The README is updated and the version is bumped to 0.5.0.

Tests: 71 → 85, all passing locally.

Add group_rows, count_rows, and unflatten_object shape helpers and
matching CLI commands. group-by buckets a list of objects by a top-level
key, count reports totals, per-key counts, or group sizes from group-by
output, and unflatten reverses flatten with the same --sep option.
Document the new commands in the README and bump the version to 0.5.0.
@rmkr-dev
rmkr-dev merged commit 5d09f3a into main Sep 30, 2026
2 checks passed
@rmkr-dev
rmkr-dev deleted the feat/group-by-count-unflatten branch September 30, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant