Skip to content

Commit 952bdfb

Browse files
committed
fix: don't ignore --since with URL argument. #35
1 parent e733bdf commit 952bdfb

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

scriv.d/20230917_130723_nedbat.rst

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Fixed
2+
.....
3+
4+
- When using a URL on the command line, the ``--since`` option was ignored.
5+
This is now fixed, closing `issue 35`_.
6+
7+
.. _issue 35: https://github.com/nedbat/dinghy/issues/35

src/dinghy/cli.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ def main_run(coro):
4242
@click.command()
4343
@click_log.simple_verbosity_option(logger)
4444
@click.version_option()
45-
@click.option("--since", metavar="DELTA-OR-DATE", help="Specify a since date.")
45+
@click.option(
46+
"--since",
47+
metavar="DELTA-OR-DATE",
48+
help="Specify a since date [default: 1 week].",
49+
default="1 week",
50+
)
4651
@click.argument("_input", metavar="[INPUT]", default="dinghy.yaml")
4752
@click.argument("digests", metavar="[DIGEST ...]", nargs=-1)
4853
def cli(since, _input, digests):
@@ -57,7 +62,7 @@ def cli(since, _input, digests):
5762
5863
"""
5964
if "://" in _input:
60-
coro = make_digest([_input])
65+
coro = make_digest([_input], since=since)
6166
else:
6267
coro = make_digests_from_config(_input, digests or None, since=since)
6368

src/dinghy/helpers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def parse_since(since):
7272
try:
7373
since_date = datetime.datetime.fromisoformat(since)
7474
except ValueError:
75-
raise DinghyError("Can't parse since: {since!r}") from None
75+
raise DinghyError(f"Can't parse 'since' value: {since!r}") from None
7676
return since_date
7777

7878

0 commit comments

Comments
 (0)