projects
/
infodrom.org
/
service.infodrom.org
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
52128e5
)
Support changing the task title
author
Joey Schulze
<joey@infodrom.org>
Fri, 5 Sep 2008 09:46:05 +0000
(09:46 +0000)
committer
Joey Schulze
<joey@infodrom.org>
Fri, 5 Sep 2008 09:46:05 +0000
(09:46 +0000)
src/InfoCon/stempel/stempel
patch
|
blob
|
history
diff --git
a/src/InfoCon/stempel/stempel
b/src/InfoCon/stempel/stempel
index
9c66cdb
..
9f69d77
100755
(executable)
--- a/
src/InfoCon/stempel/stempel
+++ b/
src/InfoCon/stempel/stempel
@@
-154,6
+154,7
@@
sub delete_task
sub list_open
{
sub list_open
{
+ my $exit = shift;
my ($d_sec,$d_min,$d_hour,$d_mday,$d_mon,$d_year,$d_wday,$d_isdst) = localtime();
my $query = q{SELECT customer,start,task FROM stempel WHERE time IS NULL ORDER BY start,customer};
my ($d_sec,$d_min,$d_hour,$d_mday,$d_mon,$d_year,$d_wday,$d_isdst) = localtime();
my $query = q{SELECT customer,start,task FROM stempel WHERE time IS NULL ORDER BY start,customer};
@@
-176,7
+177,7
@@
sub list_open
printf "%-15s %s %s (%s) %s\n", $row->{customer}, $day, $time, min2hour($int), $row->{task};
}
}
printf "%-15s %s %s (%s) %s\n", $row->{customer}, $day, $time, min2hour($int), $row->{task};
}
}
- exit 0;
+ exit 0
if $exit
;
}
sub list
}
sub list
@@
-217,7
+218,7
@@
sub list
sub toggle_task
{
if (is_open) {
sub toggle_task
{
if (is_open) {
- list_open;
+ list_open
1
;
} else {
open_task;
}
} else {
open_task;
}
@@
-235,6
+236,24
@@
sub late_close_task
$dbh->do($query);
}
$dbh->do($query);
}
+sub alter_task
+{
+ return unless is_open;
+
+ list_open;
+
+ my $term = new Term::ReadLine '';
+
+ my $task = $term->readline ('Aufgabe: ');
+
+ if (length($task) > 0) {
+ my $query = q{UPDATE stempel SET task=? WHERE stop IS NULL};
+ my $sth = $dbh->prepare($query);
+ $sth->execute($task);
+ }
+ exit 0;
+}
+
sub help
{
print <<"END";
sub help
{
print <<"END";
@@
-245,6
+264,7
@@
stempel Copyright (c) 2007,8 Martin Schulze <joey\@infodrom.org>
--help this text
--end|-d terminate task
--delete delete open task
--help this text
--end|-d terminate task
--delete delete open task
+ --task alter task content
END
exit;
}
END
exit;
}
@@
-256,6
+276,7
@@
my %options = ('list:s' => \$opt_list,
'help' => \&help,
'close=i' => \$opt_close,
'delete' => \&delete_task,
'help' => \&help,
'close=i' => \$opt_close,
'delete' => \&delete_task,
+ 'task|t' => \&alter_task,
'terminate|end|d' => \&close_task,
);
GetOptions %options;
'terminate|end|d' => \&close_task,
);
GetOptions %options;