refactor(cli): share styled select prompt helper

This commit is contained in:
Peter Steinberger
2026-02-18 17:34:38 +00:00
parent 8b48e0c615
commit 005e1d5fd1
4 changed files with 68 additions and 22 deletions

View 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) },
),
});
}