summaryrefslogtreecommitdiffstats
path: root/akonadish/syntax_modules/core_syntax.cpp
diff options
context:
space:
mode:
authorAaron Seigo <aseigo@kde.org>2015-12-25 10:31:30 +0100
committerAaron Seigo <aseigo@kde.org>2015-12-25 10:31:30 +0100
commit908dc9b172a08bfa219a834e15916e9fcfc3c4ec (patch)
treef57bed12c600e56ac2306e811e5030a87fce3772 /akonadish/syntax_modules/core_syntax.cpp
parentad442fb49e5d4271a5f2276eb73d9d15b1e8755f (diff)
downloadsink-908dc9b172a08bfa219a834e15916e9fcfc3c4ec.tar.gz
sink-908dc9b172a08bfa219a834e15916e9fcfc3c4ec.zip
syntax to turn timing on/off
loving the lambdas :)
Diffstat (limited to 'akonadish/syntax_modules/core_syntax.cpp')
-rw-r--r--akonadish/syntax_modules/core_syntax.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/akonadish/syntax_modules/core_syntax.cpp b/akonadish/syntax_modules/core_syntax.cpp
index a0cd4c6..9cd6a6a 100644
--- a/akonadish/syntax_modules/core_syntax.cpp
+++ b/akonadish/syntax_modules/core_syntax.cpp
@@ -110,12 +110,18 @@ bool setDebugLevel(const QStringList &commands, State &state)
110 return true; 110 return true;
111} 111}
112 112
113bool printDebugLevel(const QStringList &commands, State &state) 113bool printDebugLevel(const QStringList &, State &state)
114{ 114{
115 state.printLine(QString::number(state.debugLevel())); 115 state.printLine(QString::number(state.debugLevel()));
116 return true; 116 return true;
117} 117}
118 118
119bool printCommandTiming(const QStringList &, State &state)
120{
121 state.printLine(state.commandTiming() ? QObject::tr("on") : QObject::tr("off"));
122 return true;
123}
124
119Syntax::List syntax() 125Syntax::List syntax()
120{ 126{
121 Syntax::List syntax; 127 Syntax::List syntax;
@@ -127,10 +133,15 @@ Syntax::List syntax()
127 133
128 Syntax set(QObject::tr("set"), QObject::tr("Sets settings for the session")); 134 Syntax set(QObject::tr("set"), QObject::tr("Sets settings for the session"));
129 set.children << Syntax(QObject::tr("debug"), QObject::tr("Set the debug level from 0 to 6"), &CoreSyntax::setDebugLevel); 135 set.children << Syntax(QObject::tr("debug"), QObject::tr("Set the debug level from 0 to 6"), &CoreSyntax::setDebugLevel);
136 Syntax setTiming = Syntax(QObject::tr("timing"), QObject::tr("Whether or not to print the time commands take to complete"));
137 setTiming.children << Syntax(QObject::tr("on"), QString(), [](const QStringList &, State &state) -> bool { state.setCommandTiming(true); return true; });
138 setTiming.children << Syntax(QObject::tr("off"), QString(), [](const QStringList &, State &state) -> bool { state.setCommandTiming(false); return true; });
139 set.children << setTiming;
130 syntax << set; 140 syntax << set;
131 141
132 Syntax get(QObject::tr("get"), QObject::tr("Gets settings for the session")); 142 Syntax get(QObject::tr("get"), QObject::tr("Gets settings for the session"));
133 get.children << Syntax(QObject::tr("debug"), QObject::tr("Set the debug level from 0 to 6"), &CoreSyntax::printDebugLevel); 143 get.children << Syntax(QObject::tr("debug"), QObject::tr("The current debug level from 0 to 6"), &CoreSyntax::printDebugLevel);
144 get.children << Syntax(QObject::tr("timing"), QObject::tr("Whether or not to print the time commands take to complete"), &CoreSyntax::printCommandTiming);
134 syntax << get; 145 syntax << get;
135 146
136 return syntax; 147 return syntax;