From 09334831f7a933154bfdd122f67c5f7c02e02231 Mon Sep 17 00:00:00 2001 From: Akbar Rahman Date: Tue, 2 Jan 2024 03:51:45 +0000 Subject: [PATCH] formatting --- gronk_add_uuid.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gronk_add_uuid.py b/gronk_add_uuid.py index 1c95940..9f6841d 100644 --- a/gronk_add_uuid.py +++ b/gronk_add_uuid.py @@ -1,39 +1,41 @@ #!/usr/bin/env python3 - import pathlib import sys import uuid - import editfrontmatter import frontmatter + def get_args(): """ Get command line arguments """ import argparse parser = argparse.ArgumentParser() parser.add_argument('filename', type=pathlib.Path) - parser.add_argument('-w', '--write', action='store_true', - help='write to file instead of stdout') + parser.add_argument('-w', + '--write', + action='store_true', + help='write to file instead of stdout') return parser.parse_args() def main(args): """ Entry point for script """ - template_str= "\n".join([ + template_str = "\n".join([ "author: {{ author }}" "date: {{ date }}" "title: {{ title }}" "tags: {{ tags }}" "uuid: {{ uuid }}" - ]) + ]) with open(args.filename) as fp: fm_pre = frontmatter.load(fp) - processor = editfrontmatter.EditFrontMatter(file_path=args.filename, template_str=template_str) + processor = editfrontmatter.EditFrontMatter(file_path=args.filename, + template_str=template_str) fm_data = fm_pre.metadata if 'uuid' not in fm_data.keys(): fm_data['uuid'] = str(uuid.uuid4())