docs: baked a lot of API docs
This commit is contained in:
+30
-1
@@ -7,4 +7,33 @@ references:
|
||||
|
||||
The Shell API provides functions for running shell commands and interacting with processes.
|
||||
|
||||
${spacelua.renderApiDocumentation("shell")}
|
||||
<!--#lua spacelua.renderApiDocumentation("shell") -->
|
||||
## shell.run
|
||||
|
||||
`shell.run(command, arguments, stdin?)`
|
||||
|
||||
Runs a shell command on the server and returns its output.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
- `command` (`string`) — Executable name.
|
||||
- `arguments` (`table`) — Command arguments.
|
||||
- `stdin?` (`string`) — Text supplied on standard input.
|
||||
|
||||
**Returns:**
|
||||
|
||||
- `table` — stdout, stderr, and numeric exit code.
|
||||
|
||||
**Examples:**
|
||||
|
||||
```lua
|
||||
local result = shell.run("ls", {"-l"})
|
||||
print(result.stdout)
|
||||
```
|
||||
|
||||
```lua
|
||||
local result = shell.run("cat", {}, "hello")
|
||||
print(result.stdout)
|
||||
```
|
||||
<!--/lua-->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user