Skip to content

Commit 071c946

Browse files
add check for commands from string
1 parent efdcd06 commit 071c946

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lfric_macros/apply_macros.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -764,10 +764,12 @@ def combine_macros(self, import_order):
764764
and "commands" in self.target_macros[meta_import]
765765
):
766766
# Add a comment labelling where these commands came from
767-
full_command += (
768-
" # Commands From: "
769-
f"{self.parse_application_section(meta_import)}\n"
770-
)
767+
# Check the comment hasn't already been added
768+
if not re.search(r"Commands From: \w+", self.target_macros[meta_import]["commands"]):
769+
full_command += (
770+
" # Commands From: "
771+
f"{self.parse_application_section(meta_import)}\n"
772+
)
771773
if self.target_macros[meta_import]["commands"].strip("\n"):
772774
full_command += self.target_macros[meta_import]["commands"] + "\n"
773775
else:

0 commit comments

Comments
 (0)