Skip to content

Commit

Permalink
fix: don't ignore --since with URL argument. #35
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Sep 17, 2023
1 parent e733bdf commit 952bdfb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions scriv.d/20230917_130723_nedbat.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Fixed
.....

- When using a URL on the command line, the ``--since`` option was ignored.
This is now fixed, closing `issue 35`_.

.. _issue 35: https://github.com/nedbat/dinghy/issues/35
9 changes: 7 additions & 2 deletions src/dinghy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ def main_run(coro):
@click.command()
@click_log.simple_verbosity_option(logger)
@click.version_option()
@click.option("--since", metavar="DELTA-OR-DATE", help="Specify a since date.")
@click.option(
"--since",
metavar="DELTA-OR-DATE",
help="Specify a since date [default: 1 week].",
default="1 week",
)
@click.argument("_input", metavar="[INPUT]", default="dinghy.yaml")
@click.argument("digests", metavar="[DIGEST ...]", nargs=-1)
def cli(since, _input, digests):
Expand All @@ -57,7 +62,7 @@ def cli(since, _input, digests):
"""
if "://" in _input:
coro = make_digest([_input])
coro = make_digest([_input], since=since)
else:
coro = make_digests_from_config(_input, digests or None, since=since)

Expand Down
2 changes: 1 addition & 1 deletion src/dinghy/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def parse_since(since):
try:
since_date = datetime.datetime.fromisoformat(since)
except ValueError:
raise DinghyError("Can't parse since: {since!r}") from None
raise DinghyError(f"Can't parse 'since' value: {since!r}") from None
return since_date


Expand Down

0 comments on commit 952bdfb

Please sign in to comment.