diff options
author | Aaron Seigo <aseigo@kde.org> | 2015-12-23 23:19:15 +0100 |
---|---|---|
committer | Aaron Seigo <aseigo@kde.org> | 2015-12-23 23:19:15 +0100 |
commit | 3e701d9387cf4ea5107893ef9d1018900aa73d74 (patch) | |
tree | 69d05f36d86ff2e0a42d099631818b417bc685f5 | |
parent | a638c410ad83f8d8fe236c1500beaf63d69cbac6 (diff) | |
download | sink-3e701d9387cf4ea5107893ef9d1018900aa73d74.tar.gz sink-3e701d9387cf4ea5107893ef9d1018900aa73d74.zip |
piping now works
-rw-r--r-- | akonadi2_cli/main.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/akonadi2_cli/main.cpp b/akonadi2_cli/main.cpp index 91936c3..695fb82 100644 --- a/akonadi2_cli/main.cpp +++ b/akonadi2_cli/main.cpp | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <QCoreApplication> | 22 | #include <QCoreApplication> |
23 | #include <QDebug> | 23 | #include <QDebug> |
24 | #include <QTextStream> | ||
24 | 25 | ||
25 | #include "syntaxtree.h" | 26 | #include "syntaxtree.h" |
26 | // #include "jsonlistener.h" | 27 | // #include "jsonlistener.h" |
@@ -60,9 +61,20 @@ int main(int argc, char *argv[]) | |||
60 | } | 61 | } |
61 | 62 | ||
62 | return app.exec(); | 63 | return app.exec(); |
63 | } | 64 | } else if (!interactive) { |
65 | QTextStream inputStream(stdin); | ||
66 | while (true) { | ||
67 | const QString input = inputStream.readLine(); | ||
68 | if (input.isEmpty()) { | ||
69 | ::exit(0); | ||
70 | } | ||
64 | 71 | ||
65 | QStringList commands = app.arguments(); | 72 | const QStringList commands = SyntaxTree::tokenize(input); |
66 | commands.removeFirst(); | 73 | SyntaxTree::self()->run(commands); |
67 | return SyntaxTree::self()->run(commands); | 74 | } |
75 | } else { | ||
76 | QStringList commands = app.arguments(); | ||
77 | commands.removeFirst(); | ||
78 | return SyntaxTree::self()->run(commands); | ||
79 | } | ||
68 | } | 80 | } |