Skip to content

Commit

Permalink
better help messages
Browse files Browse the repository at this point in the history
added POD::Usage to print out short options accepted and added -help to print option arguments
  • Loading branch information
LorenzoTa authored and choroba committed Oct 3, 2017
1 parent 85dd621 commit dd36ae2
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions pm-cb-g
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,32 @@ use feature qw{ say };


use Getopt::Long qw( :config no_ignore_case );
use Pod::Usage;

my ($bg_color, $fg_color, $author_color, $private_color, $time_color,
$font_name, $char_size, $stack_size, $seen_color, $mce, $no_time);
$font_name, $char_size, $stack_size, $seen_color, $mce, $no_time, $help);

BEGIN {
($bg_color, $fg_color, $author_color, $private_color, $time_color,
$seen_color, $font_name, $char_size, $stack_size, $mce, $no_time)
= qw( white black blue magenta darkcyan darkgray Helvetica 12 15 0 0 );
$seen_color, $font_name, $char_size, $stack_size, $mce, $no_time, $help)
= qw( white black blue magenta darkcyan darkgray Helvetica 12 15 0 0 0);

die "Invalid arguments!\n" unless GetOptions(
GetOptions(
'a|author_color=s' => \$author_color,
'b|bg_color=s' => \$bg_color,
'c|char_size=i' => \$char_size,
'f|fg_color=s' => \$fg_color,
'F|font_name=s' => \$font_name,
'h|help' => \$help,
'm|mce' => \$mce,
'n|no_time' => \$no_time,
'p|private_color=s' => \$private_color,
's|stack_size=i' => \$stack_size,
'S|seen_color=s' => \$seen_color,
't|time_color=s' => \$time_color,
);
) or pod2usage(-verbose => 0, -exitval => 1);

pod2usage(-verbose => 1, -exitval => 0) if $help;
}


Expand Down Expand Up @@ -554,7 +558,7 @@ pm-cb-g - A GUI client to PerlMonks' Chatter Box
=head1 SYNOPSIS
pm-cb-g -a blue -b white -c 12 -f black -F Helvetica
-p magenta -s 15 -S darkgray -t darkcyan [ -m -n ]
-p magenta -s 15 -S darkgray -t darkcyan [ -h -m -n ]
=head1 OPTIONS
Expand Down Expand Up @@ -583,6 +587,10 @@ The foreground colour of the new messages.
The font for all the characters.
=item B<h|help>
Prints options and arguments.
=item B<m|mce>
Use L<MCE::Shared> and L<MCE::Hobo> instead of L<threads> and
Expand Down

0 comments on commit dd36ae2

Please sign in to comment.