This is a refactoring of the bounds definitions in hopes to make the code easier to follow. I've struggled following it in the existing code because there are several mutations of Opts::start and Opts::end, and the logic for interpreting the bounds was scattered in several places.
A general overview of the change:
Moved the bounds code to a separate module to try to clean things up.
Added a Bounds enum to represent the start and end boundaries. All code that accessed the start and end values directly now looks at Config::bounds.
All the interpretation of --start and --end happens in Bounds::from_args in a single match.
Fixed a small bug where it would panic with --by-commit and no --start (it now shows an error).
Added some UI tests for the various simple error cases.
This also fixes a bug I somehow run into several times. During the time between midnight UTC and whenever the nightlies are published, cbr will fail if you don't specify an --end. This updates it to fetch the manifest from the network to determine the date of the latest nightly (find_latest_nightly) instead of assuming the current date. This requires pulling in toml to parse the manifest.
This is a refactoring of the bounds definitions in hopes to make the code easier to follow. I've struggled following it in the existing code because there are several mutations of
Opts::start
andOpts::end
, and the logic for interpreting the bounds was scattered in several places.A general overview of the change:
Bounds
enum to represent the start and end boundaries. All code that accessed thestart
andend
values directly now looks atConfig::bounds
.--start
and--end
happens inBounds::from_args
in a single match.--by-commit
and no--start
(it now shows an error).This also fixes a bug I somehow run into several times. During the time between midnight UTC and whenever the nightlies are published, cbr will fail if you don't specify an
--end
. This updates it to fetch the manifest from the network to determine the date of the latest nightly (find_latest_nightly
) instead of assuming the current date. This requires pulling intoml
to parse the manifest.Fixes #247