Permalink
Browse files

[3] Check and set given options

Signed-off-by: DoesntMatter <jaed1@gmx.net>
  • Loading branch information...
DoesntMatter committed Jan 21, 2012
1 parent 49ba0f1 commit 9220f24abba1a894307453067beb330b4f292e83
Showing with 27 additions and 0 deletions.
  1. +27 −0 gitlog_to_rss.pl
View
@@ -21,20 +21,47 @@
use strict;
use Getopt::Long;
use Cwd;
my %options;
#
# Get options
#
GetOptions (
\%options,
"repo=s",
"outfile=s",
"help|?",
);
#
# Check and set options
#
if ($options{'help'}) {
ShowHelp();
}
if ($options{'repo'} and $options{'repo'} ne '') {
unless (-d $options{'repo'}) {
print "Repository does not exist in given path!\n";
exit;
}
unless (-d ($options{'repo'} . "/.git")) {
print "Given directory is not a Git repository!\n";
exit;
}
}
else {
ShowHelp();
}
unless ($options{'outfile'} and $options{'outfile'} ne '') {
$options{'outfile'} = cwd();
}
exit;
#

0 comments on commit 9220f24

Please sign in to comment.