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:
Paul Beckingham
2014-08-11 12:32:11 -04:00
parent c2ffee1352
commit 1ccc284cc7
12 changed files with 23 additions and 0 deletions

View File

@@ -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))