svn commit: r329784 - head/stand/lua
Kyle Evans
kevans at FreeBSD.org
Thu Feb 22 01:44:31 UTC 2018
Author: kevans
Date: Thu Feb 22 01:44:30 2018
New Revision: 329784
URL: https://svnweb.freebsd.org/changeset/base/329784
Log:
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.
Modified:
head/stand/lua/cli.lua
Modified: head/stand/lua/cli.lua
==============================================================================
--- head/stand/lua/cli.lua Thu Feb 22 01:42:13 2018 (r329783)
+++ head/stand/lua/cli.lua Thu Feb 22 01:44:30 2018 (r329784)
@@ -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
@@ -109,6 +105,15 @@ function cli_execute(...)
loader.command(...)
end
+end
+
+-- Module exports
+
+function cli.arguments(...)
+ local argv = {...}
+ local cmd_name = ""
+ cmd_name, argv = core.popFrontTable(argv)
+ return cmd_name, argv
end
return cli
More information about the svn-src-all
mailing list