countdown-cli icon indicating copy to clipboard operation
countdown-cli copied to clipboard

Support more than two digits of each unit

Open sampsyo opened this issue 1 year ago • 2 comments
trafficstars

Hello! Thanks for this very useful timer!

I've been using this to display the time remaining in exams for my class this semester. It worked great for both of the preliminary exams because the duration was 50 minutes. But the final exam, which is happening now, is 150 minutes—and it looks like the regexes for parsing durations only allow up to 2 digits (and no hours). So here's a small change that allows both seconds and minutes to be one or more digits. For this exam, for example, I can now do countdown 150m.

Let me know if there's anything else that would be useful in this PR!

sampsyo avatar May 13 '24 14:05 sampsyo

Nice! My primary use for this is while teaching as well. I'm glad you found it useful @sampsyo.

Thanks for the pull request. The only thing I think it would be nice to have is a test or two for more than 2 digits.

  • Something like this test
  • Something like this test might be nice too, just to confirm that the big numbers display properly

To run the tests you can pip install nox and then run nox. Alternatively you could pip install -e . in a virtual environment and then run pytest directly.

Besides that, this looks great. Thanks!

treyhunner avatar May 13 '24 22:05 treyhunner

Good call! I've added a couple of tests along those lines.

sampsyo avatar May 17 '24 12:05 sampsyo