Skip to content

Latest commit

 

History

History
76 lines (54 loc) · 1.37 KB

File metadata and controls

76 lines (54 loc) · 1.37 KB

Clientlist

A Ruby CLI tool for reading, filtering, and processing JSON files of client data.

Installation

  1. Clone this repository
  2. Run bundle install
  3. Use the bin/clientlist executable

Usage

bin/clientlist -f FILE [options]

Options

  • -f, --file FILE: JSON file to read (required)
  • -s, --search QUERY: Filter clients by name
  • -g, --group-duplicates: Show groups of clients with the same email
  • -h, --help: Show help message

Examples

Display all clients:

bin/clientlist -f sample.json

Filter clients by name:

bin/clientlist -f sample.json -s "john"

Show clients with duplicate emails:

bin/clientlist -f sample.json -g

Filter and group clients:

bin/clientlist -f sample.json -s "john" -g

Development

Setup

  1. Clone the repository
  2. Install dependencies
    bundle install

Tests

Run tests with:

bundle exec rspec

Code Structure

  • lib/clientlist.rb: Main entry point and CLI class
  • lib/clientlist/argument_parser.rb: Command-line argument parsing
  • lib/clientlist/data_loader.rb: JSON data loading and validation
  • lib/clientlist/client_processor.rb: Data filtering and transformation

Features

  • Read and parse JSON files
  • Filter clients by name (case-insensitive)
  • Group clients with duplicate email addresses
  • Pretty-printed JSON output