# paratext/terminal-link

> Every export of paratext/terminal-link, with its signature and doc comment: terminalLinkFor, terminalLink, plus 4 types.

Source: https://paratext.interlace.tools/docs/api/terminal-link

<!-- Generated by scripts/api-reference.ts from the built dist/*.d.ts. Do not edit; run `npx tsx scripts/api-reference.ts`. -->

```ts
import terminalLink from 'paratext/terminal-link';
import { terminalLinkFor } from 'paratext/terminal-link';
```

## Functions

### terminalLinkFor

`terminalLink` bound to a runtime you supply — the pure form, and what the export wraps.

```ts
function terminalLinkFor(runtime: Runtime): (text: string, url: string, { target, ...options }?: LinkOptions) => string;
```

| Parameter | Type |
| :-- | :-- |
| `runtime` | `Runtime` |

**Returns** `(text: string, url: string, { target, ...options }?: LinkOptions) => string`

## Constants

### default

The default export, declared as `terminalLink`.

```ts
const terminalLink: TerminalLink;
```

## Interfaces

### LinkOptions

```ts
interface LinkOptions {
    target?: Target;
    /**
     * What to print when the terminal is not believed to render OSC 8.
     *
     * `false` returns the text alone, a function is called with `(text, url)`, and anything
     * else — including absent — gives upstream's `text url`, a raw URL bounded by whitespace
     * because that is what terminal linkifiers detect reliably.
     */
    fallback?: boolean | ((text: string, url: string) => string);
}
```

### TerminalLink

`terminalLink(text, url, options?)` against the real process.

`isSupported` is a snapshot taken at import, which is upstream's shape exactly — it reads
`supportsHyperlinks.stdout` once at module scope. A caller who needs the live answer calls
the function and compares, or builds its own through {@link terminalLinkFor}.

```ts
interface TerminalLink {
    (text: string, url: string, options?: LinkOptions): string;
    isSupported: boolean;
    stderr: {
        (text: string, url: string, options?: Omit<LinkOptions, 'target'>): string;
        isSupported: boolean;
    };
}
```

## Types

### Options

Upstream's name for the options, so `import { type Options } from 'terminal-link'` migrates.

```ts
type Options = LinkOptions;
```

### Target

Which stream a call is bound for. Upstream's `target` option, spelled the same way.

```ts
type Target = 'stdout' | 'stderr';
```
