IF Commons GitHub

physical/world

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0004-anyfs-cli-surfaces FR-003

The world of the process (commons anyfs-cli 0004-anyfs-cli-surfaces FR-003): the stores it opens through the openers of the program and of the configuration, one per place for a run; standard input and output as the bytes they are; a plain path as the root of its store and the path inside it; and a small state folder for the bases of two-way syncs and the ledgers of mirrors. A test makes the same world with its own streams and folder.

import { localPlace } from "./world.ts";
localPlace("/srv/fleet", "a/b", "linux"); // { root: "/", inner: "/srv/fleet/a/b" }

Source: commons/anyfs-cli/src/physical/world.ts

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

localPlacefunction
function localPlace(cwd: string, path: string, os: "darwin" | "linux" | "windows"): LocalPlace

Where a plain path points: the root of the store it is in (/, or a drive) and the path inside the store, with slashes.

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

WorldOptionstypeno test imports it
type WorldOptions = { readonly env: (name: string) => string | undefined; readonly cwd: string; readonly json: boo… (630 characters)
type WorldOptions = {
  readonly env: (name: string) => string | undefined;
  readonly cwd: string;
  readonly json: boolean;
  readonly config: Config;
  /** The folder of the state; the program's own folder (`$XDG_STATE_HOME/anyfs`) where left out. */
  readonly stateDir?: string;
  /** How the ssh program is run; the system's where left out. */
  readonly run?: RunLocal;
  readonly readStdin?: () => Promise<Uint8Array>;
  readonly writeStdout?: (bytes: Uint8Array) => void;
  /** Where a notice to the person goes (standard error by default). */
  readonly notice?: (text: string) => void;
  readonly stop?: AbortSignal;
};

What a world is made from.

stateDirOffunctionno test imports it
function stateDirOf(env: (name: string) => string | undefined): string

The state folder of the program for an environment.

systemWorldfunction
function systemWorld(o: WorldOptions): World

The world of this process.

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

processEnvFnfunctionno test imports it
function processEnvFn(): (name: string) => string | undefined

The process's environment as a function that treats an empty variable as not set.

processCwdconstno test imports it
const processCwd: () => string

The working folder of the process.

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