Skip to content

feat(tools): add json-sort CLI tool for sorting JSON arrays#286

Merged
fengmk2 merged 1 commit intomainfrom
11-02-chore_cli_add_tool_json-sort_command
Nov 3, 2025
Merged

feat(tools): add json-sort CLI tool for sorting JSON arrays#286
fengmk2 merged 1 commit intomainfrom
11-02-chore_cli_add_tool_json-sort_command

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Nov 2, 2025

TL;DR

Added a new json-sort CLI tool to sort JSON arrays by specified properties.

What changed?

  • Created a new json-sort CLI tool that sorts JSON arrays based on a specified property
  • Added the tool to the main CLI interface in index.ts
  • Updated the README to include the new tool
  • Added snapshot tests to verify the functionality:
    • Sorting an array of objects by the name property
    • Sorting an array of objects by the age property

How to test?

Run the tool with a JSON file containing an array and specify the property to sort by:

tool json-sort array.json '_.name'

Or check the snapshot tests:

tool snap-test json-sort

Why make this change?

This tool provides a convenient way to sort JSON arrays by specific properties, which is useful for organizing data in configuration files, test fixtures, or any JSON array that needs to be sorted in a specific order. It complements the existing json-edit tool by providing another way to manipulate JSON files.

Copy link
Copy Markdown
Member Author

fengmk2 commented Nov 2, 2025

@fengmk2 fengmk2 changed the title chore(cli): add tool json-sort command feat(tools): add json-sort CLI tool for sorting JSON arrays Nov 2, 2025
@fengmk2 fengmk2 force-pushed the 11-02-chore_cli_add_tool_json-sort_command branch from af8244b to d3abd34 Compare November 2, 2025 10:12
@fengmk2 fengmk2 marked this pull request as ready for review November 2, 2025 11:07
@fengmk2 fengmk2 requested review from Brooooooklyn, branchseer and Copilot and removed request for Copilot November 2, 2025 11:07
@fengmk2 fengmk2 self-assigned this Nov 2, 2025
@fengmk2 fengmk2 force-pushed the 11-02-chore_cli_add_tool_json-sort_command branch from d3abd34 to bc8bf05 Compare November 2, 2025 15:14
@fengmk2 fengmk2 merged commit a030058 into main Nov 3, 2025
10 checks passed
Copy link
Copy Markdown
Member Author

fengmk2 commented Nov 3, 2025

Merge activity

@fengmk2 fengmk2 deleted the 11-02-chore_cli_add_tool_json-sort_command branch November 3, 2025 13:01
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.

2 participants