Main index | Section 8 | Options |
Before hooking into the functionality provided by cli.lua, it must be included with a statement such as the following:
local cli = require("cli")
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 -- their respective components. local _, argv = cli.arguments(...)
print("This is the foo command!") 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. loader.perform("foo") end
This function may be invoked by a user at the loader prompt by simply typing foo. Arguments may be passed to it as usual, space-delimited.
For autoboot, boot, and boot-conf, the core.lua(8) module will load all ELF modules as-needed before executing the equivalent built-in loader commands. All non-kernel arguments to these commands are passed in the same order to the loader command.
The reload-conf command will reload the configuration from disk. This is useful if you have manually changed currdev and would like to easily reload the configuration from the new device.
The enable-module, disable-module, and toggle-module commands manipulate the list of modules to be loaded along with the kernel. Modules blacklisted are considered disabled by toggle-module. These commands will override any such restriction as needed. The show-module-options command will dump the list of modules that loader has been made aware of and any applicable options using paged output.
The disable-device command sets the environment variable that disables the device argument.
cli.arguments(...) | |
Takes varargs passed on the stack from loader(8) to cli_execute, splits them out into two return values: the command name, traditionally argv[0], and the rest of argv. | |
CLI.LUA (8) | July 24, 2021 |
Main index | Section 8 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.