diff --git a/ChangeLog b/ChangeLog index b5f7314d9..41e2e6ac7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -105,6 +105,8 @@ - When multiple tasks are 'edit'ed, a failure causes the editing to stop (thanks to Daniel Shahaf). - New 'UDA' and 'ORPHAN' virtual tags. +- Commands that do not accept filters or modifications now generate an error + when extra arguments are specified. ------ current release --------------------------- diff --git a/src/commands/CmdDiagnostics.cpp b/src/commands/CmdDiagnostics.cpp index a4c5d93c5..6b5d8d53a 100644 --- a/src/commands/CmdDiagnostics.cpp +++ b/src/commands/CmdDiagnostics.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -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"); diff --git a/src/commands/CmdExport.cpp b/src/commands/CmdExport.cpp index f29b73e97..8bc506f5c 100644 --- a/src/commands/CmdExport.cpp +++ b/src/commands/CmdExport.cpp @@ -56,6 +56,9 @@ int CmdExport::execute (std::string& output) std::vector filtered; filter.subset (filtered, false); + if (filter.hasModifications ()) + throw std::string (STRING_ERROR_NO_MODS); + // Obey 'limit:N'. int rows = 0; int lines = 0; diff --git a/src/commands/CmdHelp.cpp b/src/commands/CmdHelp.cpp index b47fbedec..3e9b86ebf 100644 --- a/src/commands/CmdHelp.cpp +++ b/src/commands/CmdHelp.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -48,6 +49,12 @@ CmdHelp::CmdHelp () //////////////////////////////////////////////////////////////////////////////// int CmdHelp::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); + ViewText view; view.width (context.getWidth ()); view.add (Column::factory ("string.left", "")); diff --git a/src/commands/CmdImport.cpp b/src/commands/CmdImport.cpp index f186af92f..c4c29c235 100644 --- a/src/commands/CmdImport.cpp +++ b/src/commands/CmdImport.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -54,6 +55,10 @@ int CmdImport::execute (std::string& output) int rc = 0; int count = 0; + Filter filter; + if (filter.hasFilter ()) + throw std::string (STRING_ERROR_NO_FILTER); + // Get filenames from command line arguments. std::vector words = context.cli2.getWords (); if (! words.size () || (words.size () == 1 && words[0] == "-")) diff --git a/src/commands/CmdLogo.cpp b/src/commands/CmdLogo.cpp index 397dc3d12..36dc94e34 100644 --- a/src/commands/CmdLogo.cpp +++ b/src/commands/CmdLogo.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -50,6 +51,12 @@ CmdLogo::CmdLogo () // extension.= int CmdLogo::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); + static const char* data[] = { ".........ABDEF", diff --git a/src/commands/CmdReports.cpp b/src/commands/CmdReports.cpp index 002b59143..b56fdabe0 100644 --- a/src/commands/CmdReports.cpp +++ b/src/commands/CmdReports.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -48,6 +49,12 @@ CmdReports::CmdReports () //////////////////////////////////////////////////////////////////////////////// int CmdReports::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); + std::vector reports; // Add custom reports. diff --git a/src/commands/CmdSync.cpp b/src/commands/CmdSync.cpp index 0bf652bd2..d326c965d 100644 --- a/src/commands/CmdSync.cpp +++ b/src/commands/CmdSync.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -54,6 +55,10 @@ int CmdSync::execute (std::string& output) #ifdef HAVE_LIBGNUTLS std::stringstream out; + Filter filter; + if (filter.hasFilter ()) + throw std::string (STRING_ERROR_NO_FILTER); + // Loog for the 'init' keyword to indicate one-time pending.data upload. bool first_time_init = false; std::vector words = context.cli2.getWords (); diff --git a/src/commands/CmdTimesheet.cpp b/src/commands/CmdTimesheet.cpp index 23bfee6b1..5183edfaf 100644 --- a/src/commands/CmdTimesheet.cpp +++ b/src/commands/CmdTimesheet.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/src/commands/CmdUDAs.cpp b/src/commands/CmdUDAs.cpp index fa8775c61..883c08c3b 100644 --- a/src/commands/CmdUDAs.cpp +++ b/src/commands/CmdUDAs.cpp @@ -71,6 +71,11 @@ int CmdUDAs::execute (std::string& output) std::vector filtered; filter.subset (filtered); + if (filter.hasFilter ()) + throw std::string (STRING_ERROR_NO_FILTER); + if (filter.hasModifications ()) + throw std::string (STRING_ERROR_NO_MODS); + if (udas.size ()) { std::sort (udas.begin (), udas.end ()); diff --git a/src/commands/CmdUndo.cpp b/src/commands/CmdUndo.cpp index 908d06bd0..e54713504 100644 --- a/src/commands/CmdUndo.cpp +++ b/src/commands/CmdUndo.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -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); diff --git a/src/commands/CmdVersion.cpp b/src/commands/CmdVersion.cpp index c20fa4234..d2af92f18 100644 --- a/src/commands/CmdVersion.cpp +++ b/src/commands/CmdVersion.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #ifdef HAVE_COMMIT #include @@ -51,6 +52,12 @@ CmdVersion::CmdVersion () //////////////////////////////////////////////////////////////////////////////// int CmdVersion::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); + std::stringstream out; // Create a table for the disclaimer. diff --git a/src/l10n/deu-DEU.h b/src/l10n/deu-DEU.h index 7703101b0..51a880a23 100644 --- a/src/l10n/deu-DEU.h +++ b/src/l10n/deu-DEU.h @@ -747,6 +747,7 @@ #define STRING_INVALID_SORT_COL "Nach Spalte '{1}' kann nicht sortiert weden." #define STRING_TLS_INIT_FAIL "Fehler bei der TLS-Initialisierung. {1}" #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 support by this command." #define STRING_ERROR_NO_MODS "Command line modifications are not support by this command." // Feedback diff --git a/src/l10n/eng-USA.h b/src/l10n/eng-USA.h index 4e8647e15..6aa88bf6f 100644 --- a/src/l10n/eng-USA.h +++ b/src/l10n/eng-USA.h @@ -747,6 +747,7 @@ #define STRING_INVALID_SORT_COL "The '{1}' column is not a valid sort field." #define STRING_TLS_INIT_FAIL "Error initializing TLS. {1}" #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 support by this command." #define STRING_ERROR_NO_MODS "Command line modifications are not support by this command." // Feedback diff --git a/src/l10n/epo-RUS.h b/src/l10n/epo-RUS.h index 503c1c42c..668387d38 100644 --- a/src/l10n/epo-RUS.h +++ b/src/l10n/epo-RUS.h @@ -747,6 +747,7 @@ #define STRING_INVALID_SORT_COL "Kolumno '{1}' ne estas valida kampo por ordigi." #define STRING_TLS_INIT_FAIL "Erara eko de TLS. {1}" #define STRING_ERROR_DETAILS "Agordo 'calendar.details.report' devas enhavi sole unu raportnomon." +#define STRING_ERROR_NO_FILTER "Command line filters are not support by this command." #define STRING_ERROR_NO_MODS "Command line modifications are not support by this command." // Feedback diff --git a/src/l10n/esp-ESP.h b/src/l10n/esp-ESP.h index 741da1508..673bcbfb6 100644 --- a/src/l10n/esp-ESP.h +++ b/src/l10n/esp-ESP.h @@ -759,6 +759,7 @@ #define STRING_INVALID_SORT_COL "La columna '{1}' no es un campo de ordenación válido." #define STRING_TLS_INIT_FAIL "Error inicializando TLS. {1}" #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 support by this command." #define STRING_ERROR_NO_MODS "Command line modifications are not support by this command." // Feedback diff --git a/src/l10n/fra-FRA.h b/src/l10n/fra-FRA.h index 09478cbe1..0b8e3c7f3 100644 --- a/src/l10n/fra-FRA.h +++ b/src/l10n/fra-FRA.h @@ -747,6 +747,7 @@ #define STRING_INVALID_SORT_COL "The '{1}' column is not a valid sort field." #define STRING_TLS_INIT_FAIL "Erreur en initialisant TLS. {1}" #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 support by this command." #define STRING_ERROR_NO_MODS "Command line modifications are not support by this command." // Feedback diff --git a/src/l10n/ita-ITA.h b/src/l10n/ita-ITA.h index 0154456d8..b69e7bd0e 100644 --- a/src/l10n/ita-ITA.h +++ b/src/l10n/ita-ITA.h @@ -746,6 +746,7 @@ #define STRING_INVALID_SORT_COL "La colonna '{1}' non è un campo di ordinamento valido." #define STRING_TLS_INIT_FAIL "Error initializing TLS. {1}" #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 support by this command." #define STRING_ERROR_NO_MODS "Command line modifications are not support by this command." // Feedback diff --git a/src/l10n/jpn-JPN.h b/src/l10n/jpn-JPN.h index f39fabc90..258b12408 100644 --- a/src/l10n/jpn-JPN.h +++ b/src/l10n/jpn-JPN.h @@ -747,6 +747,7 @@ #define STRING_INVALID_SORT_COL "The '{1}' column is not a valid sort field." #define STRING_TLS_INIT_FAIL "TLS初期化でエラー。 {1}" #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 support by this command." #define STRING_ERROR_NO_MODS "Command line modifications are not support by this command." // Feedback diff --git a/src/l10n/pol-POL.h b/src/l10n/pol-POL.h index d14996444..a3985e33c 100644 --- a/src/l10n/pol-POL.h +++ b/src/l10n/pol-POL.h @@ -747,6 +747,7 @@ #define STRING_INVALID_SORT_COL "Kolumna '{1}' nie jest poprawnym parametrem sortowania." #define STRING_TLS_INIT_FAIL "Błąd inicjalizacji TLS." #define STRING_ERROR_DETAILS "Zmienna 'calendar.details.report' musi zawierać nazwę raportu." +#define STRING_ERROR_NO_FILTER "Command line filters are not support by this command." #define STRING_ERROR_NO_MODS "Command line modifications are not support by this command." // Feedback diff --git a/src/l10n/por-PRT.h b/src/l10n/por-PRT.h index 7532f3746..46e8d3141 100644 --- a/src/l10n/por-PRT.h +++ b/src/l10n/por-PRT.h @@ -747,6 +747,7 @@ #define STRING_INVALID_SORT_COL "A coluna '{1}' não pode ser ordenada." #define STRING_TLS_INIT_FAIL "Erro a iniciar componente TLS. {1}" #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 support by this command." #define STRING_ERROR_NO_MODS "Command line modifications are not support by this command." // Feedback