From 32a38f82fff9cf1098f68a2b9ada9f9e0f98fdd6 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 27 Mar 2010 21:15:42 +0100 Subject: [PATCH] mop: mo-score has gained a --table option for nice textual tables --- mop/eval/mo-score.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/mop/eval/mo-score.sh b/mop/eval/mo-score.sh index 9ed73f4..9d0a200 100755 --- a/mop/eval/mo-score.sh +++ b/mop/eval/mo-score.sh @@ -8,7 +8,8 @@ $tex = 0; $extras = 0; $alt = 0; $merged = 0; -$usage = "Usage: mo-score [--detail] [--alt] [--extras] [--html] [--tex] [--merged] [/] ..."; +$table = 0; +$usage = "Usage: mo-score [--detail] [--alt] [--extras] [--html] [--tex] [--table] [--merged] [/] ..."; while (($arg = $ARGV[0]) =~ /^--([a-z]+)$/) { shift @ARGV; $var = "\$$1"; @@ -17,6 +18,12 @@ while (($arg = $ARGV[0]) =~ /^--([a-z]+)$/) { } @ARGV || die $usage; +$print_key = 1; +if ($table) { + open STDOUT, "|column -t -s'\t'" or die; + $print_key = 0; +} + print STDERR "Scanning contestants... "; open (CT, "bin/mo-get-users --full |") || die "Cannot get list of contestants"; while () { @@ -219,11 +226,12 @@ if ($debug) { print "\\error{TeX output not supported yet!}\n"; } else { foreach $r (@table) { print join("\t",@$r), "\n"; } - print "\n"; - foreach $r (sort keys %error_codes) { print "$r: $error_codes{$r}\n"; } + if ($print_key) { + print "\n"; + foreach $r (sort keys %error_codes) { print "$r: $error_codes{$r}\n"; } + } } - sub printHtmlRow { print "", join('',map { if ($hdr) { $_ = "$_"; } @@ -231,7 +239,6 @@ sub printHtmlRow { } @_), "\n"; } - sub printHtmlHeader { my ($perm) = @_; -- 2.39.2