INNER CODE UNIT · TypeScript

getCommandPath

lmstudio-ai/lms · src/index.ts:88

function getCommandPath(command: CommandUnknownOpts): string {
  const segments: Array<string> = [];
  let current: CommandWithOptionalParent | null | undefined = command as CommandWithOptionalParent;
  // Walk up the tree to include the program name in usage
  while (current !== undefined && current !== null) {
    segments.push(current.name());
    const parentCommand = current.parent;
    if (parentCommand === undefined || parentCommand === null) {
      break;
    }
    current = parentCommand as CommandWithOptionalParent;
  }
  return segments.reverse().join(" ");
}

function dimOptionParameters(flags: string, helpMessageGap: number): string {
  const dimmedFlags = flags.replace(/(<[^>]+>|\[[^\]]+\])/g, match => chalk.dim(match));
  return `${" ".repeat(HELP_MESSAGE_PADDING_LEFT)}${dimmedFlags.padEnd(

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…