From fea348c7b4cf3b39510b6707320c2afce2ca7835 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Thu, 25 Mar 2021 20:00:42 +0100 Subject: Use "*" as the default search query. --- CHANGELOG.rst | 5 +++++ docs/source/man/lesana-search.rst | 7 ++++++- lesana/command.py | 6 +++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c8a2e41..7b3dc6f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,11 @@ Unreleased add it to existing repositories by running ``lesana init`` on them (this is safe to do and won't change your settings or your data). * New command: get-values to get a list of values for a field. #6 +* lesana-search now defaults to a query of ``'*'``. + + This means that ``lesana search --all`` is now enough to list all + entries, while ``lesana search`` with no other options will list the + first 12 entries (possibly according to a default sorting setting). 0.8.1 ===== diff --git a/docs/source/man/lesana-search.rst b/docs/source/man/lesana-search.rst index 0f2861c..fff4b8e 100644 --- a/docs/source/man/lesana-search.rst +++ b/docs/source/man/lesana-search.rst @@ -7,7 +7,7 @@ SYNOPSIS lesana search [--help] [--collection COLLECTION] [--template TEMPLATE] \ [--offset OFFSET] [--pagesize PAGESIZE] [--all] \ - [--sort FIELD1 [--sort FIELD2 ...]] query [query ...] + [--sort FIELD1 [--sort FIELD2 ...]] [query [query ...]] DESCRIPTION =========== @@ -25,6 +25,11 @@ By default entries are printed according to the ``entry_label`` from the ``settings.yaml`` file, but they can be rendered according to a jinja2 template. +If no query is specified, it will default to ``'*'``, i.e. search all +entries: thus ``lesana search --all`` will print all entries, while just +``lesana search`` will print the first 12 entries, possibly according to +the relevant sorting options. + OPTIONS ======= diff --git a/lesana/command.py b/lesana/command.py index 9ff3533..62c8020 100644 --- a/lesana/command.py +++ b/lesana/command.py @@ -274,7 +274,11 @@ class Search(Command): ), ( ['query'], - dict(help='Xapian query to search in the collection', nargs='+'), + { + 'help': 'Xapian query to search in the collection', + 'nargs': '*', + 'default': '*', + }, ), ] -- cgit v1.2.3