IF Commons GitHub

anyfs

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

anyfs, the program (commons anyfs-cli 0004-anyfs-cli-surfaces FR-016): a command line on Headless over the stores of a configuration, or of the places a word names. Its words are parsed, a run proceeds, previews, asks or is refused as the facts of its verbs say, the output is drawn (or the one JSON document of --json), the problems come with the verdict and the one next: command on standard error, and the program explains its problem codes (anyfs explain <code>) and generates its help, completions and man page. The tier it holds is the one the variable ANYFS_TIER names: reader or writer, writer where it says nothing.

anyfs ls fleet:/machines
anyfs --config ci/anyfs.config.ts sync --dry-run ./fleet s3backup:/fleet

A run ends in Headless' statuses: 0 ok, 1 findings (a name that is not there, two files that differ, a plan with conflicts), 2 a command line that does not fit, 3 a computer that cannot do it (a store that does not open, a missing ssh program). help, explain, places and doctor run where there is no configuration, and say so.

import { main } from "./anyfs.ts";
const status = await main(["help"], { cwd: "/tmp", out: () => undefined, err: () => undefined });
status; // 0

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

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

mainfunction
function main(argv: readonly string[], deps?: MainDeps): Promise<number>

Runs anyfs with the words after its name; returns the exit status.

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

takeConfigOptionfunctionno test imports it
function takeConfigOption(argv: readonly string[]): { readonly argv: readonly string[]; readonly config: string | undefined; }

The words of the command line without --config FILE (or --config=FILE), and the file it named.

MainDepstypeno test imports it
type MainDeps = { readonly env?: Readonly<Record<string, string | undefined>>; readonly cwd?: string; /** Where th… (915 characters)
type MainDeps = {
  readonly env?: Readonly<Record<string, string | undefined>>;
  readonly cwd?: string;
  /** Where the report goes (standard output by default). */
  readonly out?: (text: string) => void;
  /** Where the problems and the verdict go (standard error by default). */
  readonly err?: (text: string) => void;
  readonly readStdin?: () => Promise<Uint8Array>;
  readonly writeStdout?: (bytes: Uint8Array) => void;
  /** The folder of the state; the program's own where it is left out. */
  readonly stateDir?: string;
  /** How the ssh program is run; the system's where it is left out. */
  readonly run?: RunLocal;
  /** Where a notice to the person goes, outside the report (the address and token of a server); standard error by default. */
  readonly notice?: (text: string) => void;
  /** Ends a verb that waits (`serve`) the way the person's interrupt does. */
  readonly stop?: AbortSignal;
};

What main is given besides the command line; each is read from this process where it is not.

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