mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-01 09:17:19 +02:00
Safety Valve Override
- Support 'allow.empty.filter', defaulting to 'yes', but if 'no' disallows the combination of a write command and an empty filter. Ordinarily this is just a warning that requires confirmation (thanks to Lee Lieske).
This commit is contained in:
parent
c2ffee1352
commit
1ccc284cc7
12 changed files with 23 additions and 0 deletions
|
@ -81,6 +81,7 @@ std::string Config::_defaults =
|
|||
"# # Comma-separated list. May contain any subset of:\n"
|
||||
"#verbose=blank,header,footnote,label,new-id,new-uuid,affected,edit,special,project,sync,filter\n"
|
||||
"confirmation=yes # Confirmation on delete, big changes\n"
|
||||
"allow.empty.filter=yes # An empty filter gets a warning and requires confirmation\n"
|
||||
"indent.annotation=2 # Indent spaces for annotations\n"
|
||||
"indent.report=0 # Indent spaces for whole report\n"
|
||||
"row.padding=0 # Left and right padding for each row of report\n"
|
||||
|
|
|
@ -259,6 +259,9 @@ void Filter::safety ()
|
|||
{
|
||||
if (context.parser.getFilterExpression () == "")
|
||||
{
|
||||
if (! context.config.getBoolean ("allow.empty.filter"))
|
||||
throw std::string (STRING_TASK_SAFETY_ALLOW);
|
||||
|
||||
// If user is willing to be asked, this can be avoided.
|
||||
if (context.config.getBoolean ("confirmation") &&
|
||||
confirm (STRING_TASK_SAFETY_VALVE))
|
||||
|
|
|
@ -69,6 +69,7 @@ int CmdShow::execute (std::string& output)
|
|||
std::string recognized =
|
||||
" abbreviation.minimum"
|
||||
" active.indicator"
|
||||
" allow.empty.filter"
|
||||
" avoidlastcolumn"
|
||||
" bulk"
|
||||
" burndown.bias"
|
||||
|
|
|
@ -842,6 +842,7 @@
|
|||
#define STRING_TASK_VALID_PRIORITY "Priority values may be 'H', 'M' or 'L', not '{1}'."
|
||||
#define STRING_TASK_SAFETY_VALVE "This command has no filter, and will modify all tasks. Are you sure?"
|
||||
#define STRING_TASK_SAFETY_FAIL "Command prevented from running."
|
||||
#define STRING_TASK_SAFETY_ALLOW "You did not specify a filter, and with the 'allow.empty.filter' value, no action is taken."
|
||||
|
||||
// TDB2
|
||||
#define STRING_TDB2_PARSE_ERROR " in {1} at line {2}"
|
||||
|
|
|
@ -854,6 +854,7 @@
|
|||
#define STRING_TASK_VALID_PRIORITY "Valores de prioridad pueden ser 'H', 'M' o 'L', no '{1}'."
|
||||
#define STRING_TASK_SAFETY_VALVE "Este comando no tiene filtro, y modificará todas las tareas. ¿Está seguro?"
|
||||
#define STRING_TASK_SAFETY_FAIL "Se impidió la ejecución del comando."
|
||||
#define STRING_TASK_SAFETY_ALLOW "You did not specify a filter, and with the 'allow.empty.filter' value, no action is taken."
|
||||
|
||||
// TDB2
|
||||
#define STRING_TDB2_PARSE_ERROR " en {1} en la línea {2}"
|
||||
|
|
|
@ -841,6 +841,7 @@
|
|||
#define STRING_TASK_VALID_PRIORITY "Priority values may be 'H', 'M' or 'L', not '{1}'."
|
||||
#define STRING_TASK_SAFETY_VALVE "This command has no filter, and will modify all tasks. Are you sure?"
|
||||
#define STRING_TASK_SAFETY_FAIL "Command prevented from running."
|
||||
#define STRING_TASK_SAFETY_ALLOW "You did not specify a filter, and with the 'allow.empty.filter' value, no action is taken."
|
||||
|
||||
// TDB2
|
||||
#define STRING_TDB2_PARSE_ERROR " in {1} at line {2}"
|
||||
|
|
|
@ -842,6 +842,7 @@
|
|||
#define STRING_TASK_VALID_PRIORITY "I valori di priorità possono essere 'H', 'M' o 'L', non '{1}'."
|
||||
#define STRING_TASK_SAFETY_VALVE "Questo comando non ha filtro, e modificherà tutti i task. Sicuro?"
|
||||
#define STRING_TASK_SAFETY_FAIL "Prevenuta l'esecuzione del comando."
|
||||
#define STRING_TASK_SAFETY_ALLOW "You did not specify a filter, and with the 'allow.empty.filter' value, no action is taken."
|
||||
|
||||
// TDB2
|
||||
#define STRING_TDB2_PARSE_ERROR " in {1} alla linea {2}"
|
||||
|
|
|
@ -842,6 +842,7 @@
|
|||
#define STRING_TASK_VALID_PRIORITY "Valores de prioridade podem ser 'A', 'M' ou 'B', não '{1}'."
|
||||
#define STRING_TASK_SAFETY_VALVE "Este comando não possui um filtro e irá modificar todas as tarefas. Tem a certeza?"
|
||||
#define STRING_TASK_SAFETY_FAIL "Execução do comando abortada."
|
||||
#define STRING_TASK_SAFETY_ALLOW "You did not specify a filter, and with the 'allow.empty.filter' value, no action is taken."
|
||||
|
||||
// TDB2
|
||||
#define STRING_TDB2_PARSE_ERROR " em {1} na linha {2}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue