diff --git a/.changeset/instruction-footer-output-last.md b/.changeset/instruction-footer-output-last.md new file mode 100644 index 00000000..a081494e --- /dev/null +++ b/.changeset/instruction-footer-output-last.md @@ -0,0 +1,5 @@ +--- +"@clack/prompts": patch +--- + +Restore the `formatInstructionFooter(instructions, hasGuide)` signature from 1.8. The `output` stream added in 1.9.0 is now an optional third argument instead of the first, so existing two-argument calls work again. diff --git a/packages/prompts/src/common.ts b/packages/prompts/src/common.ts index 730c448d..e5f791fd 100644 --- a/packages/prompts/src/common.ts +++ b/packages/prompts/src/common.ts @@ -79,9 +79,9 @@ export interface CommonOptions { } export function formatInstructionFooter( - output: Writable | undefined, instructions: string[], - hasGuide: boolean + hasGuide: boolean, + output?: Writable ): string[] { const guidePrefix = hasGuide ? `${styleText('cyan', S_BAR)} ` : ''; const footerLines = wrapTextWithPrefix(output, instructions.join(' • '), guidePrefix).split('\n'); diff --git a/packages/prompts/src/group-multi-select.ts b/packages/prompts/src/group-multi-select.ts index e53bc97f..2e5cbeb5 100644 --- a/packages/prompts/src/group-multi-select.ts +++ b/packages/prompts/src/group-multi-select.ts @@ -297,7 +297,7 @@ export const groupMultiselect = (opts: GroupMultiSelectOptions) => const guidePrefix = hasGuide ? `${styleText('cyan', S_BAR)} ` : ''; const titleLineCount = title.split('\n').length; const footerLines = showInstructions - ? formatInstructionFooter(opts.output, MULTISELECT_INSTRUCTIONS, hasGuide) + ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, hasGuide, opts.output) : hasGuide ? [styleText('cyan', S_BAR_END)] : []; diff --git a/packages/prompts/src/multi-select.ts b/packages/prompts/src/multi-select.ts index b20209af..68d73c31 100644 --- a/packages/prompts/src/multi-select.ts +++ b/packages/prompts/src/multi-select.ts @@ -187,7 +187,7 @@ export const multiselect = (opts: MultiSelectOptions) => { const prefix = hasGuide ? `${styleText('cyan', S_BAR)} ` : ''; const titleLineCount = title.split('\n').length; const footerLines = showInstructions - ? formatInstructionFooter(opts.output, MULTISELECT_INSTRUCTIONS, hasGuide) + ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, hasGuide, opts.output) : hasGuide ? [styleText('cyan', S_BAR_END)] : []; diff --git a/packages/prompts/src/select.ts b/packages/prompts/src/select.ts index 804e5817..e4a012d5 100644 --- a/packages/prompts/src/select.ts +++ b/packages/prompts/src/select.ts @@ -164,7 +164,7 @@ export const select = (opts: SelectOptions) => { const prefix = hasGuide ? `${styleText('cyan', S_BAR)} ` : ''; const titleLineCount = title.split('\n').length; const footerLines = showInstructions - ? formatInstructionFooter(opts.output, SELECT_INSTRUCTIONS, hasGuide) + ? formatInstructionFooter(SELECT_INSTRUCTIONS, hasGuide, opts.output) : hasGuide ? [styleText('cyan', S_BAR_END)] : [];