IF Commons GitHub

surfaces/cli/host

Written to: 2 requirements: 2 proved, 0 partly, 0 failing, 0 with no test recorded. 0004-headless-cli FR-011, 0004-headless-cli FR-013

The one place the command line touches a process (commons headless 0004-headless-cli FR-011, FR-013): it binds Io to this process's environment, streams, clock, signals and files, and launch runs a program with it, making the check of its start first where it has one. Everything else in the surface is a function of the Io it is given.

import { launch } from "./host.ts";
// process.exitCode = await launch(program);

Source: commons/headless/src/surfaces/cli/host.ts

6 of 7 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

fsStorefunction
function fsStore(): StateStore

The files of the state, on this system's file system: each operation is best effort.

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

processSignalsconst
const processSignals: SignalPort

The process's signals.

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

processTimerconst
const processTimer: TimerPort

The timer of the process.

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

readStdinLinefunction
function readStdinLine(): Promise<string | undefined>

One line from standard input, without its line ending; undefined where the input ends first.

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

hostIofunction
function hostIo(options?: { readonly observer?: RunObserver | undefined; }): Io

The Io of this process; its output is written as it comes.

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

LaunchOptionstypeno test imports it
type LaunchOptions = { /** The arguments, after the program's name; the process's own by default. */ readonly argv?:… (563 characters)
type LaunchOptions = {
  /** The arguments, after the program's name; the process's own by default. */
  readonly argv?: readonly string[];
  /** Checks that the program can start (its configuration, a file it needs): a failure ends it with the status of its kind and writes one line. */
  readonly ready?: () => Promise<StartupFailure | undefined> | StartupFailure | undefined;
  readonly observer?: RunObserver;
  /** What of the process's world to replace (a sink for the output, a store of state): the rest is the process's. */
  readonly io?: Partial<Io>;
};

What a launch can be given.

launchfunction
function launch(program: Program, options?: LaunchOptions): Promise<number>

Runs the program in this process and gives its status; the caller sets process.exitCode to it.

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.