Skip to content

Conversation

@UdeshyaDhungana
Copy link
Contributor

@UdeshyaDhungana UdeshyaDhungana commented Nov 12, 2025

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.

  • Extensions
    • Add multiple-matches extension in course-definition.yml introducing -o (only-matching) behavior.
    • Add stages under multiple-matches:
      • cj0 — Print single match
      • ss2 — Print multiple matches from one line
      • bo4 — Process multiple input lines
  • Docs
    • Add stage_descriptions/multiple-matches-01-cj0.md, ...-02-ss2.md, ...-03-bo4.md with examples/tests detailing expected outputs and exit codes.
  • Misc
    • Update .gitignore to ignore .DS_Store.

Written by Cursor Bugbot for commit 20021dd. This will update automatically on new commits. Configure here.

@UdeshyaDhungana UdeshyaDhungana changed the title Add stage instructions for multiple matches Grep/Multiple Matches Nov 12, 2025
@github-actions
Copy link

github-actions bot commented Nov 12, 2025

LLM Doc Lint

70 tests   65 ✅  0s ⏱️
 5 suites   0 💤
 1 files     5 ❌

For more details on these failures, see this check.

Results for commit de7f8c3.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Nov 12, 2025

LLM Doc Lint

70 tests   69 ✅  0s ⏱️
 5 suites   0 💤
 1 files     1 ❌

For more details on these failures, see this check.

Results for commit 4e3e44c.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Nov 12, 2025

LLM Doc Lint

70 tests   70 ✅  0s ⏱️
 5 suites   0 💤
 1 files     0 ❌

Results for commit ba3dadc.

♻️ This comment has been updated with latest results.

Copy link
Member

@rohitpaulk rohitpaulk left a 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.
Copy link
Member

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
Copy link
Member

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?"
Copy link
Member

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
Copy link
Member

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.
Copy link
Member

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).

@github-actions
Copy link

github-actions bot commented Nov 14, 2025

LLM Doc Lint

42 tests   39 ✅  0s ⏱️
 3 suites   0 💤
 1 files     3 ❌

For more details on these failures, see this check.

Results for commit a210401.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Nov 14, 2025

LLM Doc Lint

42 tests   41 ✅  0s ⏱️
 3 suites   0 💤
 1 files     1 ❌

For more details on these failures, see this check.

Results for commit 6045ea2.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Nov 14, 2025

LLM Doc Lint

42 tests   42 ✅  0s ⏱️
 3 suites   0 💤
 1 files     0 ❌

Results for commit 93a58f3.

♻️ This comment has been updated with latest results.

# Multiple matches
- slug: "cj0"
primary_extension_slug: "multiple-matches"
name: "Print a single matching text"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: "Print a single matching text"
name: "Print single match"

- slug: "ss2"
primary_extension_slug: "multiple-matches"
name: "Print multiple matching texts"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: "Print multiple matching texts"
name: "Print multiple matches"

@github-actions
Copy link

github-actions bot commented Nov 17, 2025

LLM Doc Lint

42 tests   42 ✅  0s ⏱️
 3 suites   0 💤
 1 files     0 ❌

Results for commit 20021dd.

♻️ This comment has been updated with latest results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants