Skip to content

cli

Install the required plugin:

Terminal window
tynd add cli
import { cli } from "@tynd/plugin-cli/client";

Read the host process’s command-line arguments. Argv is captured once when the host boots and parsed lazily; the frontend additionally caches the parsed Promise so repeated cli.matches() calls don’t roundtrip through the IPC bridge.

  • cli.matches(): Promise<CliMatches> — parsed argv (positional args, flags, subcommand).
  • cli.raw(): Promise<string[]> — untouched argv snapshot, including argv[0] (the binary path).

CliMatches:

interface CliMatches {
args: string[];
flags: Record<string, string | boolean>;
subcommand: string | null;
raw: string[];
}