sync: 2026-10-27 15:36
This commit is contained in:
1 parent
db1e1adf3d
commit
5465c51d8d
8 files changed
+73
-9
No files matched your search
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python3
|
||||
import getpass
|
||||
import os, subprocess
|
||||
|
||||
import random
|
||||
|
||||
class Colors:
|
||||
RED = "\033[0;31m"
|
||||
@@ -11,6 +11,7 @@ class Colors:
|
||||
END = "\033[0m"
|
||||
|
||||
|
||||
|
||||
def ask(question: str, default=None, required=False, confidential=False):
|
||||
"""Ask a question to the user and check if the result is good"""
|
||||
while True:
|
||||
@@ -31,10 +32,32 @@ def ask(question: str, default=None, required=False, confidential=False):
|
||||
else:
|
||||
print(f"{Colors.RED}this field is required !{Colors.END}")
|
||||
|
||||
tips = [
|
||||
f"you can use environnment variables to set an Email and a Discord to the README file ! "
|
||||
]
|
||||
|
||||
print(Colors.YELLOW+random.choice(tips)+Colors.END)
|
||||
|
||||
project_name = ask("enter your project filename > ", required=True)
|
||||
libs = ask("enter your libs flags press (let the field blank if None) > ", default="")
|
||||
|
||||
readme = """
|
||||
# ###PROJECTNAME###
|
||||
|
||||
## Description
|
||||
|
||||
## Compilation / Execution
|
||||
|
||||
pour compiler le projet il suffit d'éxecuter : ```make```
|
||||
|
||||
pour éxecuter le projet il suffit d'éxécuter : ```bin/###PROJECTNAME###```
|
||||
|
||||
## FAQ
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
||||
template = f"""# tool macros
|
||||
CC ?= gcc
|
||||
#CXX ?=
|
||||
@@ -110,6 +133,20 @@ with open("Makefile", "w", encoding="utf-8", errors="ignore") as f:
|
||||
f.write(template)
|
||||
print(f"{Colors.GREEN}Makefile build successfully !{Colors.END}")
|
||||
f.close()
|
||||
|
||||
|
||||
readme=readme.replace("###PROJECTNAME###",project_name)
|
||||
|
||||
mail=os.getenv("EMAIL") or None
|
||||
mail=os.getenv("DISCORD") or None
|
||||
if not mail == None and not discord == None:
|
||||
readme+=f"\n\n## Bugs / Question\n-email: {mail}\n- Discord: {discord}"
|
||||
|
||||
with open("README.md", "w", encoding="utf-8", errors="ignore") as f:
|
||||
f.write(readme)
|
||||
print(f"{Colors.GREEN}README written successfully !{Colors.END}")
|
||||
f.close()
|
||||
|
||||
os.system("make makedir")
|
||||
open("src/main.c", "w").write(
|
||||
"""#include <stdio.h>\n#include <stdlib.h>\n\nint main(void) {\n\n\treturn EXIT_SUCCESS;\n}"""
|
||||
|
||||
Reference in new issue
Block a user