REFACTOR: Merged templates into a per language file, deleted init.lua as

it was just a middle man and wasnt needed (in fact it is better without
it)
FT: Changes to python
This commit is contained in:
2026-10-15 23:32:26 -04:00
parent 6593db3829
commit 98bd619cfa
12 changed files with 131 additions and 106 deletions
+6 -6
View File
@@ -2,7 +2,7 @@ local M = {}
---@param opts table
M.template = function(opts)
local base = [=[
local base = [=[
.DS_Store
.vscode/
@@ -12,8 +12,8 @@ M.template = function(opts)
.env.*
]=]
local lang_block = {
python = [=[
local lang_block = {
python = [=[
__pycache__/
build/
dist/
@@ -22,10 +22,10 @@ env/
venv/
.pytest_cache/
]=],
}
}
local extra = (opts and opts and lang_block[opts.lang]) or ""
return base .. extra
local extra = (opts and opts and lang_block[opts.lang]) or ""
return base .. extra
end
return M
-13
View File
@@ -1,13 +0,0 @@
local M = {}
---@param opts table
M.template = function(opts)
local template = [=[
# %s
__all__: list[str] = []
]=]
return string.format(template, opts.project_name)
end
return M
+53
View File
@@ -0,0 +1,53 @@
local M = {}
M.main = function(opts)
local template = [=[
def main() -> None:
printf("Hello from %s!")
if __name__ == "__main__":
main()
]=]
return string.format(template, opts.project_name)
end
M.__init__ = function(opts)
local template = [=[
# %s
__all__: list[str] = []
]=]
return string.format(template, opts.project_name)
end
M.pyproject = function(opts)
local n = opts.project_name
local template = [=[
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "%s"
version = "0.1.0"
description = "Project %s"
readme = "README.md"
requires-python = ">=3.10"
dependencies = []
[project.scripts]
%s = "%s.main:main"
]=]
return string.format(template, n, n, n, n)
end
M.module = function(opts)
local template = [=[
"""
%s module
"""
]=]
return string.format(template, opts.project_name)
end
return M
-15
View File
@@ -1,15 +0,0 @@
local M = {}
---@param opts table
M.template = function(opts)
local template = [=[
def main() -> None:
printf("Hello from %s!")
if __name__ == "__main__":
main()
]=]
return string.format(template, opts.project_name)
end
return M
-13
View File
@@ -1,13 +0,0 @@
local M = {}
---@param opts table
M.template = function(opts)
local template = [=[
"""
%s module
"""
]=]
return string.format(template, opts.project_name)
end
return M
-25
View File
@@ -1,25 +0,0 @@
local M = {}
---@param opts table
M.template = function(opts)
local n = opts.project_name
local template = [=[
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "%s"
version = "0.1.0"
description = "Project %s"
readme = "README.md"
requires-python = ">=3.10"
dependencies = []
[project.scripts]
%s = "%s.main:main"
]=]
return string.format(template, n, n, n, n)
end
return M