IF Commons GitHub

physical/bind

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

From a word of a command line to the store it points into (commons anyfs-cli 0004-anyfs-cli-surfaces FR-005): the word is parsed as a location (a plain path, a mount, an address), the store of its place is opened once for the run, a mount that is read-only is attenuated so that nothing can change it whatever the verb does, and the POSIX view of the store is made with the path inside it resolved lexically. Every way it can fail is a problem with its code and the exit it ends with: a word that is no place is a usage error, a store that cannot be opened is a problem of the computer.

import { bind } from "./bind.ts";
// const bound = await bind(host, "scratch:/notes"); bound.kind === "ok" && bound.value.inner; // "/notes"

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

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

Boundtypeno test imports it
type Bound = { /** The word as it was typed. */ readonly text: string; readonly location: Location; readonly sto… (490 characters)
type Bound = {
  /** The word as it was typed. */
  readonly text: string;
  readonly location: Location;
  readonly store: AnyStore;
  /** The POSIX view of the whole store. */
  readonly view: Posix;
  /** The path inside the store, absolute and resolved. */
  readonly inner: PosixPath;
  readonly readOnly: boolean;
  /** What the mount says of whom the store takes changes from and how it signs, where the word is a mount that says. */
  readonly trust: MountTrustInput | undefined;
};

A word of a command line, bound to the store it points into.

BindProblemtypeno test imports it
type BindProblem = { readonly code: ProblemCode; readonly message: string; readonly fault: "usage" | "environment" };

Why a word was not bound: the code, the sentence, and whether it is the command line's fault or the computer's.

bindfunctionno test imports it
function bind(host: Host, text: string): Promise<Result<Bound, BindProblem>>

Binds a word to the store it points into.

prefixOfBoundfunctionno test imports it
function prefixOfBound(b: Bound): Result<Prefix, string>

The prefix of the store that a bound directory is, for a transfer.

labelOffunctionno test imports it
function labelOf(b: Bound): string

The label of a bound word in a report: the word as typed.

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