Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Feb 2018 01:44:31 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329784 - head/stand/lua
Message-ID:  <201802220144.w1M1iV2W048057@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802220144.w1M1iV2W048057>