]> Git repositories of Lucie Scarlet - cmakegen.git/commitdiff
Added feedback for what project it generates for
authorLucie Scarlet <lucie@scarlet.moe>
Fri, 12 Jul 2024 10:27:03 +0000 (12:27 +0200)
committerLucie Scarlet <lucie@scarlet.moe>
Fri, 12 Jul 2024 10:27:03 +0000 (12:27 +0200)
cmakegen

index 738dc02e5b5735f5fb2c3f888012696f5fcc42e2..9cd750d398fc6b2cb5612766cf09ebc9b59ae351 100755 (executable)
--- a/cmakegen
+++ b/cmakegen
@@ -10,16 +10,17 @@ CMAKE_FILE = getcwd() + "/CMakeLists.txt"
 def main() -> int:
     cmake_contents: str
     project_name : str = getcwd().split("/")[-1]
-    is_c: bool = True if argv[1] in ("-c",) else False
+    is_c: bool = True if len(argv) > 1 and argv[1] in ("-c",) else False
     template = CMAKE_C_TEMPLATE if is_c else CMAKE_TEMPLATE
     with open(template, "r") as f:
         cmake_contents = f.read()
     cmake_contents = cmake_contents.replace("PROJECT_TEMPLATE_NAME", project_name)
     with open(CMAKE_FILE, "w") as f:
         f.write(cmake_contents)
-    print("-" * len(CMAKE_FILE))
-    print(CMAKE_FILE)
-    print("-" * len(CMAKE_FILE))
+    output = CMAKE_FILE + f" - {'C' if is_c else 'C++'} project"
+    print("-" * len(output))
+    print(output)
+    print("-" * len(output))
     return 0
 
 if __name__ == "__main__":