Files
openclaw/src/cli/help-format.ts
Peter Steinberger e2ec8283c4 refactor(deadcode): trim mid-size src exports (#105888)
* refactor(deadcode): trim auto-reply and CLI exports

* refactor(deadcode): trim cron and task exports

* refactor(deadcode): trim fleet and process exports

* test(deadcode): exercise live task and process seams

* test(fleet): cover stream redaction through owner module

* refactor(security): trim dead internal exports

* refactor(secrets): trim dead internal exports

* refactor(deadcode): trim remaining src exports

* refactor(deadcode): remove test-only runtime exports

* refactor(deadcode): trim pairing test exports

* refactor(deadcode): reconcile refreshed baseline

* test(auto-reply): deduplicate queue state imports
2026-07-13 00:42:56 -07:00

23 lines
975 B
TypeScript

// Small help-text formatter shared by command registrations.
import { theme } from "../../packages/terminal-core/src/theme.js";
/** Command plus short description tuple used in help epilogues. */
type HelpExample = readonly [command: string, description: string];
function formatHelpExample(command: string, description: string): string {
return ` ${theme.command(command)}\n ${theme.muted(description)}`;
}
function formatHelpExampleLine(command: string, description: string): string {
if (!description) {
return ` ${theme.command(command)}`;
}
return ` ${theme.command(command)} ${theme.muted(`# ${description}`)}`;
}
/** Render help examples in stacked or inline comment style. */
export function formatHelpExamples(examples: ReadonlyArray<HelpExample>, inline = false): string {
const formatter = inline ? formatHelpExampleLine : formatHelpExample;
return examples.map(([command, description]) => formatter(command, description)).join("\n");
}