opus/apps/mirror.lua

25 lines
500 B
Lua
Raw Normal View History

2016-12-11 19:24:52 +00:00
require = requireInjector(getfenv(1))
local Terminal = require('terminal')
local args = { ... }
2017-04-09 00:06:31 +00:00
local mon = device[table.remove(args, 1) or 'monitor']
if not mon then
error('mirror: Invalid device')
2016-12-11 19:24:52 +00:00
end
2017-04-09 00:06:31 +00:00
mon.clear()
mon.setTextScale(.5)
mon.setCursorPos(1, 1)
2016-12-11 19:24:52 +00:00
2017-04-09 00:06:31 +00:00
local oterm = Terminal.copy(term.current())
Terminal.mirror(term.current(), mon)
2016-12-11 19:24:52 +00:00
term.current().getSize = mon.getSize
2016-12-11 19:24:52 +00:00
2017-04-09 00:06:31 +00:00
if #args > 0 then
shell.run(unpack(args))
Terminal.copy(oterm, term.current())
2016-12-11 19:24:52 +00:00
2017-04-09 00:06:31 +00:00
mon.setCursorBlink(false)
2016-12-11 19:24:52 +00:00
end