summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/reply25
1 files changed, 24 insertions, 1 deletions
diff --git a/bin/reply b/bin/reply
index f6f5171..c4f284c 100644
--- a/bin/reply
+++ b/bin/reply
@@ -6,6 +6,7 @@ use warnings;
use File::HomeDir;
use File::Spec;
+use Getopt::Long;
use Reply;
@@ -24,7 +25,19 @@ this program.
=cut
-my $cfg = File::Spec->catfile(File::HomeDir->my_home, ".replyrc");
+my $cfgfile = '.replyrc';
+GetOptions(
+ 'cfg:s' => \$cfgfile,
+ 'version' => sub { version() },
+ 'help' => sub { usage(0) },
+) or usage(1);
+
+my $cfg = File::Spec->catfile(
+ (File::Spec->file_name_is_absolute($cfgfile)
+ ? ()
+ : (File::HomeDir->my_home)),
+ $cfgfile
+);
my %args = (config => $cfg);
if (!-e $cfg) {
@@ -46,6 +59,16 @@ if (!-e $cfg) {
Reply->new(%args)->run;
+sub usage {
+ print " reply [--version] [--help] [--cfg file]\n";
+ exit($_[0]);
+}
+
+sub version {
+ print "Reply version $Reply::VERSION\n";
+ exit(0);
+}
+
__DATA__
script_line1 = use strict
script_line2 = use warnings