show a progress indicator while scanning #47

wants to merge 1 commit into

7 participants


I use Satis to scan 60+ repositories in one go. It's hard to tell how far I already got, so I hacked together this simple IO wrapper that prepend the current and total number of repositories. So the output looks like this:

Q:\satis\bin>php compile
Scanning packages
[ 8/61] Reading composer.json of webvariants/developer-utils (v5.1.1)
Writing web view

I don't really expect this to be merged, as I'm sure there are other usecases where my code terribly fucks up. But maybe it's an inspiration :-)

Composer member

Not a bad idea, but indeed the implementation is maybe a bit risky. Maybe you can give feedback after using it for a while ;)


Using a progress bar is more complex, as you cannot simply prepend a static string, but have to mix to "dynamic" functions (overwriting the current line + using a progress bar, which overwrites the current line itself).

I haven't tried it, but I imagine it to be much harder to wrap around the Composer code.

@till till commented on the diff May 25, 2013
@@ -134,7 +134,13 @@ private function selectPackages(Composer $composer, OutputInterface $output, $ve
// run over all packages and store matching ones
$output->writeln('<info>Scanning packages</info>');
- foreach ($composer->getRepositoryManager()->getRepositories() as $repository) {
+ $repositories = $composer->getRepositoryManager()->getRepositories();
+ $io = $this->getApplication()->getIO();
+ foreach ($repositories as $idx => $repository) {
+ $io->setPrefix(sprintf('[% 2d/% 2d] ', $idx+1, count($repositories)));
till added a line comment May 25, 2013

Small nitpick — but I would not count() in each iteration of the loop. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

I'd like to have this as well. Nicely done.

Composer member

Unfortunately this patch doesn't really work anymore as the handling of repositories has been changed since.

Composer member

Would love to have something like this in satis though, so if you want to update the PR, or somebody else wants to work on it?


A progress indicator indeed would be pretty nice :)

Composer member

Closing this due to lack of activity and conflicting state. Please do feel free to re-open and update this PR if said functionality is still desired. :-)

@alcohol alcohol closed this Feb 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment