diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-08-02 12:12:07 -0600 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-08-02 13:05:27 -0600 |
commit | 685a16155504831c8b5fdb9a4d0a955b21c807bf (patch) | |
tree | c61630bc7cc7d484c78786cc4760534ceee368e3 /sinksh/syntax_modules | |
parent | c206c1966e8e99d50ffbd08f45b01e99e140d498 (diff) | |
download | sink-685a16155504831c8b5fdb9a4d0a955b21c807bf.tar.gz sink-685a16155504831c8b5fdb9a4d0a955b21c807bf.zip |
Info command to print some default information
Diffstat (limited to 'sinksh/syntax_modules')
-rw-r--r-- | sinksh/syntax_modules/sink_info.cpp | 49 |
1 files changed, 49 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..5f535eb --- /dev/null +++ b/sinksh/syntax_modules/sink_info.cpp | |||
@@ -0,0 +1,49 @@ | |||
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 | |||
29 | namespace SinkInfo | ||
30 | { | ||
31 | |||
32 | bool info(const QStringList &args, State &state) | ||
33 | { | ||
34 | state.printLine(QString("Storage location: %1").arg(Sink::storageLocation())); | ||
35 | state.printLine(QString("Data location: %1").arg(Sink::dataLocation())); | ||
36 | state.printLine(QString("Config location: %1").arg(Sink::configLocation())); | ||
37 | state.printLine(QString("Temporary file location: %1").arg(Sink::temporaryFileLocation())); | ||
38 | state.printLine(QString("Resource storage location: %1").arg(Sink::resourceStorageLocation("$RESOURCE"))); | ||
39 | return false; | ||
40 | } | ||
41 | |||
42 | Syntax::List syntax() | ||
43 | { | ||
44 | return Syntax::List() << Syntax{"info", QObject::tr("Shows general system info"), &SinkInfo::info, Syntax::NotInteractive}; | ||
45 | } | ||
46 | |||
47 | REGISTER_SYNTAX(SinkInfo) | ||
48 | |||
49 | } | ||