Created better way of displaying progress
This commit is contained in:
parent
845035339f
commit
8224c23e92
|
@ -5,7 +5,6 @@
|
|||
|
||||
namespace Sikofitt\HathorBundle\Command;
|
||||
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
@ -55,8 +54,25 @@ class ScannerCommand extends BaseCommand
|
|||
->ignoreUnreadableDirs(true)
|
||||
->name($extensionRegex);
|
||||
$progress = new ProgressBar($output, $finder->count());
|
||||
$progress->setBarWidth(50);
|
||||
$progress->setFormat(" <fg=white;options=bold>%message%</>\n <fg=cyan>%current%</><fg=black;options=bold>/</><fg=cyan;options=bold>%max%</> <fg=cyan>[</>%bar%<fg=cyan>]</> %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%");
|
||||
$cols = shell_exec('tput cols');
|
||||
$progress->setBarWidth($cols - 2);
|
||||
$format = [
|
||||
'barCharacter' => '<fg=cyan;options=bold>#</>',
|
||||
'progressCharacter' => '<fg=cyan>#</>',
|
||||
'emptyBarCharacter' => '<fg=cyan>#</>',
|
||||
'message' => '<fg=white;options=bold>%message%</>',
|
||||
'current' => '<fg=cyan>%current%</>',
|
||||
'currentMaxSep' => '<fg=black;options=bold>/</>',
|
||||
'max' => '<fg=cyan;options=bold>%max%</>',
|
||||
'percent' => '%percent:3s%%',
|
||||
'elapsed' => '%elapsed:6s%',
|
||||
'estimated' => '%estimated:-6s%',
|
||||
'elapsedEstimatedSep' => '/',
|
||||
'memory' => '%memory:6s%',
|
||||
'bar' => '<fg=cyan>[</>%bar%<fg=cyan>]</>',
|
||||
];
|
||||
$format = (object)$format;
|
||||
$progress->setFormat("");
|
||||
$progress->clear();
|
||||
$progress->start();
|
||||
$getID3 = new ID3;
|
||||
|
@ -65,8 +81,6 @@ class ScannerCommand extends BaseCommand
|
|||
$progress->setEmptyBarCharacter('<fg=cyan>#</>');
|
||||
//$progress->setRedrawFrequency(100);
|
||||
|
||||
$cols = shell_exec('tput cols');
|
||||
|
||||
foreach ($finder as $file) {
|
||||
|
||||
$fileLength = mb_strlen($file->getFilename());
|
||||
|
|
|
@ -6,4 +6,5 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;
|
|||
|
||||
class SikofittHathorBundle extends Bundle
|
||||
{
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue