scarvalhojr / aoc-cli

Advent of Code command-line tool
MIT License
249 stars 17 forks source link

Allow user to specify width of output #3

Closed pyrmont closed 2 years ago

pyrmont commented 2 years ago

First, thanks for aoc-cli. I've been playing around with it in the lead-up to AOC this year and it's great.

This PR adds support for specifying the output width when reading a puzzle. I'm working in a wide terminal but want the output to be substantially narrower than that. I can use a tool like fold or fmt but neither is ideal. fold will cause strange line-wrapping and fmt will smush together example input.

I'm not a Rust programmer so made the changes largely by copying code from the existing argument parsing rules and following the suggestions in the compiler errors. So far, so good on my machine.