Skip to content

Commit

Permalink
print a summary on completion of zimport
Browse files Browse the repository at this point in the history
partial fix for issue ZettelGeist#41
  • Loading branch information
icornelius committed Jun 23, 2024
1 parent 1989571 commit 859a60f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions zettelgeist/zimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ def main():

db = zdb.get(args.database)
zettel_dir = args.dir
process_count = 0
error_count = 0

for entry in get_zettels(zettel_dir):
if args.fullpath:
filepath = os.path.abspath(entry)
else:
filepath = entry
print("Processing %s" % filepath)
process_count += 1
if filepath.endswith('.yaml'):
yaml_info = zettel.load_pure_yaml(filepath)
elif filepath.endswith('.md'):
Expand All @@ -63,12 +66,14 @@ def main():
except zettel.ParseError as error:
error_text = str(error)
print("%s:\n%s" % (filepath, error_text))
error_count += 1
continue

if not args.validate:
db.bind(z, filepath, document)
db.insert_into_table()

print("Processed %s files with %s errors" % (process_count, error_count))
db.done()


Expand Down

0 comments on commit 859a60f

Please sign in to comment.