[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [akonadi-next/feature/new_cli] akonadish/syntax_modules: syntax to turn timing on/off
From:       Aaron Seigo <aseigo () kde ! org>
Date:       2015-12-25 9:36:38
Message-ID: E1aCOne-0006wv-Th () scm ! kde ! org
[Download RAW message or body]

Git commit 908dc9b172a08bfa219a834e15916e9fcfc3c4ec by Aaron Seigo.
Committed on 25/12/2015 at 09:31.
Pushed by aseigo into branch 'feature/new_cli'.

syntax to turn timing on/off

loving the lambdas :)

M  +13   -2    akonadish/syntax_modules/core_syntax.cpp

http://commits.kde.org/akonadi-next/908dc9b172a08bfa219a834e15916e9fcfc3c4ec

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)
     return true;
 }
 
-bool printDebugLevel(const QStringList &commands, State &state)
+bool printDebugLevel(const QStringList &, State &state)
 {
     state.printLine(QString::number(state.debugLevel()));
     return true;
 }
 
+bool printCommandTiming(const QStringList &, State &state)
+{
+    state.printLine(state.commandTiming() ? QObject::tr("on") : QObject::tr("off"));
+    return true;
+}
+
 Syntax::List syntax()
 {
     Syntax::List syntax;
@@ -127,10 +133,15 @@ Syntax::List syntax()
 
     Syntax set(QObject::tr("set"), QObject::tr("Sets settings for the session"));
     set.children << Syntax(QObject::tr("debug"), QObject::tr("Set the debug level \
from 0 to 6"), &CoreSyntax::setDebugLevel); +    Syntax setTiming = \
Syntax(QObject::tr("timing"), QObject::tr("Whether or not to print the time commands \
take to complete")); +    setTiming.children << Syntax(QObject::tr("on"), QString(), \
[](const QStringList &, State &state) -> bool { state.setCommandTiming(true); return \
true; }); +    setTiming.children << Syntax(QObject::tr("off"), QString(), [](const \
QStringList &, State &state) -> bool { state.setCommandTiming(false); return true; \
}); +    set.children << setTiming;
     syntax << set;
 
     Syntax get(QObject::tr("get"), QObject::tr("Gets settings for the session"));
-    get.children << Syntax(QObject::tr("debug"), QObject::tr("Set the debug level \
from 0 to 6"), &CoreSyntax::printDebugLevel); +    get.children << \
Syntax(QObject::tr("debug"), QObject::tr("The current debug level from 0 to 6"), \
&CoreSyntax::printDebugLevel); +    get.children << Syntax(QObject::tr("timing"), \
QObject::tr("Whether or not to print the time commands take to complete"), \
&CoreSyntax::printCommandTiming);  syntax << get;
 
     return syntax;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic