From 685a16155504831c8b5fdb9a4d0a955b21c807bf Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 2 Aug 2017 12:12:07 -0600 Subject: Info command to print some default information --- sinksh/syntax_modules/sink_info.cpp | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 sinksh/syntax_modules/sink_info.cpp (limited to 'sinksh/syntax_modules/sink_info.cpp') 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 @@ +/* + * Copyright (C) 2017 Christian Mollekopf + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include // tr() + +#include "common/definitions.h" + +#include "sinksh_utils.h" +#include "state.h" +#include "syntaxtree.h" + +namespace SinkInfo +{ + +bool info(const QStringList &args, State &state) +{ + state.printLine(QString("Storage location: %1").arg(Sink::storageLocation())); + state.printLine(QString("Data location: %1").arg(Sink::dataLocation())); + state.printLine(QString("Config location: %1").arg(Sink::configLocation())); + state.printLine(QString("Temporary file location: %1").arg(Sink::temporaryFileLocation())); + state.printLine(QString("Resource storage location: %1").arg(Sink::resourceStorageLocation("$RESOURCE"))); + return false; +} + +Syntax::List syntax() +{ + return Syntax::List() << Syntax{"info", QObject::tr("Shows general system info"), &SinkInfo::info, Syntax::NotInteractive}; +} + +REGISTER_SYNTAX(SinkInfo) + +} -- cgit v1.2.3 From a7c40cd33ba99658ac0c8849622a2b3f3db16de2 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 2 Aug 2017 13:04:59 -0600 Subject: Print version --- sinksh/syntax_modules/sink_info.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sinksh/syntax_modules/sink_info.cpp') diff --git a/sinksh/syntax_modules/sink_info.cpp b/sinksh/syntax_modules/sink_info.cpp index 5f535eb..aa515e6 100644 --- a/sinksh/syntax_modules/sink_info.cpp +++ b/sinksh/syntax_modules/sink_info.cpp @@ -25,12 +25,14 @@ #include "sinksh_utils.h" #include "state.h" #include "syntaxtree.h" +#include "sink_version.h" namespace SinkInfo { bool info(const QStringList &args, State &state) { + state.printLine(QString("Sink version: %1").arg(sink_VERSION_STRING)); state.printLine(QString("Storage location: %1").arg(Sink::storageLocation())); state.printLine(QString("Data location: %1").arg(Sink::dataLocation())); state.printLine(QString("Config location: %1").arg(Sink::configLocation())); -- cgit v1.2.3