diff --git a/update_layout.py b/update_layout.py index d3a08d1..1362ccd 100644 --- a/update_layout.py +++ b/update_layout.py @@ -7,23 +7,6 @@ app = typer.Typer(no_args_is_help=True) -def fix_file(target_file: pathlib.Path): - fm_file = frontmatter.loads(target_file.read_text()) - - if "layout" not in fm_file.metadata: - fm_file["layout"] = "post" - target_file.write_text(frontmatter.dumps(fm_file)) - - -@app.command(name="fix") -def fix_files( - target_files: typing.List[pathlib.Path], -) -> None: - """Adds the default layout if the post is missing.""" - for target_file in target_files: - fix_file(target_file) - - @app.command(name="check") def check_file( target_files: typing.List[pathlib.Path], @@ -36,7 +19,8 @@ def check_file( if "layout" not in fm_file.metadata: print("%s is missing the `layout` value. Applying layout: post.") - fix_file(target_file) + fm_file["layout"] = "post" + target_file.write_text(frontmatter.dumps(fm_file)) ret_code = 1 typer.Exit(code=ret_code)