Permalink
Browse files

Role::Stem for showing helps

  • Loading branch information...
1 parent e580346 commit 89b37d7183cd151a9cb7549401d0832c6e63be09 @shelling committed Jan 14, 2013
Showing with 24 additions and 0 deletions.
  1. +24 −0 lib/HTTP/Balancer/Role/Stem.pm
@@ -0,0 +1,24 @@
+package HTTP::Balancer::Role::Stem;
+use Modern::Perl;
+use Moose::Role;
+
+with qw( HTTP::Balancer::Role );
+
+around run => sub {
+ my $orig = shift;
+ my $self = shift;
+
+ $self->$orig(@_);
+
+ my $handler = $self->command_name;
+ say "usage: http-balancer $handler [subcommands]";
+
+ say "Available subcommands:";
+ for (@{ref($self)->leaves}) {
+ say " ", $_;
+ }
+};
+
+no Moose::Role;
+
+1;

0 comments on commit 89b37d7

Please sign in to comment.