35 lines
1.1 KiB
Lua
35 lines
1.1 KiB
Lua
|
|
local lang = jarvis.context.language
|
||
|
|
local userprofile = jarvis.system.env("USERPROFILE") or "C:\\Users\\Public"
|
||
|
|
local config_path = userprofile .. "\\Documents\\jarvis-projects.json"
|
||
|
|
|
||
|
|
if not jarvis.fs.exists(config_path) then
|
||
|
|
jarvis.system.notify(
|
||
|
|
lang == "ru" and "Проекты" or "Projects",
|
||
|
|
lang == "ru" and "Конфиг ещё не создан — скажи «открой проект» один раз"
|
||
|
|
or "Config not created yet — say 'open project' once"
|
||
|
|
)
|
||
|
|
jarvis.audio.play_not_found()
|
||
|
|
return { chain = false }
|
||
|
|
end
|
||
|
|
|
||
|
|
local content = jarvis.fs.read(config_path)
|
||
|
|
local names = {}
|
||
|
|
for name in content:gmatch('"name"%s*:%s*"([^"]+)"') do
|
||
|
|
table.insert(names, name)
|
||
|
|
end
|
||
|
|
|
||
|
|
if #names == 0 then
|
||
|
|
jarvis.system.notify("Projects", lang == "ru" and "Список пуст" or "Empty")
|
||
|
|
jarvis.audio.play_not_found()
|
||
|
|
return { chain = false }
|
||
|
|
end
|
||
|
|
|
||
|
|
local body = table.concat(names, ", ")
|
||
|
|
jarvis.system.notify(
|
||
|
|
(lang == "ru" and "Проектов: " or "Projects: ") .. #names,
|
||
|
|
body
|
||
|
|
)
|
||
|
|
jarvis.log("info", "projects: " .. body)
|
||
|
|
jarvis.audio.play_ok()
|
||
|
|
return { chain = false }
|