IF Commons GitHub

logical/outcomes

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-anyfs-cli-logical FR-010

How a verb ends (commons anyfs-cli 0003-anyfs-cli-logical FR-010): a run that did what was asked, a run that found something (a name that is not there, two files that differ), a command line that does not fit, and a computer that cannot do it are four endings with four exit names, and each problem has the code of the catalogue and the command that fixes it. Pure functions of their arguments.

import { finding, usage } from "./outcomes.ts";
usage("ls takes a place").exit; // "usage"
finding("E-FILESYSTEM", "ENOENT /a: no such name").problems[0]?.code; // "E-FILESYSTEM"

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

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

problemOffunctionno test imports it
function problemOf(code: ProblemCode, message: string, fix?: string | undefined): Problem

A problem of a code, with the message of the run and the fix of the catalogue unless one is given.

findingfunction
function finding(code: ProblemCode, message: string, fix?: string | undefined): Outcome

A run that found something, which is a result and not a failure of the program: exit findings.

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

usagefunction
function usage(message: string, fix?: string): Outcome

A run whose command line does not fit what the verb takes: exit usage.

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

environmentfunction
function environment(code: ProblemCode, message: string, fix?: string | undefined): Outcome

A run that cannot be made on this computer: exit environment.

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

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