lualoader: Pull argument extraction for cli functions into cli.arguments

This will be the translation layer for varargs -> cmd_name, argv for cli
commands. We reserve the right to break exactly what the varargs inclulde,
but this gives us a stable way to pull the arguments out of varargs.
This commit is contained in:
Kyle Evans 2018-02-22 01:44:30 +00:00
parent 613b0d87da
commit eca5ca66d0

View File

@ -67,9 +67,7 @@ end
-- Globals
function boot(...)
local argv = {...}
local cmd_name = ""
cmd_name, argv = core.popFrontTable(argv)
local cmd_name, argv = cli.arguments(...)
local kernel, argstr = parse_boot_args(argv)
if kernel ~= nil then
loader.perform("unload")
@ -79,9 +77,7 @@ function boot(...)
end
function autoboot(...)
local argv = {...}
local cmd_name = ""
cmd_name, argv = core.popFrontTable(argv)
local cmd_name, argv = cli.arguments(...)
local argstr = parse_boot_args(argv, false)
core.autoboot(argstr)
end
@ -111,4 +107,13 @@ function cli_execute(...)
end
-- Module exports
function cli.arguments(...)
local argv = {...}
local cmd_name = ""
cmd_name, argv = core.popFrontTable(argv)
return cmd_name, argv
end
return cli