summaryrefslogtreecommitdiffstats
path: root/akonadish/syntaxtree.cpp
diff options
context:
space:
mode:
authorAaron Seigo <aseigo@kde.org>2015-12-25 10:31:24 +0100
committerAaron Seigo <aseigo@kde.org>2015-12-25 10:31:24 +0100
commitad442fb49e5d4271a5f2276eb73d9d15b1e8755f (patch)
tree46e469ae1c3524b0369339e5962b434fa9a707a5 /akonadish/syntaxtree.cpp
parentf52da78a2da39974f27faf34915adc6dcb80b4c8 (diff)
downloadsink-ad442fb49e5d4271a5f2276eb73d9d15b1e8755f.tar.gz
sink-ad442fb49e5d4271a5f2276eb73d9d15b1e8755f.zip
support command timing output
Diffstat (limited to 'akonadish/syntaxtree.cpp')
-rw-r--r--akonadish/syntaxtree.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/akonadish/syntaxtree.cpp b/akonadish/syntaxtree.cpp
index 899fc61..dbbff01 100644
--- a/akonadish/syntaxtree.cpp
+++ b/akonadish/syntaxtree.cpp
@@ -62,16 +62,19 @@ Syntax::List SyntaxTree::syntax() const
62 62
63bool SyntaxTree::run(const QStringList &commands) 63bool SyntaxTree::run(const QStringList &commands)
64{ 64{
65 bool success = false;
66 m_timeElapsed.start();
65 Command command = match(commands); 67 Command command = match(commands);
66 if (command.first && command.first->lambda) { 68 if (command.first && command.first->lambda) {
67 bool rv = command.first->lambda(command.second, m_state); 69 success = command.first->lambda(command.second, m_state);
68 if (rv && command.first->interactivity == Syntax::EventDriven) { 70 if (success && command.first->interactivity == Syntax::EventDriven) {
69 return m_state.commandStarted(); 71 success = m_state.commandStarted();
70 } 72 }
71
72 return rv;
73 } 73 }
74 74
75 if (m_state.commandTiming()) {
76 m_state.printLine(QObject::tr("Time elapsed: %1").arg(m_timeElapsed.elapsed()));
77 }
75 return false; 78 return false;
76} 79}
77 80