Skip to content

Commit

Permalink
[3] Check and set given options
Browse files Browse the repository at this point in the history
Signed-off-by: DoesntMatter <jaed1@gmx.net>
  • Loading branch information
DoesntMatter committed Jan 22, 2012
1 parent 49ba0f1 commit 9220f24
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions gitlog_to_rss.pl
Expand Up @@ -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;

#
Expand Down

0 comments on commit 9220f24

Please sign in to comment.