A Ruby CLI tool for reading, filtering, and processing JSON files of client data.
- Clone this repository
- Run
bundle install
- Use the
bin/clientlist
executable
bin/clientlist -f FILE [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
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
- Clone the repository
- Install dependencies
bundle install
Run tests with:
bundle exec rspec
lib/clientlist.rb
: Main entry point and CLI classlib/clientlist/argument_parser.rb
: Command-line argument parsinglib/clientlist/data_loader.rb
: JSON data loading and validationlib/clientlist/client_processor.rb
: Data filtering and transformation
- Read and parse JSON files
- Filter clients by name (case-insensitive)
- Group clients with duplicate email addresses
- Pretty-printed JSON output