From 1647027acdde0c71eda1b781723688f1a53c6076 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 27 Feb 2011 16:51:34 +0100 Subject: Add help/version switches --- lib/App/Dthumb.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/App/Dthumb.pm') diff --git a/lib/App/Dthumb.pm b/lib/App/Dthumb.pm index f525776..f26848f 100755 --- a/lib/App/Dthumb.pm +++ b/lib/App/Dthumb.pm @@ -44,6 +44,7 @@ sub new { sub run { my ($self) = @_; + $self->check_cmd_flags(); $self->read_directories(); $self->create_files(); $self->delete_old_thumbnails(); @@ -51,6 +52,19 @@ sub run { $self->write_out_html(); } +sub check_cmd_flags { + my ($self) = @_; + + if ($self->{config}->{version}) { + say "dthumb version ${VERSION}"; + exit 0; + } + if ($self->{config}->{help}) { + say "Please refer to perldoc -F $0 (or man dthumb)"; + exit 0; + } +} + sub read_directories { my ($self) = @_; my $thumbdir = $self->{config}->{dir_thumbs}; -- cgit v1.2.3