jatcwang / jatcwang/difflicious
Add documentation on how to use Difflicious to print diffs from your own application code
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 108
- Forks
- 13
- Avg merge
- 13h 7m
- Merged PRs (30d)
- 34
Description
I had a situation where I wanted my application to be able to pretty-print a diff between the default configuration of the app and the actual resolved runtime configuration. It took quite a while to just find the method to generate the diff string because there's no mention of this use case in the documentation. The existing documentation assumes you are using Difflicious within a testing framework, which I don't think is always going to be the case.
Something like this in the cheatsheet maybe ? :
Printing diffs at runtime
if you want to use Difflicious in your own application rather than in a test suite, you can use the DiffResultPrinter
case class Config(outputPath: String, url:String, iterations:Int)
val defaultConfig = Config("/tmp/","google.com",100)
val config = Config("/tmp/","google.com",1000)
val diff = difflicious.Differ.apply[AppConfig].diff(defaultConfig, config)
System.log(s"Configuration resolved with overrides:\n${DiffResultPrinter.printDiffResult(diff)}")
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing cheatsheet and its testing-framework examples, then verify the runtime API using Differ.apply.diff and DiffResultPrinter. Add a concise example showing Difflicious used from application code, and ensure the documentation example compiles and clearly explains the expected output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100