SVN: toys/rsget.pl/RSGet/Line.pm

sparky sparky at pld-linux.org
Sun Dec 19 23:23:19 CET 2010


Author: sparky
Date: Sun Dec 19 23:23:19 2010
New Revision: 12005

Modified:
   toys/rsget.pl/RSGet/Line.pm
Log:
- progressbar in console, whoo !


Modified: toys/rsget.pl/RSGet/Line.pm
==============================================================================
--- toys/rsget.pl/RSGet/Line.pm	(original)
+++ toys/rsget.pl/RSGet/Line.pm	Sun Dec 19 23:23:19 2010
@@ -149,7 +149,16 @@
 		my $tl = length $line->[0] . $text;
 		substr $text, 4, $tl - $columns + 3, '...'
 			if $tl > $columns;
-		push @print, "\r\n\033[K" . color_term( $line->[3] ) . $line->[0] . $text . $endcolor;
+
+		my $thisline = color_term( $line->[3] ) . $line->[0] . $text . $endcolor;
+		if ( my $prog = $line->[2]->{prog} ) {
+			$thisline = $line->[0] . $text;
+			$thisline .= " " x ( $columns - length $thisline );
+			$prog =~ s/%//;
+			substr $thisline, $columns * $prog / 100, 0, "\033[0;32m";
+			$thisline = "\033[30;42m$thisline$endcolor";
+		}
+		push @print, "\r\n\033[K" . $thisline;
 	}
 
 	print @print;


More information about the pld-cvs-commit mailing list