]> git.etc.gen.nz Git - mythtv-status.git/commitdiff
Use pod2usage for --help and to a show a hint if the wrong options are used.
authorAndrew Ruthven <andrew@etc.gen.nz>
Wed, 21 Nov 2007 07:15:56 +0000 (20:15 +1300)
committerAndrew Ruthven <andrew@cyclops.etc.gen.nz>
Wed, 21 Nov 2007 07:15:56 +0000 (20:15 +1300)
bin/mythtv-status

index 5f449b29cb4899e28a55a0409250ed1d0e4d6f40..beeca4991f5a2e3a7e886c5c1e5db9886e296f4d 100755 (executable)
@@ -15,6 +15,7 @@ use Getopt::Long;
 use Text::Wrap;
 use POSIX qw/strftime/;
 use MIME::Entity;
+use Pod::Usage;
 
 # Some sane defaults.
 my $host = "localhost";
@@ -25,6 +26,7 @@ my $colour = undef;
 my %display;
 my @email;
 my $email_only_on_conflict = 0;
+my $help = undef;
 
 my $VERSION = '0.5';
 
@@ -44,7 +46,11 @@ GetOptions(
   'schedule-conflicts!'   => \$display{'Schedule Conflicts'},
   'next-recording!'       => \$display{'Time till next recording'},
 
-);
+  'help|?' => \$help,
+) || pod2usage("\nUse --help for help.\n");
+
+pod2usage(verbose => 1)
+  if defined $help;
 
 die "Sorry, port isn't a number.\n"
   if $port !~ /^\d+$/;
@@ -420,7 +426,7 @@ any upcoming recordings and any which are happening right now.
 The intention is to warn you if there is a program being recorded or
 about to be recorded.
 
-=head1 COMMAND LINE OPTIONS
+=head1 OPTIONS
 
 =over
 
@@ -449,6 +455,10 @@ and/or B<--next-recording>.
 
 Only send an email out (if --email is present) if there is a schedule conflict.
 
+=item B<-?, --help>
+
+Display help.
+
 =item B<-h HOST, --host=HOST>
 
 The host to check, defaults to localhost.