From 378230eaa955d6915ad2a1b7792855595b598e05 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Sun, 10 Jan 2016 12:09:30 +0100 Subject: make it possible to enter itneractive mode from a script use case -> you want to set the default log and debug levels away from the defaults and then go into interactive mode: set logging warning go_interactive --- akonadish/main.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'akonadish') diff --git a/akonadish/main.cpp b/akonadish/main.cpp index af85a94..4c00b9b 100644 --- a/akonadish/main.cpp +++ b/akonadish/main.cpp @@ -39,6 +39,10 @@ int enterRepl() { + if (State::hasEventLoop()) { + return 0; + } + Repl *repl = new Repl; QObject::connect(repl, &QStateMachine::finished, repl, &QObject::deleteLater); @@ -51,8 +55,21 @@ int enterRepl() return rv; } +bool goInteractive(const QStringList &, State &) +{ + enterRepl(); + return true; +} + +Syntax::List goInteractiveSyntax() +{ + Syntax interactive("go_interactive", QString(), &goInteractive); + return Syntax::List() << interactive; +} + void processCommandStream(QTextStream &stream) { + SyntaxTree::self()->registerSyntax(&goInteractiveSyntax); QString line = stream.readLine(); while (!line.isEmpty()) { line = line.trimmed(); -- cgit v1.2.3