feat: added git initalization to java as test for replacement to polydev files

This commit is contained in:
DarthMooMancer
2025-05-11 09:07:03 -04:00
parent acb859f9e5
commit 1e987bf5b6
+19
View File
@@ -15,6 +15,21 @@ local M = {}
---@field html TemplateLanguage
---@alias TemplatesLanguageName "java" | "python" | "lua" | "c" | "cpp" | "rust" | "html"
local function init_git(path, gitignore_lines)
local full_path = vim.fn.expand(path)
vim.fn.mkdir(full_path, "p")
-- Initialize Git
vim.fn.system({ "git", "-C", full_path, "init" })
-- Write .gitignore if provided
if gitignore_lines and #gitignore_lines > 0 then
local gitignore_path = full_path .. "/.gitignore"
local contents = table.concat(gitignore_lines, "\n")
utils.write_file(gitignore_path, contents)
end
end
---@type Projects
M.projects = {
java = {
@@ -28,6 +43,10 @@ public class Main {
}
}
]]
local java_gitignore = {
"build/"
}
init_git(full_project_root, java_gitignore)
utils.write_file(full_project_root .. "/src/Main.java", main_java_content)
return full_project_root
end