feat: added git initalization to java as test for replacement to polydev files
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user