diff --git a/cmd/docgen/docgen.go b/cmd/docgen/docgen.go index 86a622a..bf8fd1b 100644 --- a/cmd/docgen/docgen.go +++ b/cmd/docgen/docgen.go @@ -488,7 +488,11 @@ func main() { } mdTable.SetContent(i - diff, 0, fmt.Sprintf(`%s`, dps.FuncName, dps.FuncSig)) - mdTable.SetContent(i - diff, 1, dps.Doc[0]) + if len(dps.Doc) == 0 { + fmt.Printf("WARNING! Function %s on module %s has no documentation!\n", dps.FuncName, modname) + } else { + mdTable.SetContent(i - diff, 1, dps.Doc[0]) + } } f.WriteString(mdTable.String()) f.WriteString("\n") diff --git a/docs/api/commander.md b/docs/api/commander.md index 03ece54..c26445a 100644 --- a/docs/api/commander.md +++ b/docs/api/commander.md @@ -26,8 +26,11 @@ In this example, a command with the name of `hello` is created that will print `Hello world!` to output. One question you may have is: What is the `sinks` parameter? -The `sinks` parameter is a table with 3 keys: `in`, `out`, -and `err`. All of them are a Sink. +The `sinks` parameter is a table with 3 keys: `input`, `out`, and `err`. +There is an `in` alias to `input`, but it requires using the string accessor syntax (`sinks['in']`) +as `in` is also a Lua keyword, so `input` is preferred for use. +All of them are a Sink. +In the future, `sinks.in` will be removed. - `in` is the standard input. You may use the read functions on this sink to get input from the user. diff --git a/docs/api/fs.md b/docs/api/fs.md index bc14055..7b733ef 100644 --- a/docs/api/fs.md +++ b/docs/api/fs.md @@ -23,6 +23,7 @@ library offers more functions and will work on any operating system Hilbish does |glob(pattern) -> matches (table)|Match all files based on the provided `pattern`.| |join(...path) -> string|Takes any list of paths and joins them based on the operating system's path separator.| |mkdir(name, recursive)|Creates a new directory with the provided `name`.| +|fpipe() -> File, File|Returns a pair of connected files, also known as a pipe.| |readdir(path) -> table[string]|Returns a list of all files and directories in the provided path.| |stat(path) -> {}|Returns the information about a given `path`.| @@ -183,6 +184,22 @@ fs.mkdir('./foo/bar', true) ``` +
+
+

+fs.fpipe() -> File, File + + + +

+ +Returns a pair of connected files, also known as a pipe. +The type returned is a Lua file, same as returned from `io` functions. + +#### Parameters +This function has no parameters. +
+

diff --git a/docs/api/hilbish/_index.md b/docs/api/hilbish/_index.md index b79dcde..1407e69 100644 --- a/docs/api/hilbish/_index.md +++ b/docs/api/hilbish/_index.md @@ -28,7 +28,7 @@ interfaces and functions which directly relate to shell functionality. |prependPath(dir)|Prepends `dir` to $PATH.| |prompt(str, typ)|Changes the shell prompt to the provided string.| |read(prompt) -> input (string)|Read input from the user, using Hilbish's line editor/input reader.| -|run(cmd, returnOut) -> exitCode (number), stdout (string), stderr (string)|Runs `cmd` in Hilbish's shell script interpreter.| +|run(cmd, streams) -> exitCode (number), stdout (string), stderr (string)|Runs `cmd` in Hilbish's shell script interpreter.| |runnerMode(mode)|Sets the execution/runner mode for interactive Hilbish.| |timeout(cb, time) -> @Timer|Executed the `cb` function after a period of `time`.| |which(name) -> string|Checks if `name` is a valid command.| @@ -413,20 +413,25 @@ Text to print before input, can be empty.

-hilbish.run(cmd, returnOut) -> exitCode (number), stdout (string), stderr (string) +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. +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. #### Parameters `string` **`cmd`** -`boolean` **`returnOut`** -If this is true, the function will return the standard output and error of the command instead of printing it. +`table|boolean` **`streams`** +
diff --git a/emmyLuaDocs/fs.lua b/emmyLuaDocs/fs.lua index 89a418b..ef80eba 100644 --- a/emmyLuaDocs/fs.lua +++ b/emmyLuaDocs/fs.lua @@ -34,6 +34,10 @@ function fs.join(...path) end --- function fs.mkdir(name, recursive) end +--- Returns a pair of connected files, also known as a pipe. +--- The type returned is a Lua file, same as returned from `io` functions. +function fs.fpipe() end + --- Returns a list of all files and directories in the provided path. function fs.readdir(path) end diff --git a/emmyLuaDocs/hilbish.lua b/emmyLuaDocs/hilbish.lua index 7cca355..d931918 100644 --- a/emmyLuaDocs/hilbish.lua +++ b/emmyLuaDocs/hilbish.lua @@ -132,7 +132,12 @@ function hilbish.prompt(str, typ) end function hilbish.read(prompt) end --- Runs `cmd` in Hilbish's shell script interpreter. -function hilbish.run(cmd, returnOut) end +--- 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. --- This determines whether Hilbish wll try to run input as Lua diff --git a/golibs/fs/fs.go b/golibs/fs/fs.go index 8ec0235..9e03325 100644 --- a/golibs/fs/fs.go +++ b/golibs/fs/fs.go @@ -228,6 +228,11 @@ func fmkdir(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { return c.Next(), err } +// fpipe() -> File, File +// Returns a pair of connected files, also known as a pipe. +// The type returned is a Lua file, same as returned from `io` functions. +// #returns File +// #returns File func fpipe(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { rf, wf, err := os.Pipe() if err != nil {