diff options
author | B. Watson <urchlay@slackware.uk> | 2023-05-30 05:00:04 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2023-05-30 05:00:04 -0400 |
commit | a95ed98278a52764449fa89c3ce30b7bec1d3df1 (patch) | |
tree | d14d12abd4eaf2610276434278ba6163ea0d4959 /sbolint | |
parent | 4c958b8a469d92c767efc4378f84787e49068c68 (diff) | |
download | sbo-maintainer-tools-a95ed98278a52764449fa89c3ce30b7bec1d3df1.tar.gz |
sbolint: add progress bar.
Diffstat (limited to 'sbolint')
-rwxr-xr-x | sbolint | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -318,6 +318,7 @@ $g_warncount = 0; $g_errcount = 0; $warncount = 0; $errcount = 0; +$progress_bar = 0; $tempdir = 0; @@ -374,6 +375,10 @@ if($stdin) { } if($recursive_git) { + if(-t STDOUT) { + die "$SELF: you don't want to use -a without redirecting. Example:\n $SELF -a > lint.log\n"; + } + @ARGV=(); my $pwd; @@ -392,7 +397,7 @@ if($recursive_git) { } warn "$SELF: linting " . scalar(@ARGV) . " builds from git repo at $pwd\n" unless $quiet; - $quiet = 1; + $quiet = $progress_bar = 1; } push @ARGV, "." unless @ARGV; @@ -401,6 +406,7 @@ push @ARGV, "." unless @ARGV; # the junkfile check is skipped. $in_git_repo = system("git rev-parse >/dev/null 2>/dev/null") == 0; +$argv_count = 0; for(@ARGV) { run_checks($_); $g_errcount += $errcount; @@ -413,6 +419,20 @@ for(@ARGV) { print "$SELF: $buildname: " . $red . "errors $errcount" . $color_off . ", " . $yellow . "warnings $warncount" . $color_off . "\n"; } } + + if($progress_bar) { + $argv_count++; + my $pct = ($argv_count / @ARGV) * 100; + printf STDERR " %d/%d, %2.1f%%\r", $argv_count, scalar @ARGV, $pct; + } +} + +if($progress_bar) { + chomp (my $now = `date +%s`); + my $elapsed = $now - $^T; + my $min = int($elapsed / 60); + my $sec = $elapsed % 60; + printf STDERR "\nElapsed time %d:%02d\n", $min, $sec; } # print total errs/warns only if >1 build checked |