Throw an error if -s is used without a crate

In the future we might want to be smarter and find the crate, but let's at least
not ignore the option completely.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-08-17 10:18:59 +02:00
parent 2f12c83d14
commit 5a1cde5b8d

View file

@ -178,6 +178,9 @@ def make_diff_metadata(crate, version, patch=False, store=False):
if crate.endswith(".crate"): if crate.endswith(".crate"):
cratef, crate, version = local_crate(crate, version) cratef, crate, version = local_crate(crate, version)
else: else:
if store:
raise ValueError('--store-crate can only be used for a crate')
toml, crate, version = local_toml(crate, version) toml, crate, version = local_toml(crate, version)
diff = make_patch(toml, enabled=patch, tmpfile=True) diff = make_patch(toml, enabled=patch, tmpfile=True)
metadata = Metadata.from_file(toml) metadata = Metadata.from_file(toml)