76 lines
5.2 KiB
Lua
76 lines
5.2 KiB
Lua
|
|
local lang = jarvis.context.language
|
||
|
|
|
||
|
|
local commands_dir = jarvis.context.command_path:match("^(.*[/\\])[^/\\]+[/\\]?$")
|
||
|
|
if not commands_dir then
|
||
|
|
jarvis.audio.play_error()
|
||
|
|
return { chain = false }
|
||
|
|
end
|
||
|
|
|
||
|
|
local entries = jarvis.fs.list(commands_dir)
|
||
|
|
local packs = {}
|
||
|
|
for _, e in ipairs(entries) do
|
||
|
|
if e.is_dir then table.insert(packs, e.name) end
|
||
|
|
end
|
||
|
|
table.sort(packs)
|
||
|
|
|
||
|
|
local descriptions = {
|
||
|
|
apps = lang == "ru" and "браузер, блокнот, калькулятор, проводник, терминал, настройки, диспетчер задач, блокировка, скриншот" or "browser, notepad, calculator, explorer, terminal, settings, taskmgr, lock, screenshot",
|
||
|
|
volume = lang == "ru" and "громче, тише, mute, максимум" or "louder, quieter, mute, max",
|
||
|
|
media = lang == "ru" and "пауза, play, следующий/предыдущий трек, стоп" or "pause/play, next/prev track, stop",
|
||
|
|
file_search = lang == "ru" and "найди файл X" or "find file X",
|
||
|
|
output_device = lang == "ru" and "список устройств вывода, переключи" or "list/cycle audio out",
|
||
|
|
sysinfo = lang == "ru" and "время, заряд, CPU, RAM, диск, статус системы" or "time, battery, cpu, ram, disk",
|
||
|
|
window = lang == "ru" and "сверни/разверни/закрой окно, snap влево/вправо, рабочий стол" or "min/max/close window, snap, desktop",
|
||
|
|
clipboard_read = lang == "ru" and "прочитай буфер" or "read clipboard",
|
||
|
|
notes = lang == "ru" and "запиши/покажи заметки" or "write/show notes",
|
||
|
|
process_kill = lang == "ru" and "закрой программу X" or "kill process X",
|
||
|
|
websearch = lang == "ru" and "загугли / ютуб / вики / яндекс" or "search google/youtube/wiki/yandex",
|
||
|
|
translate = lang == "ru" and "переведи на X" or "translate to X",
|
||
|
|
math = lang == "ru" and "посчитай X" or "calculate X",
|
||
|
|
theme = lang == "ru" and "тёмная/светлая тема" or "dark/light theme",
|
||
|
|
projects = lang == "ru" and "открой/список проектов" or "open/list projects",
|
||
|
|
sound_panel = lang == "ru" and "панель звука" or "sound panel",
|
||
|
|
codegen = lang == "ru" and "напиши код X" or "write code X",
|
||
|
|
ocr = lang == "ru" and "прочитай экран" or "read screen",
|
||
|
|
reminders = lang == "ru" and "напомни через N минут X" or "remind me in N min X",
|
||
|
|
date_query = lang == "ru" and "что сегодня / завтра / вчера" or "today/tomorrow/yesterday",
|
||
|
|
voice_type = lang == "ru" and "напечатай X" or "type X",
|
||
|
|
dice = lang == "ru" and "монетка, кубик, случайное число" or "coin, dice, random",
|
||
|
|
stopwatch = lang == "ru" and "засеки время / стоп секундомер" or "start/stop stopwatch",
|
||
|
|
news = lang == "ru" and "что нового" or "what's new",
|
||
|
|
currency = lang == "ru" and "курс доллара / евро / юаня" or "USD/EUR/CNY rate",
|
||
|
|
crypto = lang == "ru" and "цена биткоина / эфира" or "BTC/ETH price",
|
||
|
|
fun = lang == "ru" and "шутка, факт, цитата, комплимент" or "joke, fact, quote, compliment",
|
||
|
|
wiki = lang == "ru" and "что такое / кто такой X" or "what/who is X",
|
||
|
|
power = lang == "ru" and "выключи / перезагрузи / усыпи / гибернация" or "shutdown / restart / sleep / hibernate",
|
||
|
|
weather = lang == "ru" and "какая погода" or "what's the weather",
|
||
|
|
counter = lang == "ru" and "счётчик" or "counter",
|
||
|
|
help = lang == "ru" and "что ты умеешь" or "what can you do",
|
||
|
|
}
|
||
|
|
|
||
|
|
local lines = {}
|
||
|
|
for _, p in ipairs(packs) do
|
||
|
|
local desc = descriptions[p] or ""
|
||
|
|
if desc ~= "" then
|
||
|
|
table.insert(lines, "• " .. p .. ": " .. desc)
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
local title = string.format(lang == "ru" and "Команды (%d пакетов)" or "Commands (%d packs)", #packs)
|
||
|
|
local body = table.concat(lines, "\n")
|
||
|
|
jarvis.system.clipboard.set(body)
|
||
|
|
jarvis.system.notify(title, body:sub(1, 800))
|
||
|
|
|
||
|
|
local say = lang == "ru"
|
||
|
|
and string.format("Загружено %d пакетов команд. Полный список скопирован в буфер.", #packs)
|
||
|
|
or string.format("Loaded %d command packs. Full list is on the clipboard.", #packs)
|
||
|
|
local sapi = say:gsub("'", "''")
|
||
|
|
local ps = string.format(
|
||
|
|
[[Add-Type -AssemblyName System.Speech; $s = New-Object System.Speech.Synthesis.SpeechSynthesizer; foreach ($v in $s.GetInstalledVoices()) { if ($v.VoiceInfo.Culture.TwoLetterISOLanguageName -eq 'ru') { try { $s.SelectVoice($v.VoiceInfo.Name); break } catch {} } } $s.Speak('%s')]],
|
||
|
|
sapi
|
||
|
|
)
|
||
|
|
jarvis.system.exec(string.format('powershell -NoProfile -Command "%s"', ps:gsub('"', '\\"')))
|
||
|
|
|
||
|
|
jarvis.audio.play_ok()
|
||
|
|
return { chain = false }
|