summaryrefslogtreecommitdiffstats
path: root/sinksh/syntax_modules/sink_info.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sinksh/syntax_modules/sink_info.cpp')
-rw-r--r--sinksh/syntax_modules/sink_info.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/sinksh/syntax_modules/sink_info.cpp b/sinksh/syntax_modules/sink_info.cpp
new file mode 100644
index 0000000..aa515e6
--- /dev/null
+++ b/sinksh/syntax_modules/sink_info.cpp
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2017 Christian Mollekopf <mollekopf@kolabsys.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#include <QDebug>
21#include <QObject> // tr()
22
23#include "common/definitions.h"
24
25#include "sinksh_utils.h"
26#include "state.h"
27#include "syntaxtree.h"
28#include "sink_version.h"
29
30namespace SinkInfo
31{
32
33bool info(const QStringList &args, State &state)
34{
35 state.printLine(QString("Sink version: %1").arg(sink_VERSION_STRING));
36 state.printLine(QString("Storage location: %1").arg(Sink::storageLocation()));
37 state.printLine(QString("Data location: %1").arg(Sink::dataLocation()));
38 state.printLine(QString("Config location: %1").arg(Sink::configLocation()));
39 state.printLine(QString("Temporary file location: %1").arg(Sink::temporaryFileLocation()));
40 state.printLine(QString("Resource storage location: %1").arg(Sink::resourceStorageLocation("$RESOURCE")));
41 return false;
42}
43
44Syntax::List syntax()
45{
46 return Syntax::List() << Syntax{"info", QObject::tr("Shows general system info"), &SinkInfo::info, Syntax::NotInteractive};
47}
48
49REGISTER_SYNTAX(SinkInfo)
50
51}