1
0
mirror of https://github.com/kepler155c/opus synced 2024-11-05 00:16:16 +00:00
opus/sys/apps/cedit.lua

39 lines
778 B
Lua
Raw Normal View History

2019-03-22 05:40:29 +00:00
local Config = require('config')
2019-01-23 20:28:43 +00:00
local multishell = _ENV.multishell
local os = _G.os
local read = _G.read
local shell = _ENV.shell
local args = { ... }
if not args[1] then
error('Syntax: cedit <filename>')
end
2019-02-07 08:10:05 +00:00
if not _G.http.websocket then
error('Requires CC: Tweaked')
end
2019-01-23 20:28:43 +00:00
if not _G.cloud_catcher then
2019-03-22 05:40:29 +00:00
local key = Config.load('cloud').key
if not key then
print('Visit https://cloud-catcher.squiddev.cc')
print('Paste key: ')
key = read()
if #key == 0 then
return
end
2019-01-23 20:28:43 +00:00
end
2019-03-22 05:40:29 +00:00
2019-01-23 20:28:43 +00:00
-- open an unfocused tab
local id = shell.openTab('cloud ' .. key)
print('Connecting...')
while not _G.cloud_catcher do
os.sleep(.2)
end
multishell.setTitle(id, 'Cloud')
end
shell.run('cloud edit ' .. table.unpack({ ... }))