Skip to content

Commit 9b9ea6d

Browse files
ltvolksnedbat
authored andcommitted
fix: override default since param only if explicitly provided by cli #36
952b5db introduced a regression, ignoring the `since` parameter defined via YAML config in favor of the default defined by the cli option.
1 parent 2ed7214 commit 9b9ea6d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Fixed
2+
.....
3+
4+
- fix: override default since param only if explicitly provided by cli #36
5+
952bdfb introduced a regression ignoring the `since` parameter defined via
6+
YAML config in favor of the default defined by the cli option
7+
8+
.. _issue 36: https://github.com/nedbat/dinghy/issues/36

src/dinghy/cli.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ def main_run(coro):
4545
@click.option(
4646
"--since",
4747
metavar="DELTA-OR-DATE",
48-
help="Specify a since date [default: 1 week].",
48+
help="Specify a since date.",
4949
default="1 week",
50+
show_default=True,
5051
)
5152
@click.argument("_input", metavar="[INPUT]", default="dinghy.yaml")
5253
@click.argument("digests", metavar="[DIGEST ...]", nargs=-1)
53-
def cli(since, _input, digests):
54+
@click.pass_context
55+
def cli(ctx, since, _input, digests):
5456
"""
5557
Generate HTML digests of GitHub activity.
5658
@@ -64,6 +66,8 @@ def cli(since, _input, digests):
6466
if "://" in _input:
6567
coro = make_digest([_input], since=since)
6668
else:
69+
source = ctx.get_parameter_source("since")
70+
since = None if source.name == "DEFAULT" else since
6771
coro = make_digests_from_config(_input, digests or None, since=since)
6872

6973
main_run(coro)

0 commit comments

Comments
 (0)