From 16911e904e9a60797d0a262da1fb1d87888fce5a Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Fri, 27 Jan 2023 21:32:08 -0500 Subject: [PATCH] Update typedefs & changelog --- CHANGELOG.md | 15 +++++++++++++++ luneDocs.json | 16 +++++++++++++++- luneTypes.d.luau | 29 +++++++++++++++++++++++++++-- 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1d4b13..345b58a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added + +- Added full documentation for all global APIs provided by Lune! This includes over 200 lines of pure documentation about behavior, error cases, and more for all of the current 35 global functions, parameters, return values, and more. Check out the [README](/README.md) to find out how to enable documentation in your editor. + +- Added a third argument `options` for `process.spawn`: + + - `cwd` - The current working directory for the process + - `env` - Extra environment variables to give to the process + - `shell` - Whether to run in a shell or not - set to `true` to run using the default shell, or a string to run using a specific shell + - `stdio` - How to treat output and error streams from the child process - set to "inherit" to pass output and error streams to the current process + +- Added `process.cwd`, the path to the current working directory in which the Lune script is running + ## `0.1.3` - January 25th, 2023 ### Added diff --git a/luneDocs.json b/luneDocs.json index ba44d9e..c2e4832 100644 --- a/luneDocs.json +++ b/luneDocs.json @@ -376,6 +376,13 @@ "params": [], "returns": [] }, + "@roblox/global/process.cwd": { + "code_sample": "", + "documentation": "The current working directory in which the Lune script is running.", + "learn_more_link": "", + "params": [], + "returns": [] + }, "@roblox/global/process.env": { "code_sample": "", "documentation": "Current environment variables for this process.\n\nSetting a value on this table will set the corresponding environment variable.", @@ -400,7 +407,7 @@ }, "@roblox/global/process.spawn": { "code_sample": "", - "documentation": "Spawns a child process that will run the program `program` with the given `params` as arguments, and returns a dictionary that describes the final status and ouput of the child process.", + "documentation": "Spawns a child process that will run the program `program`, and returns a dictionary that describes the final status and ouput of the child process.\n\nThe second argument, `params`, can be passed as a list of string parameters to give to the program.\n\nThe third argument, `options`, can be passed as a dictionary of options to give to the child process.\nThe available options inside of the `options` dictionary are:\n* `cwd` - The current working directory for the process\n* `env` - Extra environment variables to give to the process\n* `shell` - Whether to run in a shell or not - set to `true` to run using the default shell, or a string to run using a specific shell\n* `stdio` - How to treat output and error streams from the child process - set to \"inherit\" to pass output and error streams to the current process", "learn_more_link": "", "params": [ { @@ -410,6 +417,10 @@ { "documentation": "@roblox/global/process.spawn/param/1", "name": "params" + }, + { + "documentation": "@roblox/global/process.spawn/param/2", + "name": "options" } ], "returns": [ @@ -422,6 +433,9 @@ "@roblox/global/process.spawn/param/1": { "documentation": "Additional parameters to pass to the program" }, + "@roblox/global/process.spawn/param/2": { + "documentation": "A dictionary of options for the child process" + }, "@roblox/global/process.spawn/return/0": { "documentation": "A dictionary representing the result of the child process" }, diff --git a/luneTypes.d.luau b/luneTypes.d.luau index 002b072..44bc1dc 100644 --- a/luneTypes.d.luau +++ b/luneTypes.d.luau @@ -274,6 +274,12 @@ declare process: { --[=[ @within process + The current working directory in which the Lune script is running. + ]=] + cwd: string, + --[=[ + @within process + Current environment variables for this process. Setting a value on this table will set the corresponding environment variable. @@ -294,13 +300,32 @@ declare process: { --[=[ @within process - Spawns a child process that will run the program `program` with the given `params` as arguments, and returns a dictionary that describes the final status and ouput of the child process. + Spawns a child process that will run the program `program`, and returns a dictionary that describes the final status and ouput of the child process. + + The second argument, `params`, can be passed as a list of string parameters to give to the program. + + The third argument, `options`, can be passed as a dictionary of options to give to the child process. + The available options inside of the `options` dictionary are: + * `cwd` - The current working directory for the process + * `env` - Extra environment variables to give to the process + * `shell` - Whether to run in a shell or not - set to `true` to run using the default shell, or a string to run using a specific shell + * `stdio` - How to treat output and error streams from the child process - set to "inherit" to pass output and error streams to the current process @param program The program to spawn as a child process @param params Additional parameters to pass to the program + @param options A dictionary of options for the child process @return A dictionary representing the result of the child process ]=] - spawn: (program: string, params: { string }?) -> { + spawn: ( + program: string, + params: { string }?, + options: { + cwd: string?, + env: { [string]: string }?, + shell: boolean | string, + stdio: ("inherit" | "default")?, + }? + ) -> { ok: boolean, code: number, stdout: string,