Skip to content

Commit abdf8bb

Browse files
committed
refactor: a different way to apply a since=1-week default.
1 parent f8cf77c commit abdf8bb

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,19 @@ See the fragment files in the `scriv.d directory`_.
2424
2525
.. _changelog-1.3.2:
2626

27-
1.3.2 — 2023-09-19
27+
1.3.2 — 2023-09-21
2828
------------------
2929

3030
Fixed
3131
.....
3232

33-
- fix: override default since param only if explicitly provided by cli #36
34-
952bdfb introduced a regression ignoring the `since` parameter defined via
35-
YAML config in favor of the default defined by the cli option
33+
- The 1.3.1 fix for the ignore ``--since`` option accidentally ignored
34+
``since`` settings in configuration files. This is now fixed, closing `issue
35+
36`_. Thanks, `Lucas Taylor <pull 37_>`_.
3636

3737
.. _issue 36: https://github.com/nedbat/dinghy/issues/36
38+
.. _pull 37: https://github.com/nedbat/dinghy/issues/37
39+
3840

3941
.. _changelog-1.3.1:
4042

@@ -49,6 +51,7 @@ Fixed
4951

5052
.. _issue 35: https://github.com/nedbat/dinghy/issues/35
5153

54+
5255
.. _changelog-1.3.0:
5356

5457
1.3.0 — 2023-07-31

README.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,19 @@ starting point for your own publishing.
189189
.. _sample_repo: https://github.com/nedbat/dinghy_sample
190190

191191

192+
Contributors
193+
============
194+
195+
Thanks to all who have helped:
196+
197+
- Ned Batchelder
198+
- Bill Mill
199+
- Doug Hellmann
200+
- Henry Gessau
201+
- Lucas Taylor
202+
- Quentin Pradet
203+
- Simon de Vlieger
204+
192205

193206
.. |pypi-badge| image:: https://img.shields.io/pypi/v/dinghy.svg
194207
:target: https://pypi.python.org/pypi/dinghy/

src/dinghy/cli.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,11 @@ def main_run(coro):
4545
@click.option(
4646
"--since",
4747
metavar="DELTA-OR-DATE",
48-
help="Specify a since date.",
49-
default="1 week",
50-
show_default=True,
48+
help="Specify a since date. [default: 1 week]",
5149
)
5250
@click.argument("_input", metavar="[INPUT]", default="dinghy.yaml")
5351
@click.argument("digests", metavar="[DIGEST ...]", nargs=-1)
54-
@click.pass_context
55-
def cli(ctx, since, _input, digests):
52+
def cli(since, _input, digests):
5653
"""
5754
Generate HTML digests of GitHub activity.
5855
@@ -66,8 +63,6 @@ def cli(ctx, since, _input, digests):
6663
if "://" in _input:
6764
coro = make_digest([_input], since=since)
6865
else:
69-
source = ctx.get_parameter_source("since")
70-
since = None if source.name == "DEFAULT" else since
7166
coro = make_digests_from_config(_input, digests or None, since=since)
7267

7368
main_run(coro)

src/dinghy/digest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,16 +496,18 @@ def coro_from_item(digester, item):
496496
return coro
497497

498498

499-
async def make_digest(items, since="1 week", digest="digest.html", **options):
499+
async def make_digest(items, since=None, digest="digest.html", **options):
500500
"""
501501
Make a single digest.
502502
503503
Args:
504-
since (str): a duration spec ("2 day", "3d6h", etc).
504+
since (optional str): a duration spec ("2 day", "3d6h", etc). Default: 1 week.
505505
items (list[str|dict]): a list of YAML objects or GitHub URLs to collect entries from.
506506
digest (str): the HTML file name to write.
507507
508508
"""
509+
if since is None:
510+
since = "1 week"
509511
show_date = since != "forever"
510512
since_date = parse_since(since)
511513
digester = Digester(since=since_date, options=options)

0 commit comments

Comments
 (0)