From 156a0fdee1df71ca9bdb00b4993759e244944573 Mon Sep 17 00:00:00 2001 From: Devendra Gera Date: Sun, 3 Feb 2008 11:41:19 +0530 Subject: [PATCH] added logic to understand 'after n {days,weeks,months,business days}' time formats. The "business days" logic needs a config specifying business days, as per Date::Manip. Please see Date::Manip on CPAN. This commit re-does the changes in 2813598df115c77b0f460b2563c7b36b99b61732 which were reverted in 40bea44904b1c2320546726ad593b5c46bda66ee My bad. Signed-off-by: Devendra Gera --- remindme | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/remindme b/remindme index 7a2b55e..f01b0d5 100755 --- a/remindme +++ b/remindme @@ -10,6 +10,18 @@ my $argstring = join (" ", @ARGV); my ($when, $what, $howmany); (undef, $when, $what, $howmany) = ($argstring =~ /^(on |)(.*?) to (.*?)( for (\d+) days|)$/); +if ( $when =~ /^after/ ) { + # check for the "after n days" format. + # There are better ways of handling multiple regexes, but we'll do + # things this way since there are only two for now. + + my $unit; + ($when, $unit, $what, $howmany) = + ($argstring =~ /^after (\d+) (days|weeks|months|business days) to (.*?)( for (\d+) days|)$/); + if( $when ) { + $when = DateCalc("today", "+$when $unit"); + } +} quit("what?") unless $what; quit("when?") unless $when; -- 2.11.4.GIT