As noted in #10, this PR adds support for additional task output. This is done by passing an instance of the new ConsoleTaskOutput class to the task closure. This class offers some of the output methods the Symfony\Component\Console\Output\OutputInterface also offers. All additional output is prefixed with an indentation string, which is customizable through a setter method.
When tasks are run in a console supporting decorated output, the task line containing the loading... string will be replaced using escape sequences (similar to what we had so far). To achieve this, the cursor location will be saved, then the cursor will be moved the number of additionally written lines up and the line will be erased. After rewriting the line with the final status, the cursor location will be restored. This will also work with #11 together nicely.
A quick demo showcasing the example of the readme:
In theory, this is completely backwards compatible. Nevertheless, I would appreciate if some people try this out before it gets merged.
As noted in #10, this PR adds support for additional task output. This is done by passing an instance of the new
ConsoleTaskOutput
class to the task closure. This class offers some of the output methods theSymfony\Component\Console\Output\OutputInterface
also offers. All additional output is prefixed with an indentation string, which is customizable through a setter method.When tasks are run in a console supporting decorated output, the task line containing the
loading...
string will be replaced using escape sequences (similar to what we had so far). To achieve this, the cursor location will be saved, then the cursor will be moved the number of additionally written lines up and the line will be erased. After rewriting the line with the final status, the cursor location will be restored. This will also work with #11 together nicely.A quick demo showcasing the example of the readme:![render1568053088097](https://user-images.githubusercontent.com/8877609/64556106-0f069200-d33f-11e9-94a3-b4d60d04156d.gif)
In theory, this is completely backwards compatible. Nevertheless, I would appreciate if some people try this out before it gets merged.