Refactoring terminal to be global instead of language specific

This commit is contained in:
DarthMooMancer
2025-04-11 19:12:53 -04:00
parent fd7138b93e
commit 3cee079783
10 changed files with 124 additions and 416 deletions
+4 -10
View File
@@ -1,4 +1,6 @@
local M = {}
local utils = require("Polydev.utils")
M.html_build = nil
M.html_run = nil
@@ -10,14 +12,6 @@ function M.setup(opts)
M.config = vim.tbl_deep_extend("force", M.config, opts or {})
end
local function write_file(path, content)
local file = assert(io.open(path, "w"), "Error creating file: " .. path)
file:write(content)
file:close()
vim.cmd("edit " .. path)
print(path .. " created successfully!")
end
function M.create_project()
vim.ui.input({ prompt = "Enter project name: " }, function(project_name)
if not project_name or project_name == "" then return print("Project creation canceled.") end
@@ -38,7 +32,7 @@ function M.create_project()
</html>
]]
write_file(project_root .. "index.html", main_html_content)
utils.write_file(project_root .. "index.html", main_html_content)
end)
end
@@ -60,7 +54,7 @@ function M.create_new_file()
</html>
]])
write_file("./" .. page .. ".html", html_content)
utils.write_file("./" .. page .. ".html", html_content)
end)
end