You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current this.ui.tasks() works perfectly for defined, sequential steps (scaffold -> install -> build). However, using it for dynamic lists (e.g., processing 50 files) is painful because:
We have to manually loop and chain .add().
It enforces sequential execution, which is a bottleneck for independent items.
The Proposal
I propose adding a new method (e.g., ui.batch or ui.parallel) specifically designed for processing arrays of data with concurrency.
This method would exist alongside the current ui.tasks(), so no breaking changes are needed for existing commands.
Proposed API
This new method would accept an array of task definitions (similar to listr2 structure) and an options object for concurrency/workers.
constfiles=['file1.png','file2.png','file3.png','file4.png']// New method: ui.batch(tasksArray, options)awaitthis.ui.batch(files.map(file=>({title: `Optimizing ${file}`,// The task logicrun: async()=>{awaitoptimize(file)}})),{concurrency: 5// Run 5 items in parallel})
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
The Problem
The current
this.ui.tasks()works perfectly for defined, sequential steps (scaffold -> install -> build). However, using it for dynamic lists (e.g., processing 50 files) is painful because:.add().The Proposal
I propose adding a new method (e.g.,
ui.batchorui.parallel) specifically designed for processing arrays of data with concurrency.This method would exist alongside the current
ui.tasks(), so no breaking changes are needed for existing commands.Proposed API
This new method would accept an array of task definitions (similar to
listr2structure) and an options object for concurrency/workers.Beta Was this translation helpful? Give feedback.
All reactions