diff options
-rw-r--r-- | akonadish/syntaxtree.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/akonadish/syntaxtree.cpp b/akonadish/syntaxtree.cpp index dbbff01..4188e5f 100644 --- a/akonadish/syntaxtree.cpp +++ b/akonadish/syntaxtree.cpp | |||
@@ -65,11 +65,24 @@ bool SyntaxTree::run(const QStringList &commands) | |||
65 | bool success = false; | 65 | bool success = false; |
66 | m_timeElapsed.start(); | 66 | m_timeElapsed.start(); |
67 | Command command = match(commands); | 67 | Command command = match(commands); |
68 | if (command.first && command.first->lambda) { | 68 | if (command.first) { |
69 | success = command.first->lambda(command.second, m_state); | 69 | if (command.first->lambda) { |
70 | if (success && command.first->interactivity == Syntax::EventDriven) { | 70 | success = command.first->lambda(command.second, m_state); |
71 | success = m_state.commandStarted(); | 71 | if (success && command.first->interactivity == Syntax::EventDriven) { |
72 | success = m_state.commandStarted(); | ||
73 | } | ||
74 | } else if (command.first->children.isEmpty()) { | ||
75 | m_state.printError(QObject::tr("Broken command... sorry :("), "st_broken"); | ||
76 | } else { | ||
77 | QStringList keywordList; | ||
78 | for (auto syntax: command.first->children) { | ||
79 | keywordList << syntax.keyword; | ||
80 | } | ||
81 | const QString keywords = keywordList.join(" " ); | ||
82 | m_state.printError(QObject::tr("Command requires additional arguments, one of: %1").arg(keywords)); | ||
72 | } | 83 | } |
84 | } else { | ||
85 | m_state.printError(QObject::tr("Unknown command"), "st_unknown"); | ||
73 | } | 86 | } |
74 | 87 | ||
75 | if (m_state.commandTiming()) { | 88 | if (m_state.commandTiming()) { |