summaryrefslogtreecommitdiff
path: root/pinyadmin/sbin/newuser
diff options
context:
space:
mode:
authorJulian Blake Kongslie <jblake@omgwallhack.org>2011-05-31 01:14:35 -0700
committerJulian Blake Kongslie <jblake@omgwallhack.org>2011-05-31 01:14:35 -0700
commit6239ca4595858262ac42a5e743d76653c9e61c4a (patch)
treea3dc444e513e340251a649ff1b66614fd64a8d03 /pinyadmin/sbin/newuser
parent72e01a19a79d4e9167574b6f89383730da1947e5 (diff)
downloadpiny-code-6239ca4595858262ac42a5e743d76653c9e61c4a.tar.gz
piny-code-6239ca4595858262ac42a5e743d76653c9e61c4a.zip
Real option parsing.
Diffstat (limited to 'pinyadmin/sbin/newuser')
-rwxr-xr-xpinyadmin/sbin/newuser19
1 files changed, 15 insertions, 4 deletions
diff --git a/pinyadmin/sbin/newuser b/pinyadmin/sbin/newuser
index e6dd785..2a349fd 100755
--- a/pinyadmin/sbin/newuser
+++ b/pinyadmin/sbin/newuser
@@ -4,9 +4,10 @@ use strict;
use warnings;
use Email::Valid::Loose qw( );
+use Getopt::Tabular qw( );
-use Piny::Config;
-use Piny::User;
+#use Piny::Config;
+#use Piny::User;
my ( $email, $username, $password );
@@ -19,10 +20,20 @@ my $checker = Email::Valid::Loose->new
, "-tldcheck" => 0
);
+my ( $batchmode, $disableikiwiki ) = ( 0, 0 );
+
+# Argument parsing.
+Getopt::Tabular::SetOptionPatterns( "(--)[\\w-]+", "(-)\\w" );
+Getopt::Tabular::SetHelpOption( "--help" );
+Getopt::Tabular::GetOptions(
+ [ [ "--batch", "const", 1, \$batchmode, "enable batch mode, for use as a backend by other scripts" ]
+ , [ "--disable-ikiwiki|--enable-ikiwiki", "boolean", 0, \$disableikiwiki, "disable creation of an ikiwiki site for this repo" ]
+ ], \@ARGV ) or exit 0;
+
# Check to see if we're in batch mode.
-if ( scalar @ARGV == 3 and $ARGV[0] eq "--batch" ) {
+if ( $batchmode and scalar @ARGV == 2 ) {
- ( undef, $email, $username ) = @ARGV;
+ ( $email, $username ) = @ARGV;
$email = $checker->address( $email );