papis: Change papis-reload to work on current lib
Papis reload will now only rebuild the cache of the currently active library by default. To rebuild the cache of all libraries papis knows, simply supply the `--all` switch.
This commit is contained in:
parent
6122077124
commit
0e12325730
1 changed files with 15 additions and 3 deletions
|
@ -3,13 +3,25 @@
|
||||||
#
|
#
|
||||||
# This tiny script updates all libraries by rebuilding their caches.
|
# This tiny script updates all libraries by rebuilding their caches.
|
||||||
# Useful to invoke after manual edits in one of your library folders
|
# Useful to invoke after manual edits in one of your library folders
|
||||||
# so you don't have to think about which library you changed stuff in
|
# 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
|
||||||
# and just get everything updated. Might take a little time but
|
# and just get everything updated. Might take a little time but
|
||||||
# should generally be a quick process (even with 1000s of entries).
|
# should generally be a quick process ().
|
||||||
|
|
||||||
import papis.api
|
import papis.api
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
|
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()
|
libs = papis.api.get_libraries()
|
||||||
|
else:
|
||||||
|
libs = [papis.api.get_lib_name()]
|
||||||
|
|
||||||
for lib in libs:
|
for lib in libs:
|
||||||
papis.api.clear_lib_cache(lib)
|
papis.api.clear_lib_cache(lib)
|
||||||
|
|
Loading…
Reference in a new issue