mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 17:14:33 +00:00
refactor(cli): share styled select prompt helper
This commit is contained in:
12
src/terminal/prompt-select-styled.ts
Normal file
12
src/terminal/prompt-select-styled.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { select } from "@clack/prompts";
|
||||
import { stylePromptHint, stylePromptMessage } from "./prompt-style.js";
|
||||
|
||||
export function selectStyled<T>(params: Parameters<typeof select<T>>[0]) {
|
||||
return select({
|
||||
...params,
|
||||
message: stylePromptMessage(params.message),
|
||||
options: params.options.map((opt) =>
|
||||
opt.hint === undefined ? opt : { ...opt, hint: stylePromptHint(opt.hint) },
|
||||
),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user