-
Notifications
You must be signed in to change notification settings - Fork 14
Grep/Multiple Matches #179
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?
Conversation
LLM Doc Lint70 tests 65 ✅ 0s ⏱️ For more details on these failures, see this check. Results for commit de7f8c3. ♻️ This comment has been updated with latest results. |
LLM Doc Lint70 tests 69 ✅ 0s ⏱️ For more details on these failures, see this check. Results for commit 4e3e44c. ♻️ This comment has been updated with latest results. |
LLM Doc Lint70 tests 70 ✅ 0s ⏱️ Results for commit ba3dadc. ♻️ This comment has been updated with latest results. |
rohitpaulk
left a comment
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.
This can be far more minimal - let's remove the uncommon options and focus only on whatever's needed for multiple matches.
Also wonder if we should split this into two: "Printing matches" and "Multiple matches"?
The first can test printing lines that are matched (can be two stages: Single-line matches, Multi-line matches).
The second can test multiple matches specifically by introducing the -o flag.
|
|
||
| ### The `-c` option | ||
|
|
||
| The `-c` option, also known as the count option, is used to count the number of lines which match the specified pattern. |
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.
@UdeshyaDhungana I don't think we need to add this option - it can be indirectly tested by just getting users to print lines.
We aren't looking to get full coverage of CLI options, just full coverage of common operations. I think the common usage here is just cat XYZ | grep "pattern" | wc -l, and we'll already have this covered if we test printing lines.
The next stage could be the first stage for this extension! Don't think there's any significant difference in implementation difficulty, and this adds an additional concept + more implementation work (the -c flag).
| ``` | ||
|
|
||
| If none of the lines match the specified pattern, your program must: | ||
| - Exit with the code 1 |
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.
Let's also test that nothing is printed to stdout
| Example usage: | ||
|
|
||
| ```bash | ||
| $ echo -ne "dogs\ncat\ndog" | grep -n -E "dogs?" |
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.
Let's ignore this stage - isn't a commonly used flag. And it also doesn't really help with multiple matches, since even if a line had multiple matches the line would be printed only once.
| @@ -0,0 +1,35 @@ | |||
| In this stage, you'll add support for stopping the pattern search after a specified number of lines have been matched. | |||
|
|
|||
| ### The `-m` option | |||
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.
Let's skip this too! Not a common option
|
|
||
| ### The `-o` flag | ||
|
|
||
| The `-o` flag, also known as the `only-matching` flag, is used to print only the matching texts in a separate line. |
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.
This is probably worth keeping in, since it tests multiple matches directly (one printed per line).
LLM Doc Lint42 tests 39 ✅ 0s ⏱️ For more details on these failures, see this check. Results for commit a210401. ♻️ This comment has been updated with latest results. |
LLM Doc Lint42 tests 41 ✅ 0s ⏱️ For more details on these failures, see this check. Results for commit 6045ea2. ♻️ This comment has been updated with latest results. |
LLM Doc Lint42 tests 42 ✅ 0s ⏱️ Results for commit 93a58f3. ♻️ This comment has been updated with latest results. |
course-definition.yml
Outdated
| # Multiple matches | ||
| - slug: "cj0" | ||
| primary_extension_slug: "multiple-matches" | ||
| name: "Print a single matching 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.
| name: "Print a single matching text" | |
| name: "Print single match" |
course-definition.yml
Outdated
| - slug: "ss2" | ||
| primary_extension_slug: "multiple-matches" | ||
| name: "Print multiple matching texts" |
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.
| name: "Print multiple matching texts" | |
| name: "Print multiple matches" |
LLM Doc Lint42 tests 42 ✅ 0s ⏱️ Results for commit 20021dd. ♻️ This comment has been updated with latest results. |
Note
Introduces a new “Multiple Matches” extension (with -o flag) and three stages covering single match, multiple matches in a line, and multiple lines, plus accompanying stage docs.
multiple-matchesextension incourse-definition.ymlintroducing-o(only-matching) behavior.multiple-matches:cj0— Print single matchss2— Print multiple matches from one linebo4— Process multiple input linesstage_descriptions/multiple-matches-01-cj0.md,...-02-ss2.md,...-03-bo4.mdwith examples/tests detailing expected outputs and exit codes..gitignoreto ignore.DS_Store.Written by Cursor Bugbot for commit 20021dd. This will update automatically on new commits. Configure here.