Permalink
Browse files

Added -h option and display usage when there's no args

  • Loading branch information...
miyagawa committed Sep 2, 2009
1 parent 92536c8 commit bcecf76547f6ba1c854f734c0157eb89d56991f8
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/App/CPAN/Fast.pm
View
@@ -17,6 +17,7 @@ sub opt_spec {
return (
[ "install|i", "install the module" ],
[ "list|l", "list the recent uploads" ],
+ [ "help|h", "displays usage info" ],
);
}
@@ -27,6 +28,8 @@ sub execute {
$self->search($args->[0]);
} elsif ($opt->{list}) {
$self->recent;
+ } elsif ($opt->{help} || !@$args) {
+ $self->usage;
} else {
$self->install($args);
}
@@ -44,6 +47,11 @@ sub search {
$self->display_results($res);
}
+sub usage {
+ require Pod::Usage;
+ Pod::Usage::pod2usage();
+}
+
sub install {
my($self, $dists) = @_;

0 comments on commit bcecf76

Please sign in to comment.