summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-04-26 23:44:22 -0500
committerdoy <doy@tozt.net>2009-04-26 23:44:22 -0500
commit5575d6e66359f5231091a10c9f3169686ec23bd2 (patch)
treeefc6495355efeb96784372f72360c4f214d42fcd
parent7cb2144e55c04902021ffaca6fbd9bb80abf6b2b (diff)
downloadbot-games-5575d6e66359f5231091a10c9f3169686ec23bd2.tar.gz
bot-games-5575d6e66359f5231091a10c9f3169686ec23bd2.zip
make cmdlist return the list of command names, and turn the display logic into a formatter
-rw-r--r--lib/Bot/Games/Game.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Bot/Games/Game.pm b/lib/Bot/Games/Game.pm
index 7f68b71..8af0baf 100644
--- a/lib/Bot/Games/Game.pm
+++ b/lib/Bot/Games/Game.pm
@@ -76,8 +76,12 @@ command cmdlist => sub {
if $method->meta->can('does_role')
&& $method->meta->does_role('Bot::Games::Trait::Method::Command');
}
- return join ' ', sort map { '-' . $_ } @commands;
-}, needs_init => 0;
+ return @commands;
+}, needs_init => 0,
+ formatter => sub {
+ my $list = shift;
+ return join ' ', sort map { '-' . $_ } @$list
+ };
# XXX: this would be much nicer as an external module, but the only one that
# really does what i want (DateTime::Format::Human::Duration) has only had one