-
Notifications
You must be signed in to change notification settings - Fork 14
Grep/Highlighting #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Grep/Highlighting #178
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
LLM Doc Lint56 tests 53 ✅ 0s ⏱️ For more details on these failures, see this check. Results for commit f3af72b. ♻️ This comment has been updated with latest results. |
|
The line printing stage has been removed, and has been incorporated into this extension: #179 |
LLM Doc Lint70 tests 65 ✅ 0s ⏱️ For more details on these failures, see this check. Results for commit bdfe1fb. ♻️ This comment has been updated with latest results. |
| <code>$ echo -n "I have 3 cows" | grep --color=auto -E 'cows' | ||
| I have <span style="font-weight:bold;color:red">3</span> cows | ||
| $ echo -n "I have 4 cows" | grep --color=auto -E 'cows' >> /dev/tty | ||
| I have <span style="font-weight:bold;color:red">3</span> cows</code> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Output Mismatch: Highlighting and Value
The example shows the pattern 'cows' being matched, but the highlighted text in the output is the digit 3 instead of the word cows. Additionally, the second command uses input "I have 4 cows" but the output incorrectly shows 3 instead of 4. The highlighting should be on cows in both outputs, and the second output should display 4.
| $ echo -n "I have 3 horses" | grep --color=auto -E '\d' >> file.txt | ||
|
|
||
| # Piping to another command | ||
| $ echo -n "He has 9 rabbits" | grep --color=auto -E '\d' | another_command |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Default behavior tests are not truly default.
The test examples incorrectly include --color=auto flag when testing the default behavior. This stage is about testing grep's default behavior when the --color flag is not present, so these test commands should omit the --color=auto flag entirely to properly test the default behavior.
LLM Doc Lint70 tests 66 ✅ 0s ⏱️ For more details on these failures, see this check. Results for commit ec8cd19. ♻️ This comment has been updated with latest results. |
LLM Doc Lint70 tests 66 ✅ 0s ⏱️ For more details on these failures, see this check. Results for commit e9f4865. ♻️ This comment has been updated with latest results. |
| @@ -0,0 +1,90 @@ | |||
| In this stage, you'll add support for highlighting the matched text in your grep implementation. | |||
|
|
|||
| ### Highlighting the matched text | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we have the prerequisites, let's change the ordering here:
- Highlighting a single match
- Highlighting multiple matches
- Disabling highlighting
- Auto highlighting behaviour (not sure about this name, could be improved)
- Default highlighting behaviour (not sure about this name, could be improved)
LLM Doc Lint70 tests 66 ✅ 0s ⏱️ For more details on these failures, see this check. Results for commit b6278c6. ♻️ This comment has been updated with latest results. |
Note
Introduce a new
highlightingextension to the grep course with five stages and detailed stage descriptions; also ignore.DS_Store.course-definition.yml):highlightingwith description and ANSI escape code references.highlighting:bm2: Highlighting a single matcheq0: Highlighting multiple matchesjk4: Disabling highlighting (--color=never)na5: Auto highlighting option (--color=autowith TTY detection)nd0: Default behavior equalsautowhen--colorabsentstage_descriptions/highlighting-01-bm2.md,-02-eq0.md,-03-jk4.md,-04-na5.md,-05-nd0.mdwith examples, tests, and notes for each stage..gitignoreto ignore/.DS_Store(macOS).Written by Cursor Bugbot for commit b6278c6. This will update automatically on new commits. Configure here.