From d0fc0350a27b923e6e691f37791400b9d46de897 Mon Sep 17 00:00:00 2001
From: Jan Grewe <jan.grewe@g-node.org>
Date: Sun, 22 Oct 2023 13:57:31 +0200
Subject: [PATCH] add template messages

---
 DFGdocs.py                 | 20 ++++++++++++++++----
 abschlussbericht/info.json |  3 ++-
 lebenslauf/info.json       | 10 ++++++++--
 sachbeihilfe/info.json     |  3 ++-
 4 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/DFGdocs.py b/DFGdocs.py
index a16d97e..131622f 100755
--- a/DFGdocs.py
+++ b/DFGdocs.py
@@ -24,6 +24,7 @@ class Template():
     path: str
     mainfile: str
     files: list[str] = attrs.Factory(list)
+    messages: list[str] = attrs.Factory(list)
 
     def compact_info(self, col_width=25):
         info = (f"\t{self.alias}{(col_width - len(self.alias)) * ' '}{self.name}{(col_width - len(self.name)) * ' '}{self.version}{(col_width - len(self.version)) * ' '}{self.language}")
@@ -38,6 +39,9 @@ class Template():
         print(f"Template files:")
         for f in self.files:
             print(f'\t{f}')
+        print(f"Messages:")
+        for i, m in enumerate(self.messages):
+            print(f'\t{i}: {m}')
 
     def patch_make(self, source, dest, new_name):
         lines = []
@@ -70,6 +74,14 @@ class Template():
                 self.patch_make(source_file, dest_file, project_name)
             else:
                 dest_file.write_bytes(source_file.read_bytes())
+        # report
+        print(f"Created new project in {dest}")
+        print(f"... copied {len(self.files)} files")
+        print(f"... patched Makefile")
+        print(f"... template messages:")
+        for i, m in enumerate(self.messages):
+            print(f"\t{i}: {m}")
+        print("... done.")
 
 
 def find_templates():
@@ -125,6 +137,10 @@ def args_check(args, parser, templates):
         parser.print_help()
         sys.exit(2)
 
+    if args.info and args.template is not None:
+        templates[args.template].full_info()
+        sys.exit(0)
+
     if args.name is None:
         print(f"Error using DFGdocs. NAME argument is not defined!")
         parser.print_help()
@@ -135,10 +151,6 @@ def args_check(args, parser, templates):
         print_templates(templates)
         sys.exit(0)
 
-    if args.info and args.template is not None:
-        templates[args.template].full_info()
-        sys.exit(0)
-
 
 def main():
     parser = create_parser()
diff --git a/abschlussbericht/info.json b/abschlussbericht/info.json
index 8fd734a..13d56d4 100644
--- a/abschlussbericht/info.json
+++ b/abschlussbericht/info.json
@@ -8,7 +8,8 @@
         "author": "Jan Grewe",
         "brief": "Template for the final project report.",
         "mainfile": "abschlussbericht.tex",
-        "files": ["header.tex", "DFG_logo.png", "Makefile", "abschlussbericht.tex"]
+        "files": ["header.tex", "DFG_logo.png", "Makefile", "abschlussbericht.tex"],
+        "messages": []
         }
     ]
 }
\ No newline at end of file
diff --git a/lebenslauf/info.json b/lebenslauf/info.json
index a46ec96..8f451e0 100644
--- a/lebenslauf/info.json
+++ b/lebenslauf/info.json
@@ -8,7 +8,10 @@
         "author": "Jan Grewe",
         "brief": "Template for the final project report.",
         "mainfile": "lebenslauf.tex",
-        "files": ["header.tex", "DFG_logo.png", "Makefile", "lebenslauf.tex", "my_publications.bib"]
+        "files": ["header.tex", "DFG_logo.png", "Makefile", "lebenslauf.tex", "my_publications.bib"],
+        "messages": ["Die Publikationen sind in der my_publications.bib Datei einzutragen, siehe Beispiele.", 
+                     "Bitte die Zuordnung der Tabellen in die entsprechenden Abschnitte überprüfen!",
+                     "Der fertige Lebenslauf muss eventuell noch entsprechend der DFG Vorgaben umbenannt werden!"]
         },
         {
         "name": "Curriculum vitae EN",
@@ -18,7 +21,10 @@
         "author": "Jan Grewe",
         "brief": "Template for the final project report.",
         "mainfile": "cv.tex",
-        "files": ["header.tex", "DFG_logo.png", "Makefile", "cv.tex", "my_publications.bib"]
+        "files": ["header.tex", "DFG_logo.png", "Makefile", "cv.tex", "my_publications.bib"],
+        "messages": ["Paper references are stored in the my_publications.bib file, see examples.", 
+                     "Please check that the tables appear in the correct sections (first two sections)!",
+                     "The final CV may need to be renamed to match the DFG regulations!"]
         }
     ]
 }
\ No newline at end of file
diff --git a/sachbeihilfe/info.json b/sachbeihilfe/info.json
index 81eb59c..442528b 100644
--- a/sachbeihilfe/info.json
+++ b/sachbeihilfe/info.json
@@ -8,7 +8,8 @@
         "author": "Jan Grewe",
         "brief": "Template for grant application as Sachbeihilfe.",
         "mainfile": "sachbeihilfe.tex",
-        "files": ["header.tex", "DFG_logo.png", "Makefile", "sachbeihilfe.tex"]
+        "files": ["header.tex", "DFG_logo.png", "Makefile", "sachbeihilfe.tex"],
+        "messages": []
         }
     ]
 }
\ No newline at end of file