From 2bb5368edab70b43e117bf474205a766595939c6 Mon Sep 17 00:00:00 2001 From: Joey Schulze Date: Thu, 1 Oct 2015 19:11:49 +0000 Subject: [PATCH] Add Readline history for editing task --- src/InfoCon/stempel/stempel | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/InfoCon/stempel/stempel b/src/InfoCon/stempel/stempel index be9b66c..b3abec9 100755 --- a/src/InfoCon/stempel/stempel +++ b/src/InfoCon/stempel/stempel @@ -1,7 +1,7 @@ #! /usr/bin/perl -# Time Tracker -# Copyright (c) 2007,8,13,14 Martin Schulze +# InfoCon Time Tracker +# Copyright (c) 2007,8,13,14,15 Martin Schulze # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -299,6 +299,18 @@ sub alter_task my $term = new Term::ReadLine ''; + my $sql = q{SELECT customer,task FROM stempel WHERE stop IS NULL}; + my $sth = $dbh->prepare($sql); + $sth->execute; + my $row = $sth->fetchrow_hashref; + + my $tasks = tasklist $row->{'customer'}; + $term->addhistory($_) foreach (@$tasks); + + my $attribs = $term->Attribs; + $attribs->{completion_word} = $tasks; + $term->{completion_function} = sub {return complete_customer $row->{'customer'}, @_}; + my $task = $term->readline ('Aufgabe: '); if (length($task) > 0) { -- 2.20.1