I'm creating a CLI using city and clack/prompts like so:
#!/usr/bin/env node
import { defineCommand, runMain } from "citty";
import { createCommand } from "./commands/create.js";
import { initCommand } from "./commands/init.js";
import { startCommand } from "./commands/start.js";
import { stopCommand } from "./commands/stop.js";
import { statusCommand } from "./commands/status.js";
import { syncCommand } from "./commands/sync.js";
const main = defineCommand({
meta: {
name: "kubeo-cli",
version: "0.1.0",
description: "Kubeo CLI",
},
subCommands: {
create: createCommand,
init: initCommand,
start: startCommand,
stop: stopCommand,
status: statusCommand,
sync: syncCommand,
},
});
runMain(main);
I have individual command, but also a master create which prompt to run the init and sync command.
How would I handle intro/outro and guides ?
Currently, the guide are broken, and I'm wondering if i'm doing something wrong or if I need to manage this manually.
The sub-commands are called like so:
const runInit = await p.confirm({
message: "Run init now?",
initialValue: true,
});
if (p.isCancel(runInit) || !runInit) {
p.outro(`Run \`cd ${name} && kubeo-cli init\` when you're ready.`);
return;
}
spawnSync("kubeo-cli", ["init"], { stdio: "inherit" });
p.outro("Done.");
I'm creating a CLI using city and clack/prompts like so:
I have individual command, but also a master
createwhich prompt to run theinitandsynccommand.How would I handle intro/outro and guides ?
Currently, the guide are broken, and I'm wondering if i'm doing something wrong or if I need to manage this manually.
The sub-commands are called like so: