Skip to main content
Version: v0.0.2

Function: fmtCommand()

fmtCommand(args, deps, posture?): Promise<RunResult>

Run the fmt command.

Parameters

args

string[]

The arguments after the fmt subcommand token.

deps

RunDeps

Injected input readers (RunDeps).

posture?

PhiPosture = VALUE_FREE

The resolved PhiPosture (governs only the opt-in unsafe excerpt on a parse-failure diagnostic).

Returns

Promise<RunResult>

A RunResult: the canonical re-serialization on stdout (exit 0), a value-free warning-count note on stderr unless --quiet; an unparseable input is a data error (65) with no partial emit, an unreadable file 66, a bad flag 2.

Throws

Never CliError; may propagate a truly unexpected error for the dispatcher to map.

Example

import { fmtCommand } from "@cosyte/cli";

const deps = {
readFile: async () => new TextEncoder().encode('{ "resourceType":"Patient" , "id":"x" }'),
readStdin: async () => new Uint8Array(),
};
(await fmtCommand(["patient.json"], deps)).exit; // => 0