diff options
Diffstat (limited to 'stand/lua')
-rw-r--r-- | stand/lua/cli.lua | 22 | ||||
-rw-r--r-- | stand/lua/cli.lua.8 | 18 | ||||
-rw-r--r-- | stand/lua/core.lua | 2 |
3 files changed, 20 insertions, 22 deletions
diff --git a/stand/lua/cli.lua b/stand/lua/cli.lua index 6832da0a31a5..dda8c3da4c89 100644 --- a/stand/lua/cli.lua +++ b/stand/lua/cli.lua @@ -30,18 +30,6 @@ local core = require("core") local cli = {} -if not pager then - -- shim for the pager module that just doesn't do it. - -- XXX Remove after 12.2 goes EoL. - pager = { - open = function() end, - close = function() end, - output = function(str) - printc(str) - end, - } -end - -- Internal function -- Parses arguments to boot and returns two values: kernel_name, argstr -- Defaults to nil and "" respectively. @@ -247,9 +235,17 @@ cli["disable-device"] = function(...) return end + if #argv > 1 then + print("Too many arguments") + print("usage error: disable-device device") + return + end + d, u = string.match(argv[1], "(%w*%a)(%d+)") - if d ~= nil then + if d ~= nil and u ~= nil then loader.setenv("hint." .. d .. "." .. u .. ".disabled", "1") + else + print("Cannot parse " .. argv[1] .." into driver and unit number.") end end diff --git a/stand/lua/cli.lua.8 b/stand/lua/cli.lua.8 index aee1d3d53579..e47ecd3d23db 100644 --- a/stand/lua/cli.lua.8 +++ b/stand/lua/cli.lua.8 @@ -52,10 +52,11 @@ For instance: local cli = require("cli") cli.foo = function(...) - -- Expand args to command name and the rest of argv. These arguments - -- are pushed directly to the stack by loader, then handed off to - -- cli_execute. cli_execute then passes them on to the invoked - -- function, where they appear as varargs that must be peeled apart into + -- Expand args to command name and the rest of argv. + -- These arguments are pushed directly to the stack by + -- loader, then handed off to cli_execute. cli_execute + -- then passes them on to the invoked function, where + -- they appear as varargs that must be peeled apart into -- their respective components. local _, argv = cli.arguments(...) @@ -63,10 +64,11 @@ cli.foo = function(...) for k, v in ipairs(argv) do print("arg #" .. tostring(k) .. ": '" .. v .. "'") end - -- Perform a loader command directly. This will not get dispatched back - -- to Lua, so it is acceptable to have a function of the exact same name - -- in loader. Lua will have the first chance to handle any commands - -- executed at the loader prompt. + -- Perform a loader command directly. This will not get + -- dispatched back to Lua, so it is acceptable to have a + -- function of the exact same name in loader. Lua will + -- have the first chance to handle any commands executed + -- at the loader prompt. loader.perform("foo") end .Ed diff --git a/stand/lua/core.lua b/stand/lua/core.lua index f42be6fbebb7..ad417e5f97e5 100644 --- a/stand/lua/core.lua +++ b/stand/lua/core.lua @@ -413,7 +413,7 @@ end function core.isSingleUserBoot() local single_user = loader.getenv("boot_single") - return single_user ~= nil and single_user:lower() == "yes" + return single_user ~= nil and single_user:lower() ~= "no" end function core.isUEFIBoot() |