INNER CODE UNIT · TypeScript

nameWidth

akirarika/milkio · packages/cookbook/src/index.ts:83

    const nameWidth = Math.max(...visible.map((c) => c.commands[0].length));
    for (const c of visible) {
      console.log(`  ${c.commands[0].padEnd(nameWidth)}   (aliases: ${c.commands.join(", ")})`);
    }
    console.log("");
    console.log("Hidden commands (still callable):");
    const hidden = __router__.filter((c) => c.hidden === true);
    const hiddenWidth = Math.max(...hidden.map((c) => c.commands[0].length));
    for (const c of hidden) {
      console.log(`  ${c.commands[0].padEnd(hiddenWidth)}   (aliases: ${c.commands.join(", ")})`);
    }
    console.log("");
    console.log("Docs: https://github.com/akirarika/co");
    exit(0);
  }

  const packageJson = (await exists(join(cwd(), "package.json"))) ? JSON.parse(await readFile(join(cwd(), "package.json"), "utf-8")) : undefined;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…