REFACTOR: Cleaning up project and removing more deprecated code

This commit is contained in:
2026-10-16 10:38:06 -04:00
parent 98bd619cfa
commit 06eb74e13f
11 changed files with 142 additions and 332 deletions
+12 -16
View File
@@ -1,7 +1,6 @@
local M = {}
local utils = require("vern.utils")
M.default_target_file = "main.py"
function M.create_project(opts) end
function M.create_file(opts) end
@@ -13,32 +12,29 @@ function M.run(opts)
local root = utils.get_project_root() or "."
local project_name = vim.fs.basename(root)
local pattern = vim.tbl_get(
opts,
"templates",
"project",
"executable",
"target"
) or "src/%s/main.py"
local rel_path = pattern:find("%%s")
and string.format(pattern, project_name)
or pattern
local exe = opts.python.templates.project.executable.target
or "src/%s/main.py"
local rel_path = exe:find("%%s") and string.format(exe, project_name) or exe
local full_path = root .. "/" .. rel_path
utils.terminal({ "python3 " .. full_path }, opts)
utils.terminal({ "python3 " .. full_path }, opts.terminal or {})
end
---@param cmd_args? table Takes a table for the runtime
function M.pip_install(opts, cmd_args)
if cmd_args and cmd_args.args and cmd_args ~= "" then
utils.terminal({ "pip install " .. cmd_args.args })
local args = cmd_args and cmd_args.args and vim.trim(cmd_args.args) or ""
if args ~= "" then
utils.terminal({ "pip install " .. args }, opts.terminal or {})
return
end
vim.ui.input({ prompt = "Enter pip module: " }, function(pip_module)
if not pip_module or pip_module == "" then
if not pip_module or vim.trim(pip_module) == "" then
vim.notify("Pip Cancelled", vim.log.levels.WARN)
return
end
utils.terminal({ "pip install " .. pip_module }, opts or {})
utils.terminal(
{ "pip install " .. vim.trim(pip_module) },
opts.terminal or {}
)
end)
end