2023-02-08 17:53:18 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# papis-short-help: Manually rebuild cache for all libraries
|
|
|
|
#
|
|
|
|
# This tiny script updates all libraries by rebuilding their caches.
|
|
|
|
# Useful to invoke after manual edits in one of your library folders
|
2023-08-25 14:27:42 +00:00
|
|
|
# if you have many 'sub-libraries' (one library location with sub-
|
|
|
|
# directories).
|
|
|
|
# You don't have to think about which library you changed stuff in
|
2023-02-08 17:53:18 +00:00
|
|
|
# and just get everything updated. Might take a little time but
|
2023-08-25 14:27:42 +00:00
|
|
|
# should generally be a quick process ().
|
2023-02-08 17:53:18 +00:00
|
|
|
|
|
|
|
import papis.api
|
2023-08-25 14:27:42 +00:00
|
|
|
from argparse import ArgumentParser
|
2023-02-08 17:53:18 +00:00
|
|
|
|
2023-08-25 14:27:42 +00:00
|
|
|
parser = ArgumentParser()
|
|
|
|
parser.add_argument(
|
|
|
|
"--all", "-a", help="reload all libraries not just current", action="store_true"
|
|
|
|
)
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
if args.all:
|
|
|
|
libs = papis.api.get_libraries()
|
|
|
|
else:
|
|
|
|
libs = [papis.api.get_lib_name()]
|
2023-02-08 17:53:18 +00:00
|
|
|
|
|
|
|
for lib in libs:
|
|
|
|
papis.api.clear_lib_cache(lib)
|
|
|
|
papis.api.get_all_documents_in_lib()
|