Commit 22b5fde8 authored by Andreas Kusalananda Kähäri's avatar Andreas Kusalananda Kähäri
Browse files

Do command line parsing.

parent 4e956a03
......@@ -3,13 +3,13 @@
use strict;
use warnings;
use Getopt::Long qw( :config no_ignore_case );
use DBI qw( :sql_types );
my $release;
my @servers = ('ens-staging1', 'ens-staging2');
my $master = 'ens-staging1';
my $dbport = '3306';
my $dbuser = 'ensadmin';
my $dbpass;
......@@ -19,6 +19,30 @@ my $dbropass;
my $opt_help = 0;
my $opt_about = 0;
if ( !GetOptions( 'release|r=i' => \$release,
'master|m=s' => \$master,
'server|s=s@' => \@servers,
'dbuser|u=s' => \$dbuser,
'dbpass|p=s' => \$dbpass,
'dbport|P=s' => \$dbport,
'dbrouser|rou' => \$dbrouser,
'dbropass|rop' => \$dbropass,
'help|h!' => \$opt_help,
'about!' => \$opt_about )
|| $opt_help )
{
usage();
exit();
} elsif ($opt_about) {
about();
exit();
} elsif ( !defined($release) ) {
print("ERROR: Release was not specified! (use -r or --release)\n");
usage();
exit();
}
my %databases;
foreach my $server (@servers) {
my $dsn = sprintf( 'DBI:mysql:host=%s;port=%d', $server, $dbport );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment