mirror of
https://github.com/morluto/rea.git
synced 2026-11-29 01:46:39 +00:00
The flag selects row fields for csv and tsv output and was already named in command descriptions, but help omitted it. It is listed only where the entry accepts a delimited format. Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com> Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
60 lines
2.2 KiB
TypeScript
60 lines
2.2 KiB
TypeScript
import { expect, it } from "vitest";
|
|
import { z } from "zod";
|
|
|
|
import { formatCommandHelp } from "../../../src/cli/help.js";
|
|
|
|
it("renders type placeholders, shown defaults and aliases", () => {
|
|
const options = z.object({
|
|
limit: z.number().default(10).describe("Rows"),
|
|
mode: z.enum(["fast", "full"]).optional().describe("Mode"),
|
|
level: z
|
|
.union([z.literal("low"), z.literal("high")])
|
|
.optional()
|
|
.describe("Level"),
|
|
names: z.array(z.string()).default([]).describe("Names"),
|
|
dryRun: z.boolean().default(false).describe("Dry run"),
|
|
yes: z.boolean().optional().describe("Assume yes"),
|
|
raw: z.unknown().optional().describe("Raw"),
|
|
});
|
|
expect(
|
|
formatCommandHelp("rea sample", {
|
|
description: "Sample",
|
|
options,
|
|
alias: { yes: "y" },
|
|
hint: "Hint.",
|
|
globalOptions: { formats: ["toon", "json", "csv"] },
|
|
}),
|
|
).toBe(
|
|
[
|
|
"rea sample — Sample",
|
|
"",
|
|
"Usage: rea sample [options]",
|
|
"",
|
|
"Options:",
|
|
" --limit <number> Rows (default: 10)",
|
|
" --mode <fast|full> Mode",
|
|
" --level <low|high> Level",
|
|
" --names <array> Names",
|
|
" --dry-run Dry run",
|
|
" --yes, -y Assume yes",
|
|
" --raw <value> Raw",
|
|
"",
|
|
"Hint.",
|
|
"",
|
|
"Global Options:",
|
|
" --columns <fields> Comma-separated row fields for --format csv or tsv, in output order",
|
|
" --filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])",
|
|
" --format <toon|json|csv> Output format",
|
|
" --full-output Show full output envelope",
|
|
" --help Show help",
|
|
" --json Shorthand for --format json",
|
|
" --llms, --llms-full Print LLM-readable manifest",
|
|
" --no-retain Write no over-budget result to the retained-Evidence cache",
|
|
" --schema Show JSON Schema for command",
|
|
" --token-count Print token count of output (instead of output)",
|
|
" --token-limit <n> Limit output to n tokens",
|
|
" --token-offset <n> Skip first n tokens of output",
|
|
].join("\n"),
|
|
);
|
|
});
|