From 16558163f890d49346c6f4d40222f8dd97ec9eb1 Mon Sep 17 00:00:00 2001 From: Darold Gilles Date: Mon, 20 Jan 2014 18:13:37 +0100 Subject: [PATCH] Add control of -o vs -O option with incremental mode. --- pgbadger | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pgbadger b/pgbadger index d981788..11037bb 100755 --- a/pgbadger +++ b/pgbadger @@ -373,7 +373,12 @@ $img_format = 'png' if ($img_format ne 'jpeg'); if ($outfile ne '-') { if (!$outdir) { my @infs = fileparse($outfile); - $outdir = $infs[1]; + if ($infs[0] ne '') { + $outdir = $infs[1]; + } else { + # maybe a confusion between -O and -o + die "FATAL: output file $outfile is a directory, should be a file\nor maybe you want to use -O | --outdir option instead.\n"; + } } elsif (!-d "$outdir") { # An output directory have been passed as command line parameter die "FATAL: $outdir is not a directory or doesn't exist.\n"; -- 2.50.1