Update typedefs & changelog

This commit is contained in:
Filip Tibell 2023-01-27 21:32:08 -05:00
parent e9d3fb21f0
commit 16911e904e
No known key found for this signature in database
3 changed files with 57 additions and 3 deletions

View file

@ -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/), 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). 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 ## `0.1.3` - January 25th, 2023
### Added ### Added

View file

@ -376,6 +376,13 @@
"params": [], "params": [],
"returns": [] "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": { "@roblox/global/process.env": {
"code_sample": "", "code_sample": "",
"documentation": "Current environment variables for this process.\n\nSetting a value on this table will set the corresponding environment variable.", "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": { "@roblox/global/process.spawn": {
"code_sample": "", "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": "", "learn_more_link": "",
"params": [ "params": [
{ {
@ -410,6 +417,10 @@
{ {
"documentation": "@roblox/global/process.spawn/param/1", "documentation": "@roblox/global/process.spawn/param/1",
"name": "params" "name": "params"
},
{
"documentation": "@roblox/global/process.spawn/param/2",
"name": "options"
} }
], ],
"returns": [ "returns": [
@ -422,6 +433,9 @@
"@roblox/global/process.spawn/param/1": { "@roblox/global/process.spawn/param/1": {
"documentation": "Additional parameters to pass to the program" "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": { "@roblox/global/process.spawn/return/0": {
"documentation": "A dictionary representing the result of the child process" "documentation": "A dictionary representing the result of the child process"
}, },

View file

@ -274,6 +274,12 @@ declare process: {
--[=[ --[=[
@within process @within process
The current working directory in which the Lune script is running.
]=]
cwd: string,
--[=[
@within process
Current environment variables for this process. Current environment variables for this process.
Setting a value on this table will set the corresponding environment variable. Setting a value on this table will set the corresponding environment variable.
@ -294,13 +300,32 @@ declare process: {
--[=[ --[=[
@within 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 program The program to spawn as a child process
@param params Additional parameters to pass to the program @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 @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, ok: boolean,
code: number, code: number,
stdout: string, stdout: string,