functions/execa
These are functions having to do with running commands in a Bash-like TypeScript script.
These functions are based upon the $
function from "execa", but pass the stdout/stderr to the
console (which is the default behavior of a Bash script).
Functions
$()
function $(templates, ...expressions): Promise<Result>
A wrapper around the $
function from execa
.
- The stdout/stderr is passed through to the console.
- It throws nicer errors, omitting the JavaScript stack trace.
Parameters
Parameter | Type |
---|---|
templates | TemplateStringsArray |
...expressions | readonly TemplateExpression [] |
Returns
Promise
<Result
>
Defined in
$o()
function $o(templates, ...expressions): string
Helper function to run a command and grab the output. ("o" is short for "output".)
If an error occurs, the full JavaScript stack trace will be printed. Alternatively, if you expect this command to return a non-zero exit code, you can enclose this function in a try/catch block.
This is a wrapper around the $.sync
function from execa
. (The $.sync
function automatically
trims the stdout
.)
Parameters
Parameter | Type |
---|---|
templates | TemplateStringsArray |
...expressions | readonly TemplateExpression [] |
Returns
string
Defined in
$op()
function $op(options): ExecaScriptMethod<Options>
A wrapper around the $
function from execa
. ("op" is short for "options".) This allows you to
get a custom executor function without having to consume "execa" directly.
Parameters
Parameter | Type |
---|---|
options | Options |
Returns
ExecaScriptMethod
<Options
>
Defined in
$q()
function $q(templates, ...expressions): Promise<Result>
A wrapper around the $
function from execa
. ("q" is short for "quiet".) This is the same
thing as the $
helper function, except the stdout/stderr is not passed through to the console.
If an error occurs, the full JavaScript stack trace will be printed. Alternatively, if you expect this command to return a non-zero exit code, you can enclose this function in a try/catch block.
Parameters
Parameter | Type |
---|---|
templates | TemplateStringsArray |
...expressions | readonly TemplateExpression [] |
Returns
Promise
<Result
>
Defined in
$s()
function $s(templates, ...expressions): Result
A wrapper around the $.sync
function from execa
.
- The stdout/stderr is passed through to the console.
- It throws nicer errors, omitting the JavaScript stack trace.
Parameters
Parameter | Type |
---|---|
templates | TemplateStringsArray |
...expressions | readonly TemplateExpression [] |
Returns
Result
Defined in
$sq()
function $sq(templates, ...expressions): Result
A wrapper around the $.sync
function from execa
. ("sq" is short for "sync quiet".) This is
the same thing as the $s
helper function, except the stdout/stderr is not passed through to the
console.
If an error occurs, the full JavaScript stack trace will be printed. Alternatively, if you expect this command to return a non-zero exit code, you can enclose this function in a try/catch block.
Parameters
Parameter | Type |
---|---|
templates | TemplateStringsArray |
...expressions | readonly TemplateExpression [] |
Returns
Result