INNER CODE UNIT · TypeScript
formatCommandTerm
lmstudio-ai/lms · src/index.ts:60
function formatCommandTerm(command: CommandUnknownOpts, helpMessageGap: number): string {
const commandPath = getCommandPath(command);
const commandName = command.name();
const color = commandColorByPath.get(commandPath);
const paddedName = commandName.padEnd(commandName.length + helpMessageGap);
const coloredName = color === undefined ? paddedName : chalk.hex(color)(paddedName);
const boldName = chalk.bold(coloredName);
return `${" ".repeat(HELP_MESSAGE_PADDING_LEFT)}${boldName}`;
}
function addCommandsGroup(
title: string,
commands: Array<CommandUnknownOpts>,
colorHex?: string | null,
): void {
const commandColor = colorHex ?? undefined;
const groupTitle = chalk.bold(title);
program.commandsGroup(groupTitle);