Only run code for display if bite is downloaded
pmayd opened this issue · 1 comments
pmayd commented
When you try to run eatlocal display <bite-no>
without having downloaded the bite first, you will get a very long error message resulting in an IndexError
because there is no html file in the local repo: html_file = path / list(path.glob("*.html"))[0]
. This is expected but the user should be informed that they can only display bites that were downloaded before. So we should check first, if there is a path for that bite number.
Should be a very easy fix.
Given the line:
path = Path(bite_path or Path.cwd()).resolve() / str(bite_number)
it should suffice to check if that path is an existing directory and if not, display a warning message on the console.
rhelmstedter commented
That is a great idea. And you were right. Super easy fix.
Just addressed this with commit: 345a727