OctOS: Add `params` field to applications
Shows parameters for each command in help.master
parent
3c2fa52b4f
commit
c4bd091ae8
|
@ -1,11 +1,12 @@
|
||||||
# Applications with OctOS
|
# Applications with OctOS
|
||||||
OctOS has a simple framework to allow the player to easily create their own programs for their computers. All you have to do, is place a file in the `bin` directory to tell OctOS about your application, while the code is typically placed in `exec`.
|
OctOS has a simple framework to allow the player to easily create their own programs for their computers. All you have to do, is place a file in the `bin` directory to tell OctOS about your application, while the code is typically placed in `exec`.
|
||||||
|
|
||||||
Files in `bin` do not have to follow any naming convention and typically do not even have an extension. They are formatted as shown below, `name` and `exec` being the only required fields. If `name` is not defined, the file name will be used.
|
Files in `bin` do not have to follow any naming convention and typically do not even have an extension. They are formatted as shown below, `name` and `exec` being the only required fields. If `name` is not defined, the file name will be used. Parameters are shown just after the command name in help, and just before the description.
|
||||||
|
|
||||||
```
|
```
|
||||||
name = <name>
|
name = <name>
|
||||||
description = <description>
|
description = <description>
|
||||||
|
params = <parameters>
|
||||||
exec = <path to code (e.g. os/exec/help.lua)>
|
exec = <path to code (e.g. os/exec/help.lua)>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
name = echo
|
name = echo
|
||||||
description = Print text to the command line
|
description = Print text to the command line
|
||||||
|
params = [text]
|
||||||
exec = os/exec/echo.lua
|
exec = os/exec/echo.lua
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
name = help
|
name = help
|
||||||
description = Show help information
|
description = Show help information
|
||||||
|
params = [command / "all"]
|
||||||
exec = os/exec/help.lua
|
exec = os/exec/help.lua
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
name = lua
|
name = lua
|
||||||
description = Execute Lua code
|
description = Execute Lua code
|
||||||
|
params = [code]
|
||||||
exec = os/exec/lua.lua
|
exec = os/exec/lua.lua
|
||||||
|
|
|
@ -5,7 +5,12 @@ local bin = get_userdata("bin")
|
||||||
|
|
||||||
if params[1] == "all" then
|
if params[1] == "all" then
|
||||||
for name, info in pairs(bin) do
|
for name, info in pairs(bin) do
|
||||||
print(name..": "..info.description)
|
local params = ""
|
||||||
|
if info.params then
|
||||||
|
params = " "..info.params
|
||||||
|
end
|
||||||
|
|
||||||
|
print(name..params..": "..info.description)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print("Specify a command to get help for or use help all to view help for all commands.")
|
print("Specify a command to get help for or use help all to view help for all commands.")
|
||||||
|
|
|
@ -16,6 +16,7 @@ for _,f in ipairs(bin_contents.files) do
|
||||||
|
|
||||||
bin[name] = {
|
bin[name] = {
|
||||||
description = cmd_info.description or "",
|
description = cmd_info.description or "",
|
||||||
|
params = cmd_info.params or "",
|
||||||
exec = cmd_info.exec or "os/exec/nil"
|
exec = cmd_info.exec or "os/exec/nil"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue