diff options
-rw-r--r-- | akonadish/main.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
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 @@ | |||
39 | 39 | ||
40 | int enterRepl() | 40 | int enterRepl() |
41 | { | 41 | { |
42 | if (State::hasEventLoop()) { | ||
43 | return 0; | ||
44 | } | ||
45 | |||
42 | Repl *repl = new Repl; | 46 | Repl *repl = new Repl; |
43 | QObject::connect(repl, &QStateMachine::finished, | 47 | QObject::connect(repl, &QStateMachine::finished, |
44 | repl, &QObject::deleteLater); | 48 | repl, &QObject::deleteLater); |
@@ -51,8 +55,21 @@ int enterRepl() | |||
51 | return rv; | 55 | return rv; |
52 | } | 56 | } |
53 | 57 | ||
58 | bool goInteractive(const QStringList &, State &) | ||
59 | { | ||
60 | enterRepl(); | ||
61 | return true; | ||
62 | } | ||
63 | |||
64 | Syntax::List goInteractiveSyntax() | ||
65 | { | ||
66 | Syntax interactive("go_interactive", QString(), &goInteractive); | ||
67 | return Syntax::List() << interactive; | ||
68 | } | ||
69 | |||
54 | void processCommandStream(QTextStream &stream) | 70 | void processCommandStream(QTextStream &stream) |
55 | { | 71 | { |
72 | SyntaxTree::self()->registerSyntax(&goInteractiveSyntax); | ||
56 | QString line = stream.readLine(); | 73 | QString line = stream.readLine(); |
57 | while (!line.isEmpty()) { | 74 | while (!line.isEmpty()) { |
58 | line = line.trimmed(); | 75 | line = line.trimmed(); |