Skip to content

Commit

Permalink
added esp32 platformio project starter
Browse files Browse the repository at this point in the history
  • Loading branch information
KDesp73 committed Mar 2, 2024
1 parent 09e2ec5 commit 90bffd3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/project-starter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
6. Python
7. Ruby
8. Android Apps with Kotlin
9. Esp32 Platformio Project

vim:tw=78:ts=8:ft=help:norl:
12 changes: 12 additions & 0 deletions lua/project-starter/builders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ local options = require("project-starter.options")


return {
["esp32"] = function(name)
name = name or vim.fn.input("Name: ")

local path = paths["esp32"] or vim.fn.input("Path: ")
if not utils.handle_invalid_path(path) then return nil end

run_command.esp32(path, name)

utils.change_nvim_directory(path .. name)
return path .. name
end,

["android"] = function (name)
name = name or vim.fn.input("Name: ")
local package_name = options.jdk_app_package_name or vim.fn.input("App Package Name: ")
Expand Down
5 changes: 5 additions & 0 deletions lua/project-starter/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ local vim = vim

local M = {}

M.esp32 = function (path, name)
vim.cmd(":silent !cd " .. path .. " && " .. "git clone --depth=1 https://github.com/KDesp73/esp32-starter " .. name)
vim.cmd(":silent !cd " .. path .. name .. " && rm -r .git")
end

M.android = function(path, name, package_name)
-- Python3 is required
vim.cmd(":silent !cd " .. path .. " && " .. "python3 -c \"$(curl -fsSL https://raw.githubusercontent.com/KDesp73/create-android-kotlin-app/master/create-android-kotlin-app.py)\" " .. name .. " " .. package_name)
Expand Down
3 changes: 3 additions & 0 deletions lua/project-starter/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ M.setup = function (opts)
if opts.default_paths.android then
paths.android = opts.default_paths.android
end
if opts.default_paths.esp32 then
paths.esp32 = opts.default_paths.esp32
end
end

if opts.cd ~= nil then
Expand Down
1 change: 1 addition & 0 deletions lua/project-starter/paths.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ return {
python = nil,
ruby = nil,
android = nil,
esp32 = nil,
}

0 comments on commit 90bffd3

Please sign in to comment.