Feature: Extra arg detection
- Commands that do not accept filters or modifications now generate an error when extra arguments are specified.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <cmake.h>
|
||||
#include <Context.h>
|
||||
#include <Filter.h>
|
||||
#include <i18n.h>
|
||||
#include <CmdUndo.h>
|
||||
|
||||
@@ -44,6 +45,12 @@ CmdUndo::CmdUndo ()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdUndo::execute (std::string& output)
|
||||
{
|
||||
Filter filter;
|
||||
if (filter.hasFilter ())
|
||||
throw std::string (STRING_ERROR_NO_FILTER);
|
||||
if (filter.hasModifications ())
|
||||
throw std::string (STRING_ERROR_NO_MODS);
|
||||
|
||||
// Detect attempts to modify the task.
|
||||
if (context.cli2.getWords ().size ())
|
||||
throw std::string (STRING_CMD_UNDO_MODS);
|
||||
|
||||
Reference in New Issue
Block a user