add template messages
This commit is contained in:
parent
687a711a75
commit
d0fc0350a2
20
DFGdocs.py
20
DFGdocs.py
@ -24,6 +24,7 @@ class Template():
|
|||||||
path: str
|
path: str
|
||||||
mainfile: str
|
mainfile: str
|
||||||
files: list[str] = attrs.Factory(list)
|
files: list[str] = attrs.Factory(list)
|
||||||
|
messages: list[str] = attrs.Factory(list)
|
||||||
|
|
||||||
def compact_info(self, col_width=25):
|
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}")
|
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:")
|
print(f"Template files:")
|
||||||
for f in self.files:
|
for f in self.files:
|
||||||
print(f'\t{f}')
|
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):
|
def patch_make(self, source, dest, new_name):
|
||||||
lines = []
|
lines = []
|
||||||
@ -70,6 +74,14 @@ class Template():
|
|||||||
self.patch_make(source_file, dest_file, project_name)
|
self.patch_make(source_file, dest_file, project_name)
|
||||||
else:
|
else:
|
||||||
dest_file.write_bytes(source_file.read_bytes())
|
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():
|
def find_templates():
|
||||||
@ -125,6 +137,10 @@ def args_check(args, parser, templates):
|
|||||||
parser.print_help()
|
parser.print_help()
|
||||||
sys.exit(2)
|
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:
|
if args.name is None:
|
||||||
print(f"Error using DFGdocs. NAME argument is not defined!")
|
print(f"Error using DFGdocs. NAME argument is not defined!")
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
@ -135,10 +151,6 @@ def args_check(args, parser, templates):
|
|||||||
print_templates(templates)
|
print_templates(templates)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if args.info and args.template is not None:
|
|
||||||
templates[args.template].full_info()
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = create_parser()
|
parser = create_parser()
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
"author": "Jan Grewe",
|
"author": "Jan Grewe",
|
||||||
"brief": "Template for the final project report.",
|
"brief": "Template for the final project report.",
|
||||||
"mainfile": "abschlussbericht.tex",
|
"mainfile": "abschlussbericht.tex",
|
||||||
"files": ["header.tex", "DFG_logo.png", "Makefile", "abschlussbericht.tex"]
|
"files": ["header.tex", "DFG_logo.png", "Makefile", "abschlussbericht.tex"],
|
||||||
|
"messages": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -8,7 +8,10 @@
|
|||||||
"author": "Jan Grewe",
|
"author": "Jan Grewe",
|
||||||
"brief": "Template for the final project report.",
|
"brief": "Template for the final project report.",
|
||||||
"mainfile": "lebenslauf.tex",
|
"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",
|
"name": "Curriculum vitae EN",
|
||||||
@ -18,7 +21,10 @@
|
|||||||
"author": "Jan Grewe",
|
"author": "Jan Grewe",
|
||||||
"brief": "Template for the final project report.",
|
"brief": "Template for the final project report.",
|
||||||
"mainfile": "cv.tex",
|
"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!"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -8,7 +8,8 @@
|
|||||||
"author": "Jan Grewe",
|
"author": "Jan Grewe",
|
||||||
"brief": "Template for grant application as Sachbeihilfe.",
|
"brief": "Template for grant application as Sachbeihilfe.",
|
||||||
"mainfile": "sachbeihilfe.tex",
|
"mainfile": "sachbeihilfe.tex",
|
||||||
"files": ["header.tex", "DFG_logo.png", "Makefile", "sachbeihilfe.tex"]
|
"files": ["header.tex", "DFG_logo.png", "Makefile", "sachbeihilfe.tex"],
|
||||||
|
"messages": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user