From 30272132935e63a053d738365b4d00c1cd788a1d Mon Sep 17 00:00:00 2001 From: David Edler Date: Tue, 12 Nov 2024 16:36:54 +0100 Subject: [PATCH] Interactive page size and hint how to quit (#1476) --- src/lib/runLocal.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/runLocal.ts b/src/lib/runLocal.ts index 25b18b1f..c2b4aa44 100644 --- a/src/lib/runLocal.ts +++ b/src/lib/runLocal.ts @@ -106,13 +106,17 @@ const chooseUpgrades = async ( ] }) + const optionsPerPage = process.stdout.rows + ? Math.max(3, process.stdout.rows - INTERACTIVE_HINT.split('\n').length - 1 - groups.length * 2) + : 50 + const response = await prompts({ choices: [...choices, { title: ' ', heading: true }], hint: INTERACTIVE_HINT, instructions: false, message: 'Choose which packages to update', name: 'value', - optionsPerPage: 50, + optionsPerPage, type: 'multiselect', onState: (state: any) => { if (state.aborted) { @@ -131,13 +135,17 @@ const chooseUpgrades = async ( selected: true, })) + const optionsPerPage = process.stdout.rows + ? Math.max(3, process.stdout.rows - INTERACTIVE_HINT.split('\n').length - 1) + : 50 + const response = await prompts({ choices: [...choices, { title: ' ', heading: true }], hint: INTERACTIVE_HINT + '\n', instructions: false, message: 'Choose which packages to update', name: 'value', - optionsPerPage: 50, + optionsPerPage, type: 'multiselect', onState: (state: any) => { if (state.aborted) {