Skip to content

Commit

Permalink
fix: override default since param only if explicitly provided by cli #36
Browse files Browse the repository at this point in the history


952b5db introduced a regression, ignoring the `since` parameter defined
via YAML config in favor of the default defined by the cli option.
  • Loading branch information
ltvolks authored and nedbat committed Sep 21, 2023
1 parent 2ed7214 commit 9b9ea6d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions scriv.d/20230919_153108_ltvolks_since_default_override.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Fixed
.....

- fix: override default since param only if explicitly provided by cli #36
952bdfb introduced a regression ignoring the `since` parameter defined via
YAML config in favor of the default defined by the cli option

.. _issue 36: https://github.com/nedbat/dinghy/issues/36
8 changes: 6 additions & 2 deletions src/dinghy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ def main_run(coro):
@click.option(
"--since",
metavar="DELTA-OR-DATE",
help="Specify a since date [default: 1 week].",
help="Specify a since date.",
default="1 week",
show_default=True,
)
@click.argument("_input", metavar="[INPUT]", default="dinghy.yaml")
@click.argument("digests", metavar="[DIGEST ...]", nargs=-1)
def cli(since, _input, digests):
@click.pass_context
def cli(ctx, since, _input, digests):
"""
Generate HTML digests of GitHub activity.
Expand All @@ -64,6 +66,8 @@ def cli(since, _input, digests):
if "://" in _input:
coro = make_digest([_input], since=since)
else:
source = ctx.get_parameter_source("since")
since = None if source.name == "DEFAULT" else since
coro = make_digests_from_config(_input, digests or None, since=since)

main_run(coro)

0 comments on commit 9b9ea6d

Please sign in to comment.