From 5d5e5b125a383174f1891d37498415cc10fe84fe Mon Sep 17 00:00:00 2001 From: Joey Castillo Date: Wed, 26 Jan 2022 20:31:04 -0500 Subject: watch face script: autopopulate year --- movement/template/watch_face.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'movement/template') diff --git a/movement/template/watch_face.py b/movement/template/watch_face.py index 71b29301..85a0f8b2 100644 --- a/movement/template/watch_face.py +++ b/movement/template/watch_face.py @@ -22,6 +22,7 @@ import os import re +import datetime import argparse @@ -32,10 +33,9 @@ INCLUDE_INDICATOR = "// New includes go above this line.\n" def replace_placeholders(contents, args): modified_contents = contents.replace("<#WATCH_FACE_NAME#>", args.watch_face_name.upper()) modified_contents = modified_contents.replace("<#watch_face_name#>", args.watch_face_name) + modified_contents = modified_contents.replace("<#year#>", datetime.datetime.now().strftime("%Y")) if args.author_name: modified_contents = modified_contents.replace("<#author_name#>", " ".join(args.author_name)) - if args.year: - modified_contents = modified_contents.replace("<#year#>", args.year) return modified_contents @@ -70,7 +70,6 @@ def main(): parser.add_argument("watch_face_type", metavar="face_type", type=str, choices=["complication", "clock"], help="The type of watch face to create, either \"complication\" or \"clock\"") parser.add_argument("watch_face_name", metavar="face_name", type=str, help="The name of the watch face") parser.add_argument("--author_name", metavar="author_name", type=str, nargs='*', help="The name of the author") - parser.add_argument("--year", metavar="year", type=str, help="The copyright year") args = parser.parse_args() -- cgit v1.2.3