FEAT: adding create_project

This commit is contained in:
2026-10-19 11:59:24 -04:00
parent 06eb74e13f
commit 380f295c93
6 changed files with 225 additions and 46 deletions
+48 -10
View File
@@ -1,16 +1,54 @@
local M = {}
M.create_project = function(opts, args)
M.create_project = function(opts)
opts = opts or {}
local test = nil
if opts and opts.terminal then
test = opts.terminal.mode
end
if args and args.args and args ~= "" then
print(string.format("Opts: %s, Args: %s", test, args.args))
return
end
vim.ui.input({
prompt = "Project language (e.g. python): ",
default = "",
completion = "filetype",
}, function(ft)
if ft ~= nil and vim.trim(ft) ~= "" then
local ok, actions = pcall(require, "vern.actions." .. ft)
local configs = require("vern.configs." .. ft)
local args = vim.tbl_deep_extend("force", {}, configs, opts or {})
if
ok
and actions
and type(actions.create_project) == "function"
then
actions.create_project(args)
else
vim.notify("Unknown Filetype: " .. ft, vim.log.levels.WARN, {
title = "Vern Project",
})
end
end
end)
end
M.create_file = function(opts)
opts = opts or {}
vim.ui.input({
prompt = "File language (e.g. python): ",
default = "",
completion = "filetype",
}, function(ft)
if ft ~= nil and vim.trim(ft) ~= "" then
local ok, actions = pcall(require, "vern.actions." .. ft)
local configs = require("vern.configs." .. ft)
local args = vim.tbl_deep_extend("force", {}, configs, opts or {})
if ok and actions and type(actions.create_file) == "function" then
actions.create_file(args)
else
vim.notify("Unknown Filetype: " .. ft, vim.log.levels.WARN, {
title = "Vern File",
})
vim.notify("Error: " .. actions, vim.log.levels.ERROR, {
title = "Vern File",
})
end
end
end)
end
M.create_file = function(opts, args) end
return M