chore: removed redundant lines in templates
This commit is contained in:
@@ -12,7 +12,7 @@ end
|
|||||||
function M.run()
|
function M.run()
|
||||||
local root = utils.get_project_root()
|
local root = utils.get_project_root()
|
||||||
|
|
||||||
local cmd = { "cd " .. root, "build", " && cmake --build ." }
|
local cmd = { "cd " .. root, "build && cmake --build ." }
|
||||||
local output = vim.fn.system(table.concat(cmd, "/"))
|
local output = vim.fn.system(table.concat(cmd, "/"))
|
||||||
|
|
||||||
if not vim.v.shell_error == 0 then
|
if not vim.v.shell_error == 0 then
|
||||||
|
|||||||
@@ -232,7 +232,6 @@ M.aux_files = {
|
|||||||
c = {
|
c = {
|
||||||
run = function (file_name)
|
run = function (file_name)
|
||||||
if not file_name then return print("Header file creation canceled") end
|
if not file_name then return print("Header file creation canceled") end
|
||||||
local root = utils.get_project_root()
|
|
||||||
local guard_macro = file_name:upper():gsub("[^A-Z0-9]", "_") .. "_H"
|
local guard_macro = file_name:upper():gsub("[^A-Z0-9]", "_") .. "_H"
|
||||||
local content = string.format([[
|
local content = string.format([[
|
||||||
#ifndef %s
|
#ifndef %s
|
||||||
@@ -242,13 +241,12 @@ M.aux_files = {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
]], guard_macro, guard_macro)
|
]], guard_macro, guard_macro)
|
||||||
utils.write_file({ root, "include", file_name .. ".h" }, content)
|
utils.write_file({ utils.get_project_root(), "include", file_name .. ".h" }, content)
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
cpp = {
|
cpp = {
|
||||||
run = function(file_name)
|
run = function(file_name)
|
||||||
if not file_name then return print("Header file creation canceled") end
|
if not file_name then return print("Header file creation canceled") end
|
||||||
local root = utils.get_project_root()
|
|
||||||
local guard_macro = file_name:upper():gsub("[^A-Z0-9]", "_") .. "_HPP"
|
local guard_macro = file_name:upper():gsub("[^A-Z0-9]", "_") .. "_HPP"
|
||||||
local content = string.format([[
|
local content = string.format([[
|
||||||
#ifndef %s
|
#ifndef %s
|
||||||
@@ -258,7 +256,7 @@ M.aux_files = {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
]], guard_macro, guard_macro, guard_macro)
|
]], guard_macro, guard_macro, guard_macro)
|
||||||
utils.write_file({ root, "include", file_name .. ".hpp" }, content)
|
utils.write_file({ utils.get_project_root(), "include", file_name .. ".hpp" }, content)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user