diff --git a/gitlog_to_rss.pl b/gitlog_to_rss.pl index 1d13bee..c3272a9 100755 --- a/gitlog_to_rss.pl +++ b/gitlog_to_rss.pl @@ -21,9 +21,14 @@ use strict; use Getopt::Long; +use Cwd; my %options; +# +# Get options +# + GetOptions ( \%options, "repo=s", @@ -31,10 +36,32 @@ "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; #