mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 11:31:23 +00:00
refactor(cli): share styled select prompt helper
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { cancel, confirm, isCancel, select } from "@clack/prompts";
|
||||
import { cancel, confirm, isCancel } from "@clack/prompts";
|
||||
import { formatCliCommand } from "../cli/command-format.js";
|
||||
import { isNixMode } from "../config/config.js";
|
||||
import { resolveGatewayService } from "../daemon/service.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import { stylePromptHint, stylePromptMessage, stylePromptTitle } from "../terminal/prompt-style.js";
|
||||
import { selectStyled } from "../terminal/prompt-select-styled.js";
|
||||
import { stylePromptMessage, stylePromptTitle } from "../terminal/prompt-style.js";
|
||||
import { resolveCleanupPlanFromDisk } from "./cleanup-plan.js";
|
||||
import { listAgentSessionDirs, removePath } from "./cleanup-utils.js";
|
||||
|
||||
@@ -16,15 +17,6 @@ export type ResetOptions = {
|
||||
dryRun?: boolean;
|
||||
};
|
||||
|
||||
const selectStyled = <T>(params: Parameters<typeof select<T>>[0]) =>
|
||||
select({
|
||||
...params,
|
||||
message: stylePromptMessage(params.message),
|
||||
options: params.options.map((opt) =>
|
||||
opt.hint === undefined ? opt : { ...opt, hint: stylePromptHint(opt.hint) },
|
||||
),
|
||||
});
|
||||
|
||||
async function stopGatewayIfRunning(runtime: RuntimeEnv) {
|
||||
if (isNixMode) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user