Skip to content

Commit

Permalink
Add OutputFormatter, defaulting to OutputFormatter::RawThenSummary.
Browse files Browse the repository at this point in the history
fm's "summary" output is mostly quite useful, in that it quickly directs
the reader's eyes to where a problem was encountered. Sometimes,
however, you need to see the output before that to understand how an
error happened where it did.

This commit gives an fm user the ability to choose from 3 outputs:
`InputThenSummary` (the new default), `SummaryOnly` (the old default),
and `InputOnly`. For example `InputThenSummary` produces output along
the lines of:

```
Raw text:
   |1
   |2
   |3
   |4
   |6
   |7
   |8
   |9
   |10

Pattern (error at line 5):
   ...
   |2
   |3
   |4
>> |5
   |6
   |7
   |8
   ...

Text (error at line 5):
   ...
   |2
   |3
   |4
>> |6
   |7
   |8
   |9
   ...
```

Note that I had to take `PartialEq` of `FMatchError`. I don't really
know why `FMatchError` impled `PartialEq`, but technically a user could
rely on it, so this commit technically breaks backwards compatibility.
  • Loading branch information
ltratt committed Mar 19, 2024
1 parent f26e7e1 commit 18a4fb5
Showing 1 changed file with 218 additions and 70 deletions.
Loading

0 comments on commit 18a4fb5

Please sign in to comment.