mirror of https://github.com/Hilbis/Hilbish
docs: [ci] generate new docs
parent
a20123fc24
commit
478e3020b1
|
@ -420,7 +420,7 @@ hilbish.run(cmd, streams) -> exitCode (number), stdout (string), stderr (string)
|
|||
</h4>
|
||||
|
||||
Runs `cmd` in Hilbish's shell script interpreter.
|
||||
Specifies the output and input streams the command should use.
|
||||
The `streams` parameter specifies the output and input streams the command should use.
|
||||
For example, to write command output to a sink.
|
||||
As a table, the caller can directly specify the standard output, error, and input
|
||||
streams of the command with the table keys `out`, `err`, and `input` respectively.
|
||||
|
@ -433,6 +433,24 @@ As a boolean, it specifies whether the command should use standard output or ret
|
|||
`table|boolean` **`streams`**
|
||||
|
||||
|
||||
#### Example
|
||||
```lua
|
||||
|
||||
// This code is the same as `ls -l | wc -l`
|
||||
local fs = require 'fs'
|
||||
local pr, pw = fs.pipe()
|
||||
hilbish.run('ls -l', {
|
||||
stdout = pw,
|
||||
stderr = pw,
|
||||
})
|
||||
|
||||
pw:close()
|
||||
|
||||
hilbish.run('wc -l', {
|
||||
stdin = pr
|
||||
})
|
||||
|
||||
```
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
|
|
@ -132,11 +132,12 @@ function hilbish.prompt(str, typ) end
|
|||
function hilbish.read(prompt) end
|
||||
|
||||
--- Runs `cmd` in Hilbish's shell script interpreter.
|
||||
--- Specifies the output and input streams the command should use.
|
||||
--- The `streams` parameter specifies the output and input streams the command should use.
|
||||
--- For example, to write command output to a sink.
|
||||
--- As a table, the caller can directly specify the standard output, error, and input
|
||||
--- streams of the command with the table keys `out`, `err`, and `input` respectively.
|
||||
--- As a boolean, it specifies whether the command should use standard output or return its output streams.
|
||||
---
|
||||
function hilbish.run(cmd, streams) end
|
||||
|
||||
--- Sets the execution/runner mode for interactive Hilbish.
|
||||
|
|
Loading…
Reference in New Issue