mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-25 04:02:37 +01:00
Capabilities: improve output of listings
This commit is contained in:
parent
e79d8bf710
commit
bd252c5201
@ -153,8 +153,8 @@ sub list {
|
|||||||
return "No such capability $capability." if defined $capability and not exists $self->{caps}->{hash}->{$capability};
|
return "No such capability $capability." if defined $capability and not exists $self->{caps}->{hash}->{$capability};
|
||||||
|
|
||||||
my @caps;
|
my @caps;
|
||||||
my @cap_group;
|
my @groups;
|
||||||
my @cap_standalone;
|
my @standalones;
|
||||||
my $result;
|
my $result;
|
||||||
|
|
||||||
if (not defined $capability) {
|
if (not defined $capability) {
|
||||||
@ -172,12 +172,12 @@ sub list {
|
|||||||
next if $cap eq '_name';
|
next if $cap eq '_name';
|
||||||
my $count = keys(%{$self->{caps}->{hash}->{$cap}}) - 1;
|
my $count = keys(%{$self->{caps}->{hash}->{$cap}}) - 1;
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
push @cap_group, "$cap [$count]" if $count;
|
push @groups, "$cap ($count cap" . ($count == 1 ? '' : 's') . ")" if $count;
|
||||||
} else {
|
} else {
|
||||||
push @cap_standalone, $cap;
|
push @standalones, $cap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$result .= join ', ', @cap_group, @cap_standalone;
|
$result .= join ', ', @groups, @standalones;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ sub capcmd {
|
|||||||
next if not $self->exists($key);
|
next if not $self->exists($key);
|
||||||
my $count = keys (%{$self->{caps}->{hash}->{$key}}) - 1;
|
my $count = keys (%{$self->{caps}->{hash}->{$key}}) - 1;
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
push @groups, "$key [$count]";
|
push @groups, "$key ($count cap" . ($count == 1 ? '' : 's') . ")";
|
||||||
} else {
|
} else {
|
||||||
push @single, $key;
|
push @single, $key;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user