Files
openclaw/src/cli/help-format.ts
Peter Steinberger de1dfab03e refactor: move terminal core into package (#88279)
* refactor: move terminal core into package

* refactor: move terminal module files

* fix: clean terminal package CI followups

* test: update lint suppression allowlist

* fix: ship terminal core runtime aliases
2026-05-30 11:07:45 +02:00

20 lines
788 B
TypeScript

import { theme } from "../../packages/terminal-core/src/theme.js";
export 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}`)}`;
}
export function formatHelpExamples(examples: ReadonlyArray<HelpExample>, inline = false): string {
const formatter = inline ? formatHelpExampleLine : formatHelpExample;
return examples.map(([command, description]) => formatter(command, description)).join("\n");
}