@@ -7,9 +7,12 @@ A Ruby command-line application for searching and analyzing client data from JSO
77## Features
88
99- ** Name Search** : Search through all clients and return those with names matching a given query (case-insensitive, supports regex patterns)
10+ - TTY output includes ** syntax highlighting** to visually highlight matched text
1011- ** Duplicate Email Detection** : Find clients with duplicate email addresses in the dataset
12+ - ** Rating Filter** : Filter clients by minimum rating threshold
1113- ** Dataset Generation** : Generate realistic test datasets with customizable size and guaranteed duplicates
1214- ** Multiple Output Formats** : Support for TTY, CSV, JSON, XML, and YAML output formats
15+ - All formats support optional ` result ` fields (rating and feedback comments)
1316- ** Flexible Dataset Support** : Specify custom dataset files via command-line options
1417- ** Robust Error Handling** : Validates file existence and JSON format before processing
1518- ** Graceful Data Handling** : Safely processes datasets with missing or invalid fields
@@ -55,6 +58,7 @@ challenge duplicates -f data.json
5558| ` generate ` | ` g ` | Generate test dataset | ` challenge generate -f data.json --size 1000 ` |
5659| ` search ` | ` s ` | Find clients by name, using regex | ` challenge search "John" -f data.json ` |
5760| ` duplicates ` | ` d ` | Find duplicate emails | ` challenge duplicates -f data.json ` |
61+ | ` filter_by_rating ` | - | Filter clients by minimum rating | ` challenge filter_by_rating 4.0 -f data.json ` |
5862| ` version ` | - | Show version number | ` challenge version ` |
5963
6064### Output Formats
@@ -76,6 +80,10 @@ challenge search "^John" -f data.json # Names starting with "John"
7680challenge search " Miller$" -f data.json # Names ending with "Miller"
7781challenge search " J.*n" -f data.json # Names starting with J and ending with n
7882
83+ # Filter by rating
84+ challenge filter_by_rating 3.5 -f data.json # Clients with rating >= 3.5
85+ challenge filter_by_rating 4.0 -f data.json --output json
86+
7987# Short aliases
8088challenge s " John" -f data.json # search
8189challenge d -f data.json # duplicates
@@ -101,22 +109,45 @@ The application expects JSON files containing an array of client objects with th
101109 {
102110 "id" : 1 ,
103111 "full_name" : " John Doe" ,
104- "email" : " john.doe@gmail.com"
112+ "email" : " john.doe@gmail.com" ,
113+ "result" : {
114+ "rating" : 4.5 ,
115+ "feedback" : [
116+ {
117+ "comment" : " Great job on the project!" ,
118+ "date" : " 2023-10-01"
119+ },
120+ {
121+ "comment" : " Excellent communication skills." ,
122+ "date" : " 2023-10-15"
123+ }
124+ ]
125+ }
105126 },
106127 {
107128 "id" : 2 ,
108129 "full_name" : " Jane Smith" ,
109- "email" : " jane.smith@yahoo.com"
130+ "email" : " jane.smith@yahoo.com" ,
131+ "result" : {
132+ "rating" : 3.8 ,
133+ "feedback" : []
134+ }
110135 }
111136]
112137```
113138
114- Required fields:
139+ ** Required fields:**
115140
116141- ` id ` : Unique identifier
117142- ` full_name ` : Client's full name
118143- ` email ` : Client's email address
119144
145+ ** Optional fields:**
146+
147+ - ` result ` : Object containing performance data (used by ` filter_by_rating ` command)
148+ - ` rating ` : Numeric rating value
149+ - ` feedback ` : Array of feedback objects with ` comment ` and ` date ` fields (date is optional)
150+
120151## Testing
121152
122153Run the test suite using RSpec:
@@ -249,7 +280,7 @@ Given more time, the following enhancements would be prioritized:
249280- ** Interactive Mode** : REPL-style interface for multiple queries
250281- ** Search Suggestions** : Auto-complete and suggestion features
251282- ** Progress Indicators** : Progress bars for long-running operations
252- - ** Colored Output** : Syntax highlighting and colored output for better readability
283+ - ✅ ** Colored Output** : Syntax highlighting for search results in TTY format (implemented)
253284
254285## Development
255286
0 commit comments