mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
TW-1655: Inform "No changes made." when quitting early due to signal
- Thanks to Daniel Shahaf.
This commit is contained in:
parent
5059897b50
commit
27fd8910ae
11 changed files with 30 additions and 0 deletions
|
@ -123,6 +123,8 @@
|
|||
- TW-1652 task rm misparsed (thanks to Daniel Shahaf).
|
||||
- TW-1653 info report regression; shouldn't be context sensitive (thanks to
|
||||
David Patrick).
|
||||
- TW-1655 Inform "No changes made." when quitting early due to signal (thanks
|
||||
to Daniel Shahaf).
|
||||
- Prevent potential task duplication during import for non-pending tasks.
|
||||
- Show the active context in "context list", if any is active.
|
||||
- Fix "task edit" dropping annotation text after newlines.
|
||||
|
|
|
@ -752,6 +752,7 @@
|
|||
#define STRING_ERROR_DETAILS "Die Option 'calendar.details.report' muss einen einzelnen Report-Namen enthalten."
|
||||
#define STRING_ERROR_NO_FILTER "Command line filters are not supported by this command."
|
||||
#define STRING_ERROR_NO_MODS "Command line modifications are not supported by this command."
|
||||
#define STRING_ERROR_CONFIRM_SIGINT "Interrupted: No changes made."
|
||||
|
||||
// Feedback
|
||||
#define STRING_FEEDBACK_NO_TASKS "Keine Aufgaben."
|
||||
|
|
|
@ -384,6 +384,7 @@
|
|||
#define STRING_CMD_DELETE_1 "Deleted {1} task."
|
||||
#define STRING_CMD_DELETE_N "Deleted {1} tasks."
|
||||
|
||||
|
||||
#define STRING_CMD_DUPLICATE_USAGE "Duplicates the specified tasks"
|
||||
#define STRING_CMD_DUPLICATE_REC "Note: task {1} was a parent recurring task. The duplicated task is too."
|
||||
#define STRING_CMD_DUPLICATE_NON_REC "Note: task {1} was a recurring task. The duplicated task is not."
|
||||
|
@ -749,6 +750,7 @@
|
|||
#define STRING_ERROR_DETAILS "The setting 'calendar.details.report' must contain a single report name."
|
||||
#define STRING_ERROR_NO_FILTER "Command line filters are not supported by this command."
|
||||
#define STRING_ERROR_NO_MODS "Command line modifications are not supported by this command."
|
||||
#define STRING_ERROR_CONFIRM_SIGINT "Interrupted: No changes made."
|
||||
|
||||
// Feedback
|
||||
#define STRING_FEEDBACK_NO_TASKS "No tasks."
|
||||
|
|
|
@ -752,6 +752,7 @@
|
|||
#define STRING_ERROR_DETAILS "Agordo 'calendar.details.report' devas enhavi sole unu raportnomon."
|
||||
#define STRING_ERROR_NO_FILTER "Command line filters are not supported by this command."
|
||||
#define STRING_ERROR_NO_MODS "Command line modifications are not supported by this command."
|
||||
#define STRING_ERROR_CONFIRM_SIGINT "Interrupted: No changes made."
|
||||
|
||||
// Feedback
|
||||
#define STRING_FEEDBACK_NO_TASKS "Nenia tasko."
|
||||
|
|
|
@ -764,6 +764,7 @@
|
|||
#define STRING_ERROR_DETAILS "El ajuste 'calendar.details.report' debe contener un único nombre de informe."
|
||||
#define STRING_ERROR_NO_FILTER "Command line filters are not supported by this command."
|
||||
#define STRING_ERROR_NO_MODS "Command line modifications are not supported by this command."
|
||||
#define STRING_ERROR_CONFIRM_SIGINT "Interrupted: No changes made."
|
||||
|
||||
// Feedback
|
||||
#define STRING_FEEDBACK_NO_TASKS "Ninguna tarea."
|
||||
|
|
|
@ -752,6 +752,7 @@
|
|||
#define STRING_ERROR_DETAILS "The setting 'calendar.details.report' must contain a single report name."
|
||||
#define STRING_ERROR_NO_FILTER "Command line filters are not supported by this command."
|
||||
#define STRING_ERROR_NO_MODS "Command line modifications are not supported by this command."
|
||||
#define STRING_ERROR_CONFIRM_SIGINT "Interrupted: No changes made."
|
||||
|
||||
// Feedback
|
||||
#define STRING_FEEDBACK_NO_TASKS "No tasks."
|
||||
|
|
|
@ -751,6 +751,7 @@
|
|||
#define STRING_ERROR_DETAILS "The setting 'calendar.details.report' must contain a single report name."
|
||||
#define STRING_ERROR_NO_FILTER "Command line filters are not supported by this command."
|
||||
#define STRING_ERROR_NO_MODS "Command line modifications are not supported by this command."
|
||||
#define STRING_ERROR_CONFIRM_SIGINT "Interrupted: No changes made."
|
||||
|
||||
// Feedback
|
||||
#define STRING_FEEDBACK_NO_TASKS "Nessun task."
|
||||
|
|
|
@ -752,6 +752,7 @@
|
|||
#define STRING_ERROR_DETAILS "The setting 'calendar.details.report' must contain a single report name."
|
||||
#define STRING_ERROR_NO_FILTER "Command line filters are not supported by this command."
|
||||
#define STRING_ERROR_NO_MODS "Command line modifications are not supported by this command."
|
||||
#define STRING_ERROR_CONFIRM_SIGINT "Interrupted: No changes made."
|
||||
|
||||
// Feedback
|
||||
#define STRING_FEEDBACK_NO_TASKS "タスクがない。"
|
||||
|
|
|
@ -752,6 +752,7 @@
|
|||
#define STRING_ERROR_DETAILS "Zmienna 'calendar.details.report' musi zawierać nazwę raportu."
|
||||
#define STRING_ERROR_NO_FILTER "Command line filters are not supported by this command."
|
||||
#define STRING_ERROR_NO_MODS "Command line modifications are not supported by this command."
|
||||
#define STRING_ERROR_CONFIRM_SIGINT "Interrupted: No changes made."
|
||||
|
||||
// Feedback
|
||||
#define STRING_FEEDBACK_NO_TASKS "Brak zadań."
|
||||
|
|
|
@ -752,6 +752,7 @@
|
|||
#define STRING_ERROR_DETAILS "A definição 'calendar.details.report' pode apenas indicar um nome de relatório."
|
||||
#define STRING_ERROR_NO_FILTER "Command line filters are not supported by this command."
|
||||
#define STRING_ERROR_NO_MODS "Command line modifications are not supported by this command."
|
||||
#define STRING_ERROR_CONFIRM_SIGINT "Interrupted: No changes made."
|
||||
|
||||
// Feedback
|
||||
#define STRING_FEEDBACK_NO_TASKS "Nenhuma tarefa."
|
||||
|
|
18
src/util.cpp
18
src/util.cpp
|
@ -45,6 +45,7 @@
|
|||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <pwd.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
|
@ -58,6 +59,16 @@
|
|||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static void signal_handler (int s)
|
||||
{
|
||||
if (s == SIGINT)
|
||||
{
|
||||
std::cout << "\n\n" << STRING_ERROR_CONFIRM_SIGINT << "\n";
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Uses std::getline, because std::cin eats leading whitespace, and that means
|
||||
// that if a newline is entered, std::cin eats it and never returns from the
|
||||
|
@ -69,6 +80,8 @@ bool confirm (const std::string& question)
|
|||
STRING_UTIL_CONFIRM_NO};
|
||||
std::vector <std::string> matches;
|
||||
|
||||
signal (SIGINT, signal_handler);
|
||||
|
||||
do
|
||||
{
|
||||
std::cout << question
|
||||
|
@ -83,6 +96,7 @@ bool confirm (const std::string& question)
|
|||
}
|
||||
while (! std::cin.eof () && matches.size () != 1);
|
||||
|
||||
signal (SIGINT, SIG_DFL);
|
||||
return matches.size () == 1 && matches[0] == STRING_UTIL_CONFIRM_YES ? true : false;
|
||||
}
|
||||
|
||||
|
@ -101,6 +115,8 @@ int confirm4 (const std::string& question)
|
|||
STRING_UTIL_CONFIRM_QUIT};
|
||||
std::vector <std::string> matches;
|
||||
|
||||
signal (SIGINT, signal_handler);
|
||||
|
||||
do
|
||||
{
|
||||
std::cout << question
|
||||
|
@ -119,6 +135,8 @@ int confirm4 (const std::string& question)
|
|||
}
|
||||
while (! std::cin.eof () && matches.size () != 1);
|
||||
|
||||
signal (SIGINT, SIG_DFL);
|
||||
|
||||
if (matches.size () == 1)
|
||||
{
|
||||
if (matches[0] == STRING_UTIL_CONFIRM_YES_U) return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue