diff options
author | 2015-03-13 13:27:37 +0530 | |
---|---|---|
committer | 2015-03-13 13:37:07 +0530 | |
commit | f30c4a2bf4b4c85a3dd91c43401f2477897d1e2c (patch) | |
tree | c860d2ff11e86df31d01c09ebbb5743559cceb11 | |
parent | perms: list available roles, plus several other changes... (diff) | |
download | gitolite-gentoo-f30c4a2bf4b4c85a3dd91c43401f2477897d1e2c.tar.gz gitolite-gentoo-f30c4a2bf4b4c85a3dd91c43401f2477897d1e2c.tar.bz2 gitolite-gentoo-f30c4a2bf4b4c85a3dd91c43401f2477897d1e2c.zip |
lineup the info display fields
-rwxr-xr-x | src/commands/info | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/commands/info b/src/commands/info index 08e9931..5079cfa 100755 --- a/src/commands/info +++ b/src/commands/info @@ -91,13 +91,16 @@ sub print_phy_repos { sub listem { my ( $repos, $lc, $ld, @aa ) = @_; - my $creator = ''; + my @list; + my $mlr = 0; # max length of reponame + my $mlc = 0; # ...and creator for my $repo (@$repos) { next unless $repo =~ /$patt/; - my $perm = ''; + my $creator = ''; + my $desc = ''; + my $perm = ''; $creator = creator($repo) if $lc; - my $desc; if ($ld) { # use config value first, else 'description' file as second choice my $k = 'gitweb.description'; @@ -120,15 +123,16 @@ sub listem { $out{repos}{$repo}{creator} = $creator if $lc; $out{repos}{$repo}{description} = $desc if $ld; $out{repos}{$repo}{perms} = _hash($perm); - - next; + } else { + $mlr = length($repo) if ( $lc or $ld ) and $mlr < length($repo); + $mlc = length($creator) if $lc and $ld and $mlc < length($creator); + push @list, [ $perm, $repo, $creator, $desc ]; } - - print "$perm\t$repo"; - print "\t$creator" if $lc; - print "\t$desc" if $ld; - print "\n"; } + return if $json; + + my $fmt = "%s\t%-${mlr}s\t%-${mlc}s\t%s\n"; + map { s/\t\t/\t/; s/\s*$/\n/; print } map { sprintf $fmt, @$_ } @list; } sub _hash { |