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

List:       kde-commits
Subject:    [akonadi-next/feature/akonadish_gointeractive] akonadish: make it possible to enter itneractive mode
From:       Aaron Seigo <aseigo () kde ! org>
Date:       2016-01-10 11:16:04
Message-ID: E1aIDye-0005fz-TY () scm ! kde ! org
[Download RAW message or body]

Git commit 378230eaa955d6915ad2a1b7792855595b598e05 by Aaron Seigo.
Committed on 10/01/2016 at 11:09.
Pushed by aseigo into branch 'feature/akonadish_gointeractive'.

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

M  +17   -0    akonadish/main.cpp

http://commits.kde.org/akonadi-next/378230eaa955d6915ad2a1b7792855595b598e05

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();
[prev in list] [next in list] [prev in thread] [next in thread] 

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