mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CmdPurge: Prompt before purging a task
This commit is contained in:
parent
58cee899b0
commit
894eb3ab79
2 changed files with 19 additions and 9 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <Filter.h>
|
||||
#include <i18n.h>
|
||||
#include <main.h>
|
||||
#include <text.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
|
@ -72,6 +73,13 @@ int CmdPurge::execute (std::string&)
|
|||
std::string uuid = task.get ("uuid");
|
||||
|
||||
if (task.getStatus () == Task::deleted)
|
||||
{
|
||||
std::string question;
|
||||
question = format (STRING_CMD_PURGE_CONFIRM,
|
||||
task.identifier (true),
|
||||
task.get ("description"));
|
||||
|
||||
if (permission (question, filtered.size ()))
|
||||
{
|
||||
context.tdb2.purge (task);
|
||||
count++;
|
||||
|
@ -89,6 +97,7 @@ int CmdPurge::execute (std::string&)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
feedback_affected (count == 1 ? STRING_CMD_PURGE_1 : STRING_CMD_PURGE_N, count);
|
||||
return rc;
|
||||
|
|
|
@ -399,6 +399,7 @@
|
|||
#define STRING_CMD_PURGE_USAGE "Removes the specified tasks from the data files. Causes permanent loss of data."
|
||||
#define STRING_CMD_PURGE_1 "Purged {1} task."
|
||||
#define STRING_CMD_PURGE_N "Purged {1} tasks."
|
||||
#define STRING_CMD_PURGE_CONFIRM "Permanently remove task {1} '{2}'?"
|
||||
|
||||
#define STRING_CMD_START_USAGE "Marks specified task as started"
|
||||
#define STRING_CMD_START_NO "Task not started."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue