[Rt-commit] r8414 - rtir/branches/2.3-EXPERIMENTAL/etc
ruz at bestpractical.com
ruz at bestpractical.com
Mon Aug 6 21:22:05 EDT 2007
Author: ruz
Date: Mon Aug 6 21:22:05 2007
New Revision: 8414
Modified:
rtir/branches/2.3-EXPERIMENTAL/etc/add_constituency
Log:
* make script verbose by default
* mkae help saner
Modified: rtir/branches/2.3-EXPERIMENTAL/etc/add_constituency
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/etc/add_constituency (original)
+++ rtir/branches/2.3-EXPERIMENTAL/etc/add_constituency Mon Aug 6 21:22:05 2007
@@ -6,12 +6,10 @@
=head1 SYNOPSIS
+ add_constituency --help
add_constituency --name <constituency> [options]
add_constituency --name EDUNET
- add_constituency --name EDUNET --verbose
- add_constituency --name EDUNET --corespond 'edunet at example.com' --verbose
-
-Run `perldoc add_constituency` to gte more info about the tool.
+ add_constituency --name EDUNET --corespond 'edunet at example.com' --quiet
=head1 OPTIONS
@@ -29,9 +27,9 @@
Set/update comment address.
-=item --verbose
+=item --quiet
-Enable verbose output.
+Disable output.
=back
@@ -57,19 +55,22 @@
my %opt;
sub debug(@) {
- return unless $opt{'verbose'};
+ return if $opt{'quiet'};
print @_;
print "\n" if $_[-1] && $_[-1] !~ /\n$/s;
};
use Getopt::Long;
-GetOptions( \%opt, "name=s", "correspond=s", "comment=s", "help", "verbose" );
+GetOptions( \%opt, "name=s", "correspond=s", "comment=s", "help", "quiet" );
if ( $opt{'help'} ) {
require Pod::Usage;
import Pod::Usage;
- pod2usage("RTIR Constituencies management tool\n");
- exit 1;
+ pod2usage(
+ -msg => "RTIR Constituencies management tool\n",
+ -verbose => 2,
+ -exitval => 0,
+ );
}
my $constituency = $opt{'name'};
@@ -79,8 +80,12 @@
$constituency =~ s/\s+$//;
$constituency =~ s/\s+/ /gs;
unless ( defined $constituency && length $constituency ) {
- print STDERR "Name of constituency is a mandatory argument\n";
- exit 1;
+ require Pod::Usage;
+ import Pod::Usage;
+ pod2usage(
+ -msg => "Name of constituency is a mandatory argument\n",
+ -exitval => 1,
+ );
}
More information about the Rt-commit
mailing list