Skip to content

Commit

Permalink
feat: a to select all packages in interactive mode (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
azuradara authored Feb 8, 2024
1 parent 4eb3eb2 commit bc3bcdb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/commands/check/interactive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function promptInteractive(pkgs: PackageMeta[], options: CheckOptio
const Y = (v: string) => c.bold(c.green(v))
console.clear()
sr.push({ content: `${FIG_BLOCK} ${c.gray(`${Y('↑↓')} to select, ${Y('space')} to toggle, ${Y('→')} to change version`)}`, fixed: true })
sr.push({ content: `${FIG_BLOCK} ${c.gray(`${Y('enter')} to confirm, ${Y('esc')} to cancel`)}`, fixed: true })
sr.push({ content: `${FIG_BLOCK} ${c.gray(`${Y('enter')} to confirm, ${Y('esc')} to cancel, ${Y('a')} to select/unselect all`)}`, fixed: true })
sr.push({ content: '', fixed: true })

pkgs.forEach((pkg) => {
Expand All @@ -76,6 +76,8 @@ export async function promptInteractive(pkgs: PackageMeta[], options: CheckOptio
sr.render(index)
},
onKey(key) {
const allInteractiveChecked = deps.every(d => d.interactiveChecked)

switch (key.name) {
case 'escape':
process.exit()
Expand Down Expand Up @@ -104,6 +106,9 @@ export async function promptInteractive(pkgs: PackageMeta[], options: CheckOptio
case 'l':
renderer = createVersionSelectRender(deps[index])
return true
case 'a':
deps.forEach(d => d.interactiveChecked = !allInteractiveChecked)
return true
}
},
}
Expand Down

0 comments on commit bc3bcdb

Please sign in to comment.