cli.ts

view source

Declarations
#

6 declarations

Cli
#

cli.ts view source

Cli

type { kind: "local"; name: string; id: PathId; } | { kind: "global"; name: string; id: PathId; }

import type {Cli} from '@fuzdev/gro/cli.js';

find_cli
#

cli.ts view source

(name: string, cwd?: string | URL, options?: SpawnOptions | undefined): Promise<Cli | null> import {find_cli} from '@fuzdev/gro/cli.js';

Searches the filesystem for the CLI name, first local to the cwd and then globally.

name

type string

cwd

type string | URL
default process.cwd()

options?

type SpawnOptions
optional

returns

Promise<Cli | null>

null if not found locally or globally

resolve_cli
#

cli.ts view source

(name_or_cli: string | Cli, args: string[] | undefined, cwd: string | URL | undefined, log?: Logger | undefined, options?: SpawnOptions | undefined): Promise<...> import {resolve_cli} from '@fuzdev/gro/cli.js';

name_or_cli

type string | Cli

args

type string[]
default []

cwd

type string | URL | undefined

log?

type Logger
optional

options?

type SpawnOptions
optional

returns

Promise<Cli | undefined>

spawn_cli
#

cli.ts view source

(name_or_cli: string | Cli, args?: string[], log?: Logger | undefined, options?: SpawnOptions | undefined): Promise<SpawnResult | undefined> import {spawn_cli} from '@fuzdev/gro/cli.js';

Spawns a CLI if available using fuz_util's spawn. If a string is provided for name_or_cli, it checks first local to the cwd and then globally.

name_or_cli

type string | Cli

args

type string[]
default []

log?

type Logger
optional

options?

type SpawnOptions
optional

returns

Promise<SpawnResult | undefined>

undefined if no CLI is found, or the spawn result

spawn_cli_process
#

cli.ts view source

(name_or_cli: string | Cli, args?: string[], log?: Logger | undefined, options?: SpawnOptions | undefined): Promise<SpawnedProcess | undefined> import {spawn_cli_process} from '@fuzdev/gro/cli.js';

Spawns a CLI if available using fuz_util's spawn_process. If a string is provided for name_or_cli, it checks first local to the cwd and then globally.

name_or_cli

type string | Cli

args

type string[]
default []

log?

type Logger
optional

options?

type SpawnOptions
optional

returns

Promise<SpawnedProcess | undefined>

undefined if no CLI is found, or the spawn result

to_cli_name
#

cli.ts view source

(cli: string | Cli): string import {to_cli_name} from '@fuzdev/gro/cli.js';

cli

type string | Cli

returns

string

Depends on
#

Imported by
#