consistent command line processing-usage
This commit is contained in:
@@ -12,22 +12,23 @@ local window = _G.window
|
||||
|
||||
local function syntax()
|
||||
printError('Syntax:')
|
||||
error('mwm sessionName [monitor]')
|
||||
error('mwm [--config=filename] [monitor]')
|
||||
end
|
||||
|
||||
local args = { ... }
|
||||
local args = Util.parse(...)
|
||||
local UID = 0
|
||||
local multishell = { }
|
||||
local processes = { }
|
||||
local parentTerm = term.current()
|
||||
local sessionFile = args[1] or 'usr/config/mwm'
|
||||
local sessionFile = args.config or 'usr/config/mwm'
|
||||
local monName = args[1]
|
||||
local running
|
||||
local parentMon
|
||||
|
||||
local defaultEnv = Util.shallowCopy(_ENV)
|
||||
defaultEnv.multishell = multishell
|
||||
if args[2] then
|
||||
parentMon = peripheral.wrap(args[2]) or syntax()
|
||||
if monName then
|
||||
parentMon = peripheral.wrap(monName) or syntax()
|
||||
else
|
||||
parentMon = peripheral.find('monitor') or syntax()
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
local Util = require('opus.util')
|
||||
|
||||
local device = _G.device
|
||||
local multishell = _ENV.multishell
|
||||
local os = _G.os
|
||||
@@ -6,9 +8,9 @@ local term = _G.term
|
||||
-- list this terminal in the devices list so it's available via
|
||||
-- peripheral sharing
|
||||
|
||||
local args = { ... }
|
||||
local name = args[1] or error('Syntax: termShare [device name] <title>')
|
||||
local title = args[2]
|
||||
local args = Util.parse(...)
|
||||
local name = args[1] or error('Syntax: termShare [--title=title] term_name')
|
||||
local title = args.title
|
||||
|
||||
device[name] = term.current()
|
||||
device[name].name = name
|
||||
|
||||
Reference in New Issue
Block a user