Commit 77fca0b5 authored by Marcel Hellkamp's avatar Marcel Hellkamp
Browse files

Exposed strict-mode scrolling to CLI

parent 075b0c50
"""
Scroll all IDs in a vault.
Scrolling requires the `list` vault permission. You can fall back on search-based
scrolling is that is not available.
By default, all IDs ever created in a vault are returned, including deleted or
private archives. This requires `list` vault permission on non-public vaults.
You can fall back on search-based scrolling if available, or enable `strict`
mode to only list archives load-able by the current user.
"""
......@@ -15,6 +18,11 @@ def register(subparsers):
action="store_true",
help="Retrieve IDs using search instead of the scroll api",
)
parser.add_argument(
"--strict",
action="store_true",
help="Enable strict-mode and only return IDs that are load-able by the current user",
)
parser.add_argument("START", nargs="?", help="Start with this ID.")
parser.set_defaults(main=scroll)
......@@ -32,12 +40,12 @@ def scroll(ctx, args):
start = args.START or ""
if not args.use_search:
for aid in client.iter_scroll(vault, start=start):
print(aid)
else:
if args.use_search:
q = "is:archive"
if start:
q = "{} AND id:>{}".format(q, qescape(start))
for hit in client.iter_search(vault, q, order="id"):
print(hit.id)
else:
for aid in client.iter_scroll(vault, start=start, strict=args.strict):
print(aid)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment