Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/instruction-footer-output-last.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions packages/prompts/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion packages/prompts/src/group-multi-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export const groupMultiselect = <Value>(opts: GroupMultiSelectOptions<Value>) =>
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)]
: [];
Expand Down
2 changes: 1 addition & 1 deletion packages/prompts/src/multi-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export const multiselect = <Value>(opts: MultiSelectOptions<Value>) => {
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)]
: [];
Expand Down
2 changes: 1 addition & 1 deletion packages/prompts/src/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export const select = <Value>(opts: SelectOptions<Value>) => {
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)]
: [];
Expand Down
Loading