Files
openclaw/src/cli/program/preaction.ts

20 lines
633 B
TypeScript
Raw Normal View History

2026-01-14 01:08:15 +00:00
import type { Command } from "commander";
import { emitCliBanner } from "../banner.js";
2026-01-16 01:33:20 +00:00
function setProcessTitleForCommand(actionCommand: Command) {
let current: Command = actionCommand;
while (current.parent && current.parent.parent) {
current = current.parent;
}
const name = current.name();
if (!name || name === "clawdbot") return;
process.title = `clawdbot-${name}`;
}
export function registerPreActionHooks(program: Command, programVersion: string) {
2026-01-14 01:08:15 +00:00
program.hook("preAction", async (_thisCommand, actionCommand) => {
2026-01-16 01:33:20 +00:00
setProcessTitleForCommand(actionCommand);
2026-01-14 01:08:15 +00:00
emitCliBanner(programVersion);
});
}