Skip to content

Commit

Permalink
Add counter after logging
Browse files Browse the repository at this point in the history
  • Loading branch information
swelljoe committed Jul 29, 2017
1 parent da0e82c commit c1b995c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Virtualmin/Config/Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use Time::HiRes qw( sleep );

# Plugin base class, just runs stuff with spinner and status
use Virtualmin::Config;
use Term::ANSIColor 2.01 qw(:constants colorstrip);
use Term::ANSIColor 2.01 qw(:constants);
use Term::Spinner::Color;

# TODO I don't like this, but can't figure out how to put it into
Expand Down Expand Up @@ -55,12 +55,12 @@ sub spin {
my $self = shift;
my $name = $self->name();
my $message = shift // "Configuring " . $name;
$log->info($message);
$spinner = Term::Spinner::Color->new();
$message = "[" . YELLOW . $count . RESET . "/" . GREEN . $self->total() .
RESET . "] " . $message;
my $color_correction = length(YELLOW . RESET . GREEN . RESET);
$count++;
$log->info(colorstrip($message));
$spinner = Term::Spinner::Color->new();
$message = $message . " " x (79 - length($message) - $spinner->{'last_size'} + $color_correction);
print $message;
$spinner->auto_start();
Expand Down

0 comments on commit c1b995c

Please sign in to comment.