Skip to content

Commit

Permalink
Fix new_only references in user guide. update --new-only -> --new.
Browse files Browse the repository at this point in the history
Closes #334.
  • Loading branch information
lemon24 committed May 25, 2024
1 parent 57a90a6 commit bd7b0f5
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Unreleased
for existing entries.
Thanks to `Michael Han`_ for the pull request.
(:issue:`317`)
* Rename ``update --new-only`` CLI flag to ``--new``;
``--new-only`` remains available as an alias.
(:issue:`334`)

.. _Michael Han: https://github.com/Sakunam

Expand Down
4 changes: 2 additions & 2 deletions docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ hour). Note that *reader* uses the ETag and Last-Modified headers, so, if
supported by the the server, feeds will only be downloaded if they changed.

To avoid waiting too much for a new feed to be updated, you can run
``update --new-only`` more often (e.g. every minute); this will update
``update --new`` more often (e.g. every minute); this will update
only newly-added feeds. This is also a good time to update the search index.

You can achieve this using cron::

42 * * * * reader update -v 2>&1 >>"/tmp/$LOGNAME.reader.update.hourly.log"
* * * * * reader update -v --new-only 2>&1 >>"/tmp/$LOGNAME.reader.update.new.log"; reader search update 2>&1 >>"/tmp/$LOGNAME.reader.search.update.log"
* * * * * reader update -v --new 2>&1 >>"/tmp/$LOGNAME.reader.update.new.log"; reader search update 2>&1 >>"/tmp/$LOGNAME.reader.search.update.log"

If you are running *reader* on a personal computer, it might also be convenient
to run ``update`` once immediately after boot::
Expand Down
4 changes: 2 additions & 2 deletions docs/guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ and potentially getting banned;
every 30 minutes seems reasonable.

To support updating newly-added feeds off the regular update schedule,
you can use the ``new_only`` flag;
you can use the ``new`` flag;
you can call this more often (e.g. every minute)::

>>> reader.update_feeds(new_only=True)
>>> reader.update_feeds(new=True)


If you need the status of each feed as it gets updated
Expand Down
2 changes: 1 addition & 1 deletion scripts/debug_storage_stats.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Extract query timings from (stderr) log output of:
reader --debug-storage [update | update --new-only | search update] --vv
reader --debug-storage [update | update --new | search update] --vv
Note that the timings are not entirely accurate:
Expand Down
8 changes: 5 additions & 3 deletions src/reader/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,10 @@ def iter_update_status(it, length):
@cli.command()
@click.argument('url', required=False)
@click.option(
'--new-only/--no-new-only', help="Only update new (never updated before) feeds."
'--new/--no-new',
'--new-only',
default=None,
help="Only update new (never updated before) feeds.",
)
@click.option(
'--workers',
Expand All @@ -303,7 +306,7 @@ def iter_update_status(it, length):
@make_log_verbose(True, -2)
@log_command
@pass_reader
def update(reader, url, new_only, workers, verbose):
def update(reader, url, new, workers, verbose):
"""Update one or all feeds.
If URL is not given, update all the feeds.
Expand All @@ -318,7 +321,6 @@ def update(reader, url, new_only, workers, verbose):
-vvvv: + debug
"""
new = True if new_only else None
it = reader.update_feeds_iter(feed=url, new=new, workers=workers)
length = reader.get_feed_counts(feed=url, new=new, updates_enabled=True).total

Expand Down
10 changes: 8 additions & 2 deletions src/reader/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,8 +812,11 @@ def update_feeds(
Previously, entries would be updated only if the
entry :attr:`~Entry.updated` was *newer* than the stored one.
.. versionadded:: 1.19
The ``new`` parameter. ``new_only`` is now deprecated.
.. versionchanged:: 2.0
Removed the ``new_only`` parameter.
Remove the deprecated ``new_only`` parameter.
.. versionchanged:: 2.0
All parameters are keyword-only.
Expand Down Expand Up @@ -941,8 +944,11 @@ def update_feeds_iter(
Update entries whenever their content changes.
See :meth:`~Reader.update_feeds` for details.
.. versionadded:: 1.19
The ``new`` parameter. ``new_only`` is now deprecated.
.. versionchanged:: 2.0
Removed the ``new_only`` parameter.
Remove the deprecated ``new_only`` parameter.
.. versionchanged:: 2.0
All parameters are keyword-only.
Expand Down

0 comments on commit bd7b0f5

Please sign in to comment.