[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [akonadi-next/develop] akonadish: consistency (and avoids warnings on redirect input)
From: Aaron Seigo <aseigo () kde ! org>
Date: 2015-12-28 21:05:10
Message-ID: E1aDeyc-0004Yd-Bw () scm ! kde ! org
[Download RAW message or body]
Git commit d456572c4178390a1f539e4923023ec331d2cde3 by Aaron Seigo.
Committed on 28/12/2015 at 20:59.
Pushed by aseigo into branch 'develop'.
consistency (and avoids warnings on redirect input)
M +17 -13 akonadish/main.cpp
http://commits.kde.org/akonadi-next/d456572c4178390a1f539e4923023ec331d2cde3
diff --git a/akonadish/main.cpp b/akonadish/main.cpp
index 45bd5ea..f3cbcac 100644
--- a/akonadish/main.cpp
+++ b/akonadish/main.cpp
@@ -48,7 +48,8 @@ int main(int argc, char *argv[])
//qDebug() << "state at startup is" << interactive << startRepl << \
startJsonListener << fromScript;
QCoreApplication app(argc, argv);
- app.setApplicationName(argv[0]);
+ app.setApplicationName(fromScript ? "interactive-app-shell" : \
argv[0]); + //app.setApplicationName(argv[0]);
if (startRepl || startJsonListener) {
if (startRepl) {
@@ -71,26 +72,29 @@ int main(int argc, char *argv[])
return 1;
}
- QString line = f.readLine().trimmed();
+ QString line = f.readLine();
while (!line.isEmpty()) {
- if (line.isEmpty() || line.startsWith('#')) {
- line = f.readLine().trimmed();
- continue;
+ line = line.trimmed();
+
+ if (!line.isEmpty() && !line.startsWith('#')) {
+ SyntaxTree::self()->run(SyntaxTree::tokenize(line));
}
- SyntaxTree::self()->run(SyntaxTree::tokenize(line));
- line = f.readLine().trimmed();
+
+ line = f.readLine();
}
exit(0);
} else if (!interactive) {
QTextStream inputStream(stdin);
- while (true) {
- const QString input = inputStream.readLine();
- if (input.isEmpty()) {
- ::exit(0);
+
+ QString line = inputStream.readLine();
+ while (!line.isEmpty()) {
+ line = line.trimmed();
+
+ if (!line.isEmpty() && !line.startsWith('#')) {
+ SyntaxTree::self()->run(SyntaxTree::tokenize(line));
}
- const QStringList commands = SyntaxTree::tokenize(input);
- SyntaxTree::self()->run(commands);
+ line = inputStream.readLine();
}
} else {
QStringList commands = app.arguments();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic