From 109f22051d7e94c7eacbbe6bd27df375c768aa87 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 9 Jan 2011 23:15:30 -0500 Subject: [PATCH] Bug #603 - When an ID was not specified, delete gave no feedback (thanks to Steve Rader). - Closer inspection showed this to be true for the urgency, query, delete, start, stop, done, modify, append, prepend, duplicate, annotate and denotate commands. --- ChangeLog | 2 ++ src/command.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e7287ba88..daa665d3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -74,6 +74,8 @@ Fluger). + Fixed bug #597, which caused a missing project to be counted as a project in the projects command (thanks to Steve Rader). + + Fixed bug #603, which caused no feedback when task IDs were not specified + (thanks to Steve Rader). + Applied patch to fix bug #613, so that the summary report and the projects command now consistently show a missing project as "(none)" (thanks to Steve Rader). diff --git a/src/command.cpp b/src/command.cpp index 94dd1cbb7..41df83ae0 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -543,6 +543,11 @@ int handleUrgency (std::string& outs) // Filter sequence. context.filter.applySequence (tasks, context.sequence); + if (tasks.size () == 0) + { + std::cout << "No tasks specified.\n"; + return 1; + } // Find the task(s). std::stringstream out; @@ -578,6 +583,12 @@ int handleQuery (std::string& outs) if (context.sequence.size ()) context.filter.applySequence (tasks, context.sequence); + if (tasks.size () == 0) + { + std::cout << "No tasks specified.\n"; + return 1; + } + // Note: "limit:" feature not supported. // Compose output. @@ -1545,6 +1556,11 @@ int handleDelete (std::string& outs) // Filter sequence. std::vector all = tasks; context.filter.applySequence (tasks, context.sequence); + if (tasks.size () == 0) + { + std::cout << "No tasks specified.\n"; + return 1; + } // Determine the end date. char endTime[16]; @@ -1640,7 +1656,8 @@ int handleDelete (std::string& outs) context.footnote (onProjectChange (*task)); } } - else { + else + { out << "Task not deleted.\n"; rc = 1; } @@ -1677,6 +1694,11 @@ int handleStart (std::string& outs) // Filter sequence. context.filter.applySequence (tasks, context.sequence); + if (tasks.size () == 0) + { + std::cout << "No tasks specified.\n"; + return 1; + } bool nagged = false; foreach (task, tasks) @@ -1743,6 +1765,11 @@ int handleStop (std::string& outs) // Filter sequence. context.filter.applySequence (tasks, context.sequence); + if (tasks.size () == 0) + { + std::cout << "No tasks specified.\n"; + return 1; + } foreach (task, tasks) { @@ -1801,6 +1828,11 @@ int handleDone (std::string& outs) // Filter sequence. std::vector all = tasks; context.filter.applySequence (tasks, context.sequence); + if (tasks.size () == 0) + { + std::cout << "No tasks specified.\n"; + return 1; + } Permission permission; if (context.sequence.size () > (size_t) context.config.getInteger ("bulk")) @@ -1909,6 +1941,11 @@ int handleModify (std::string& outs) // Filter sequence. std::vector all = tasks; context.filter.applySequence (tasks, context.sequence); + if (tasks.size () == 0) + { + std::cout << "No tasks specified.\n"; + return 1; + } Permission permission; if (context.sequence.size () > (size_t) context.config.getInteger ("bulk")) @@ -2067,6 +2104,11 @@ int handleAppend (std::string& outs) // Filter sequence. std::vector all = tasks; context.filter.applySequence (tasks, context.sequence); + if (tasks.size () == 0) + { + std::cout << "No tasks specified.\n"; + return 1; + } Permission permission; if (context.sequence.size () > (size_t) context.config.getInteger ("bulk")) @@ -2149,6 +2191,11 @@ int handlePrepend (std::string& outs) // Filter sequence. std::vector all = tasks; context.filter.applySequence (tasks, context.sequence); + if (tasks.size () == 0) + { + std::cout << "No tasks specified.\n"; + return 1; + } Permission permission; if (context.sequence.size () > (size_t) context.config.getInteger ("bulk")) @@ -2230,6 +2277,11 @@ int handleDuplicate (std::string& outs) // Filter sequence. context.filter.applySequence (tasks, context.sequence); + if (tasks.size () == 0) + { + std::cout << "No tasks specified.\n"; + return 1; + } foreach (task, tasks) { @@ -2655,6 +2707,11 @@ int handleAnnotate (std::string& outs) // Filter sequence. context.filter.applySequence (tasks, context.sequence); + if (tasks.size () == 0) + { + std::cout << "No tasks specified.\n"; + return 1; + } Permission permission; if (context.sequence.size () > (size_t) context.config.getInteger ("bulk")) @@ -2717,6 +2774,11 @@ int handleDenotate (std::string& outs) context.tdb.loadPending (tasks, filter); context.filter.applySequence (tasks, context.sequence); + if (tasks.size () == 0) + { + std::cout << "No tasks specified.\n"; + return 1; + } Permission permission; if (context.sequence.size () > (size_t) context.config.getInteger ("bulk"))