[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [akonadi-next/feature/new_cli] akonadish/repl: a little welcome banner
From: Aaron Seigo <aseigo () kde ! org>
Date: 2015-12-25 20:20:37
Message-ID: E1aCYqr-0008CD-D1 () scm ! kde ! org
[Download RAW message or body]
Git commit 26db899f5a12d5ba960e778ce904e279e97481d8 by Aaron Seigo.
Committed on 25/12/2015 at 20:15.
Pushed by aseigo into branch 'feature/new_cli'.
a little welcome banner
M +13 -0 akonadish/repl/repl.cpp
M +1 -0 akonadish/repl/repl.h
http://commits.kde.org/akonadi-next/26db899f5a12d5ba960e778ce904e279e97481d8
diff --git a/akonadish/repl/repl.cpp b/akonadish/repl/repl.cpp
index 395661e..499a4af 100644
--- a/akonadish/repl/repl.cpp
+++ b/akonadish/repl/repl.cpp
@@ -25,8 +25,10 @@
#include <QFile>
#include <QFinalState>
#include <QStandardPaths>
+#include <QTextStream>
#include "replStates.h"
+#include "syntaxtree.h"
Repl::Repl(QObject *parent)
: QStateMachine(parent)
@@ -56,6 +58,7 @@ Repl::Repl(QObject *parent)
print->addTransition(print, SIGNAL(completed()), eval);
setInitialState(read);
+ printWelcomeBanner();
start();
}
@@ -65,13 +68,23 @@ Repl::~Repl()
write_history(commandHistoryPath().toLocal8Bit());
}
+void Repl::printWelcomeBanner()
+{
+ QTextStream out(stdout);
+ out << QObject::tr("Welcome to the Akonadi2 interative shell!\n");
+ out << QObject::tr("Type `help` for information on the available commands.\n");
+ out.flush();
+}
+
QString Repl::commandHistoryPath()
{
const QString path = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
+
if (!QFile::exists(path)) {
QDir dir;
dir.mkpath(path);
}
+
return path + "/repl_history";
}
diff --git a/akonadish/repl/repl.h b/akonadish/repl/repl.h
index b76c66b..d8d2533 100644
--- a/akonadish/repl/repl.h
+++ b/akonadish/repl/repl.h
@@ -30,5 +30,6 @@ public:
~Repl();
private:
+ static void printWelcomeBanner();
static QString commandHistoryPath();
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic