script
Last updated
Last updated
Scripts are the entry-point to nr
; they are what the user will reference from the command line to run a group of commands, tasks, or other scripts.
To create a script, use the function at the script
property of the context object passed to your configuration function:
script
This function accepts the following parameters:
name: string
Human friendly name for the script. This will be used for error-reporting and can be used to reference the script in other scripts.
options:
Configuration object for the script. Its properties are detailed below.
group?: string
...
description?: string
...
...
Default: false
...
name
string
Name of the command.
args
Executable and arguments.
options?
Optional configuration.
Value that may be provided to script
to run the command.
[executable]
of type [string]
[executable, positionals]
of type [string, Array<string>]
[executable, flags]
of type [string, Record<string, any>]
[executable, positionals, flags]
of type [string, Array<string>, Record<string, any>]
This function accepts a name, an array indicating the executable and its arguments, , and an optional options object, . It will register the command using the provided name
and return a value. To reference a command in a script, use either the return value from command
directly or a string in the format cmd:name
. Commands are executed using .
may take one of four forms: