hugovk / norwegianblue

CLI to show end-of-life dates for a number of products.
https://endoflife.date
MIT License
74 stars 4 forks source link

If product not found, offer a suggestion #132

Closed hugovk closed 1 year ago

hugovk commented 1 year ago

If the product is not found, suggest the closest one.

For example:

$ eol androd
Product 'androd' not found, run 'eol all' for list. Did you mean: 'android'?
$ eol pythn
Product 'pythn' not found, run 'eol all' for list. Did you mean: 'python'?
$ eol samsung
Product 'samsung' not found, run 'eol all' for list. Did you mean: 'samsung-mobile'?

Similar to the improved error messages in Python 3.10 and 3.12.

Also refactor norwegianblue() to raise ValueError on 404 instead of returning.

codecov[bot] commented 1 year ago

Codecov Report

Merging #132 (018077a) into main (faf68bc) will increase coverage by 0.15%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #132      +/-   ##
==========================================
+ Coverage   95.23%   95.39%   +0.15%     
==========================================
  Files           9        9              
  Lines         378      391      +13     
==========================================
+ Hits          360      373      +13     
  Misses         18       18              
Flag Coverage Δ
macos-latest 95.39% <100.00%> (+0.15%) :arrow_up:
ubuntu-latest 95.39% <100.00%> (+0.15%) :arrow_up:
windows-latest 95.39% <100.00%> (+0.15%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/norwegianblue/cli.py 0.00% <ø> (ø)
src/norwegianblue/__init__.py 98.61% <100.00%> (+0.10%) :arrow_up:
tests/test_norwegianblue.py 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more