composer/composer — pull request #3275 by dantleech (2014-09-14 10:51:46+00:00)
Title: [WIP] Progress Tracker

As discussed in https://github.com/composer/composer/issues/2809

This PR adds a `WorkTracker` set of classes which allow progress to be registered and subsequently evaluated by a work tracker formatter.

This is a WIP. Notably the output formatters need some work.

## Work Trackers

Work trackers have the methods `complete` and `ping` (to register a progression) in addition to factory methods for creating *nested* work trackers.

There are three work tracker classes. One is a contextual tracker, which is used to access the *current* tracker the other two are `BoundedWorktracker` for tracking progressions with a known number of steps and `UnboundedWorkTracker` for handling progressions of an undefined length.

Library classes that need to track their progress are always injected with the `ContextWorkTracker`.

## Output

The output is managed by a class implementing the `FormatterInterface`.

The output formatter that will be used is determined by the `--pretty` option.

Because the work trackers are nested it is possible to produce hierchical output.

````
$ ./bin/composer install --pretty=multi ⏎
[5/5] Installing dependencies (including require-dev)
[81/160] Getting rules for "70" jobs with "80" installed packages
[1/-] Add rules for package symfony/yaml
````