Skip to main content
Version: v0.0.4

Function: extractPhiPosture()

extractPhiPosture(argv): object

Resolve the global --unsafe-show-values flag out of an argument vector, order-independently (it may appear before or after the subcommand), and return the posture plus the argv with every occurrence of the flag removed, so each command's own parseArgs never sees it and cannot reject it as unknown. This is the one place the flag is recognised.

Parameters

argv

readonly string[]

The raw arguments (after the program name).

Returns

object

The resolved PhiPosture and the flag-stripped argv.

argv

argv: string[]

posture

posture: PhiPosture

Example

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

extractPhiPosture(["parse", "x.hl7"]).posture.showValues; // => false
extractPhiPosture(["--unsafe-show-values", "parse", "x.hl7"]).posture.showValues; // => true
extractPhiPosture(["parse", "x.hl7", "--unsafe-show-values"]).argv; // => ["parse", "x.hl7"]