Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
KDesp73 committed Dec 24, 2023
1 parent 3013ff7 commit 2000eb6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
13 changes: 6 additions & 7 deletions lua/project-starter/builders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local vim = vim

local paths = require("project-starter.paths")
local utils = require("project-starter.utils")
local run_command = require("project-starter.commands")


return {
Expand All @@ -11,7 +12,7 @@ return {

if not utils.handle_invalid_path(path) then return nil end

vim.cmd(":silent !cd ".. path .. " && " .. "git clone https://github.com/KDesp73/CPP-Project-Template " .. name)
run_command.cpp(path, name)

utils.change_nvim_directory(path .. name)
return path .. name
Expand All @@ -24,9 +25,7 @@ return {

if not utils.handle_invalid_path(path) then return nil end

local command = "mvn archetype:generate -DgroupId=" .. groupId .. " -DartifactId=" .. artifactId .. " -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false"

vim.cmd(":silent !cd " .. path .. " && " .. command)
run_command.java(path, groupId, artifactId)

utils.change_nvim_directory(path .. artifactId)

Expand All @@ -39,7 +38,7 @@ return {

if not utils.handle_invalid_path(path) then return nil end

vim.cmd(":silent !cd ".. path .. " && " .. "git clone https://github.com/KDesp73/swing-gui-starter " .. name)
run_command.swing(path, name)

utils.change_nvim_directory(path .. name)

Expand All @@ -53,7 +52,7 @@ return {

if not utils.handle_invalid_path(path) then return nil end

vim.cmd(":silent !cd " .. path .. " && " .. "git clone https://github.com/KDesp73/plugin-template.nvim " .. name)
run_command.nvim_plugin(path, name)

utils.change_nvim_directory(path .. name)

Expand All @@ -66,7 +65,7 @@ return {

if not utils.handle_invalid_path(path) then return nil end

vim.cmd(":silent !cd " .. path .. " && " .. "git clone https://github.com/KDesp73/python-starter.git " .. name)
run_command.python(path, name)

utils.change_nvim_directory(path .. name)

Expand Down
25 changes: 25 additions & 0 deletions lua/project-starter/commands.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
local vim = vim

return {
cpp = function(path, name)
vim.cmd(":silent !cd ".. path .. " && " .. "git clone https://github.com/KDesp73/CPP-Project-Template " .. name)
end,

java = function(path, groupId, artifactId)
local command = "mvn archetype:generate -DgroupId=" .. groupId .. " -DartifactId=" .. artifactId .. " -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false"

vim.cmd(":silent !cd " .. path .. " && " .. command)
end,

swing = function(path, name)
vim.cmd(":silent !cd ".. path .. " && " .. "git clone https://github.com/KDesp73/swing-gui-starter " .. name)
end,

nvim_plugin = function (path, name)
vim.cmd(":silent !cd " .. path .. " && " .. "git clone https://github.com/KDesp73/plugin-template.nvim " .. name)
end,

python = function (path, name)
vim.cmd(":silent !cd " .. path .. " && " .. "git clone https://github.com/KDesp73/python-starter.git " .. name)
end,
}
2 changes: 1 addition & 1 deletion lua/project-starter/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ vim.api.nvim_create_user_command(
{ desc = "Create a template project", nargs = '?' }
)


return M

0 comments on commit 2000eb6

Please sign in to comment.