From 26db899f5a12d5ba960e778ce904e279e97481d8 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Fri, 25 Dec 2015 21:15:47 +0100 Subject: a little welcome banner --- akonadish/repl/repl.cpp | 13 +++++++++++++ akonadish/repl/repl.h | 1 + 2 files changed, 14 insertions(+) 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 #include #include +#include #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(); }; -- cgit v1.2.3