arg --interactive
This commit is contained in:
+10
-3
@@ -1,4 +1,4 @@
|
||||
import pathlib, re, frontmatter, markdown, citeproc, json
|
||||
import argparse, pathlib, re, frontmatter, markdown, citeproc, json
|
||||
from pyzotero import zotero
|
||||
from html.parser import HTMLParser
|
||||
import utils
|
||||
@@ -66,6 +66,10 @@ def format_filename_title(data_csl:dict, bib_entry:str):
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
p = argparse.ArgumentParser(description="Fetch zotero bibliography")
|
||||
p.add_argument("--interactive", default=False, action=argparse.BooleanOptionalAction, help="make interactive")
|
||||
args = p.parse_args()
|
||||
|
||||
conf = utils.load_conf()
|
||||
|
||||
z = zotero.Zotero(conf['zotero_group_id'], conf['zotero_lib_type'], conf['zotero_api_key'])
|
||||
@@ -125,8 +129,11 @@ if __name__ == "__main__":
|
||||
## selective update
|
||||
new = format_reading(title=title, desc=bib_entry)
|
||||
|
||||
updated = update_reading(prev, new)
|
||||
utils.save_file(filepath, frontmatter.dumps(updated), overwrite=True)
|
||||
if(args.interactive):
|
||||
updated = update_reading(prev, new)
|
||||
utils.save_file(filepath, frontmatter.dumps(updated), overwrite=True)
|
||||
else:
|
||||
utils.save_file(filepath, frontmatter.dumps(new), overwrite=True)
|
||||
|
||||
print(f"reading {e} updated")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user