Skip to main content

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

ParameterType
templatesTemplateStringsArray
...expressionsreadonly TemplateExpression[]

Returns

Promise<Result>

Defined in

functions/execa.ts:34


$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

ParameterType
templatesTemplateStringsArray
...expressionsreadonly TemplateExpression[]

Returns

string

Defined in

functions/execa.ts:59


$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

ParameterType
optionsOptions

Returns

ExecaScriptMethod<Options>

Defined in

functions/execa.ts:76


$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

ParameterType
templatesTemplateStringsArray
...expressionsreadonly TemplateExpression[]

Returns

Promise<Result>

Defined in

functions/execa.ts:87


$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

ParameterType
templatesTemplateStringsArray
...expressionsreadonly TemplateExpression[]

Returns

Result

Defined in

functions/execa.ts:102


$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

ParameterType
templatesTemplateStringsArray
...expressionsreadonly TemplateExpression[]

Returns

Result

Defined in

functions/execa.ts:126