IF Commons GitHub

logical/argv

Written to: 4 requirements: 4 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-package-managers-logical FR-001, 0003-package-managers-logical FR-002, 0003-package-managers-logical FR-003, 0003-package-managers-logical FR-004

The command of an operation as an argument vector: the words of the ontology's template with the names put where they go (never through a shell), the exact version written as the manager writes it, the environment the manager needs as the env program, and the program that raises the rights put first only where the manager needs them. A name or a version that could be taken for an option is refused.

import { commandArgv } from "./argv.ts";
// commandArgv(spec, { packages: ["jq"], version: "1.7.1" }, { kind: "joined", joiner: "=" }, { elevate: [] })

Source: commons/package-managers/src/logical/argv.ts

3 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.

Subjecttypeno test imports it
type Subject = { readonly packages: readonly string[]; readonly version?: string | undefined };

What a command is made for: the packages (the version, where there is one, is the first's) and nothing else.

Shapetypeno test imports it
type Shape = { readonly elevate?: readonly string[]; readonly interactive?: boolean };

What changes the command made: the program that raises the rights (none by default) and whether the form that asks a person nothing is used (it is, by default).

Argvtypeno test imports it
type Argv = { readonly argv: readonly string[]; readonly admin: boolean; readonly verified: boolean };

A command ready to run.

commandArgvfunction
function commandArgv(spec: CommandSpec, subject: Subject, versioning: Versioning, shape?: Shape): Result<Argv, string>

The argument vector of a command for a subject, or why it cannot be made.

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

versionInfunction
function versionIn(text: string): string | undefined

The first version in the text a manager prints, without an epoch (1:2.43.0-1 is 2.43.0-1) and without a trailing dot, or nothing.

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

sameVersionfunction
function sameVersion(observed: string, wanted: string): boolean

Whether an installed version is the one asked for: the same, or the one asked for followed by a packager's revision (2.43.0 is 2.43.0-1ubuntu7).

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

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