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:
Paul Beckingham 2015-07-25 13:58:15 -04:00
parent 8684639f72
commit 5f30c9e2c3
21 changed files with 72 additions and 0 deletions

View file

@ -32,6 +32,7 @@
#include <time.h>
#include <RX.h>
#include <Context.h>
#include <Filter.h>
#include <i18n.h>
#include <text.h>
#include <util.h>
@ -64,6 +65,12 @@ CmdDiagnostics::CmdDiagnostics ()
// kind of questions we always have to ask whenever something is wrong.
int CmdDiagnostics::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);
Color bold;
if (context.color ())
bold = Color ("bold");