IF Commons GitHub

sql/cli/workstation

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0047-arcactl-init FR-001

The workstation model of arcactl (commons data 0047-arcactl-init FR-001): where a person's files are, on Linux, macOS and Windows, for what arcactl init sets up: the files libpq and psql read (.pgpass, pg_service.conf, .psqlrc), the directories arcactl keeps its own settings, cache and state in, and the profile of each shell. It is a function of the platform and the environment, and touches no file, so that a test can say where a Windows user's files are on Linux. libpq's own variables win where it has them (PGPASSFILE, PGSERVICEFILE, PSQLRC).

Source: commons/data/sql/cli/workstation.ts

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

Hostinterface
interface Host

What a person's machine says of itself.

MemberTypeWhat it is
platformPlatform
envReadonly<Record<string, string | undefined>>

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

isPlatformconstno test imports it
const isPlatform: (s: string) => s is Platform

Whether a name is a platform.

Pathsinterface
interface Paths

Where a person's files are.

MemberTypeWhat it is
platformPlatform
homestring
configstringThe directory arcactl keeps its settings in, and where the psql file it owns is.
cachestring
statestring
pgpassstring
pgServiceFilestring
psqlrcstringThe psqlrc that psql reads.
arcaPsqlrcstringThe psql file arcactl owns, which the managed block of psqlrc includes.
instancesstringThe file of the instances arcactl knows.
profilesReadonly<Record<Shell, Profile>>

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

pathsOffunction
function pathsOf(host: Host): Result<Paths, string>

Where the files are.

ParameterWhat it is
hostthe platform and the environment

Returns: the paths, or why they cannot be known (no home directory)

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

Profileinterfaceno test imports it
interface Profile

The profile files of a shell: which are written, and whether all of them or the first that is there.

MemberTypeWhat it is
filesreadonly string[]
policy"all" | "first-existing"
profileTargetsfunction
function profileTargets(profile: Profile, exists: (file: string) => boolean): readonly string[]

The files of a profile that are to be written: all, or the first that exists (the first where none does).

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

Shelltype
type Shell = "bash" | "zsh" | "fish" | "pwsh" | "nu" | "sh";

The shells a profile can be made for.

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

shellOffunction
function shellOf(name: string | undefined): Shell | undefined

The shell a name says, where it is one: /usr/bin/zsh, pwsh.exe, powershell and nu included.

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

shellsconst
const shells: readonly Shell[]

The shells that a workstation setup writes a start-up snippet for.

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

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