Implement deletion of the current open task
authorJoey Schulze <joey@infodrom.org>
Sun, 17 Aug 2008 08:22:50 +0000 (08:22 +0000)
committerJoey Schulze <joey@infodrom.org>
Sun, 17 Aug 2008 08:22:50 +0000 (08:22 +0000)
src/InfoCon/stempel/stempel

index 4988d92..9c66cdb 100755 (executable)
@@ -144,6 +144,14 @@ sub close_task
     exit(0);
 }
 
     exit(0);
 }
 
+sub delete_task
+{
+    my $query = q{DELETE FROM stempel WHERE stop IS NULL};
+    $dbh->do ($query);
+
+    exit(0);
+}
+
 sub list_open
 {
     my ($d_sec,$d_min,$d_hour,$d_mday,$d_mon,$d_year,$d_wday,$d_isdst) = localtime();
 sub list_open
 {
     my ($d_sec,$d_min,$d_hour,$d_mday,$d_mon,$d_year,$d_wday,$d_isdst) = localtime();
@@ -235,7 +243,8 @@ stempel  Copyright (c) 2007,8  Martin Schulze <joey\@infodrom.org>
     --open         list open
     --close time   close open task
     --help         this text
     --open         list open
     --close time   close open task
     --help         this text
-    -d             terminate task
+    --end|-d       terminate task
+    --delete       delete open task
 END
     exit;
 }
 END
     exit;
 }
@@ -246,6 +255,7 @@ my %options = ('list:s' => \$opt_list,
               'open' => \&list_open,
               'help' => \&help,
               'close=i' => \$opt_close,
               'open' => \&list_open,
               'help' => \&help,
               'close=i' => \$opt_close,
+              'delete' => \&delete_task,
               'terminate|end|d' => \&close_task,
               );
 GetOptions %options;
               'terminate|end|d' => \&close_task,
               );
 GetOptions %options;