From 478e3020b11eaca6db9124eac45fc07dbcf00ad7 Mon Sep 17 00:00:00 2001 From: TorchedSammy Date: Sun, 28 Apr 2024 01:04:12 +0000 Subject: [PATCH] docs: [ci] generate new docs --- docs/api/hilbish/_index.md | 20 +++++++++++++++++++- emmyLuaDocs/hilbish.lua | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/api/hilbish/_index.md b/docs/api/hilbish/_index.md index 1407e69..5c7a0f0 100644 --- a/docs/api/hilbish/_index.md +++ b/docs/api/hilbish/_index.md @@ -420,7 +420,7 @@ hilbish.run(cmd, streams) -> exitCode (number), stdout (string), stderr (string) 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 +}) + +```
diff --git a/emmyLuaDocs/hilbish.lua b/emmyLuaDocs/hilbish.lua index d931918..b80a660 100644 --- a/emmyLuaDocs/hilbish.lua +++ b/emmyLuaDocs/hilbish.lua @@ -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.