Skip to content

Commit

Permalink
Dynamic page size in interactive mode
Browse files Browse the repository at this point in the history
Signed-off-by: David Edler <david.edler@canonical.com>
  • Loading branch information
edlerd committed Nov 12, 2024
1 parent 5b2aa84 commit 2cd88e4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/lib/runLocal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit 2cd88e4

Please # to comment.