Skip to content

Commit

Permalink
Added usage and version command line options.
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Oct 5, 2009
1 parent b141d8b commit 5a5dbf3
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion bin/perlanet
Expand Up @@ -4,16 +4,46 @@ use strict;
use warnings;

use Perlanet;
use Getopt::Std;
use File::Basename;

use vars qw{$VERSION};
BEGIN {
$VERSION = '0.01';
$VERSION = $Perlanet::VERSION;
}

my %opts;
getopts('hv', \%opts);

version() if $opts{v} || $opts{h};
help() if $opts{h};
exit if $opts{v} || $opts{h};

my $p = Perlanet->new(shift || './perlanetrc');

$p->run;

sub version {
my ($me) = fileparse $0;

print "\n$me, version $VERSION\n\n";
}

sub help {
my ($me) = fileparse $0;

print <<EOTEXT;
Usage: $me [-h] [-v] [config_file]
-h Display this help message
-v Display version information
config_file
Name of configuration file (defaults to perlanetrc)
EOTEXT
}

=head1 NAME
perlanet - command line interface to Perlanet.pm
Expand Down

0 comments on commit 5a5dbf3

Please sign in to comment.