summaryrefslogtreecommitdiffstats
path: root/akonadish/syntax_modules/core_syntax.cpp
diff options
context:
space:
mode:
authorAaron Seigo <aseigo@kde.org>2015-12-24 16:23:46 +0100
committerAaron Seigo <aseigo@kde.org>2015-12-24 16:23:46 +0100
commit8b397cec29460e2cb53b9be02b4e53da9cce60c9 (patch)
tree430191293848e5a8051a99a00634ea685c101d53 /akonadish/syntax_modules/core_syntax.cpp
parentb352f61f136f21854b3da5b76d49fe45cbb2d3fd (diff)
downloadsink-8b397cec29460e2cb53b9be02b4e53da9cce60c9.tar.gz
sink-8b397cec29460e2cb53b9be02b4e53da9cce60c9.zip
bye-bye header files
the function-centric approach simply does not require them!
Diffstat (limited to 'akonadish/syntax_modules/core_syntax.cpp')
-rw-r--r--akonadish/syntax_modules/core_syntax.cpp49
1 files changed, 25 insertions, 24 deletions
diff --git a/akonadish/syntax_modules/core_syntax.cpp b/akonadish/syntax_modules/core_syntax.cpp
index 8fb1448..a0cd4c6 100644
--- a/akonadish/syntax_modules/core_syntax.cpp
+++ b/akonadish/syntax_modules/core_syntax.cpp
@@ -17,37 +17,16 @@
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */ 18 */
19 19
20#include "core_syntax.h"
21
22#include <QDebug> 20#include <QDebug>
23#include <QObject> // tr() 21#include <QObject> // tr()
24#include <QSet> 22#include <QSet>
25#include <QTextStream> 23#include <QTextStream>
26 24
27namespace CoreSyntax 25#include "state.h"
28{ 26#include "syntaxtree.h"
29
30REGISTER_SYNTAX(CoreSyntax)
31 27
32Syntax::List syntax() 28namespace CoreSyntax
33{ 29{
34 Syntax::List syntax;
35 syntax << Syntax("exit", QObject::tr("Exits the application. Ctrl-d also works!"), &CoreSyntax::exit);
36
37 Syntax help(QObject::tr("help"), QObject::tr("Print command information: help [command]"), &CoreSyntax::showHelp);
38 help.completer = &CoreSyntax::showHelpCompleter;
39 syntax << help;
40
41 Syntax set(QObject::tr("set"), QObject::tr("Sets settings for the session"));
42 set.children << Syntax(QObject::tr("debug"), QObject::tr("Set the debug level from 0 to 6"), &CoreSyntax::setDebugLevel);
43 syntax << set;
44
45 Syntax get(QObject::tr("get"), QObject::tr("Gets settings for the session"));
46 get.children << Syntax(QObject::tr("debug"), QObject::tr("Set the debug level from 0 to 6"), &CoreSyntax::printDebugLevel);
47 syntax << get;
48
49 return syntax;
50}
51 30
52bool exit(const QStringList &, State &) 31bool exit(const QStringList &, State &)
53{ 32{
@@ -137,5 +116,27 @@ bool printDebugLevel(const QStringList &commands, State &state)
137 return true; 116 return true;
138} 117}
139 118
119Syntax::List syntax()
120{
121 Syntax::List syntax;
122 syntax << Syntax("exit", QObject::tr("Exits the application. Ctrl-d also works!"), &CoreSyntax::exit);
123
124 Syntax help(QObject::tr("help"), QObject::tr("Print command information: help [command]"), &CoreSyntax::showHelp);
125 help.completer = &CoreSyntax::showHelpCompleter;
126 syntax << help;
127
128 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);
130 syntax << set;
131
132 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);
134 syntax << get;
135
136 return syntax;
137}
138
139REGISTER_SYNTAX(CoreSyntax)
140
140} // namespace CoreSyntax 141} // namespace CoreSyntax
141 142