From afacd8348bbeefdca7ba98d157d30a9748695a82 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Tue, 8 Oct 2024 11:24:16 +0200 Subject: [PATCH] - make class OutputOptions reusable --- client/snapper/cmd-list.cc | 19 +-------------- client/utils/Makefile.am | 3 ++- client/utils/OutputOptions.h | 45 ++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 client/utils/OutputOptions.h diff --git a/client/snapper/cmd-list.cc b/client/snapper/cmd-list.cc index acb1cd7f..b00f4a30 100644 --- a/client/snapper/cmd-list.cc +++ b/client/snapper/cmd-list.cc @@ -38,6 +38,7 @@ #include "../utils/TableFormatter.h" #include "../utils/CsvFormatter.h" #include "../utils/JsonFormatter.h" +#include "../utils/OutputOptions.h" #include "dbus/DBusMessage.h" #include "../utils/HumanString.h" @@ -77,24 +78,6 @@ namespace snapper enum class ListMode { ALL, SINGLE, PRE_POST }; - /** - * Just a collection of some variables defining the output. - */ - class OutputOptions - { - public: - - OutputOptions(bool utc, bool iso, bool human) - : utc(utc), iso(iso), human(human) - { - } - - const bool utc; - const bool iso; - const bool human; - }; - - /** * Some help for the output, e.g. check if a snapshot is the default or active * snapshot, check if a snapshot should be skipped in the output or check if the diff --git a/client/utils/Makefile.am b/client/utils/Makefile.am index e6a99680..a872192f 100644 --- a/client/utils/Makefile.am +++ b/client/utils/Makefile.am @@ -18,6 +18,7 @@ libutils_la_SOURCES = \ Limit.cc Limit.h \ TableFormatter.cc TableFormatter.h \ CsvFormatter.cc CsvFormatter.h \ - JsonFormatter.cc JsonFormatter.h + JsonFormatter.cc JsonFormatter.h \ + OutputOptions.h libutils_la_LIBADD = ../../snapper/libsnapper.la -ltinfo diff --git a/client/utils/OutputOptions.h b/client/utils/OutputOptions.h new file mode 100644 index 00000000..fccb1c7a --- /dev/null +++ b/client/utils/OutputOptions.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) [2011-2015] Novell, Inc. + * Copyright (c) [2016-2024] SUSE LLC + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * 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, contact Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, you may + * find current contact information at www.novell.com. + */ + + +namespace snapper +{ + + /** + * Just a collection of some variables defining the output. + */ + class OutputOptions + { + public: + + OutputOptions(bool utc, bool iso, bool human) + : utc(utc), iso(iso), human(human) + { + } + + const bool utc; + const bool iso; + const bool human; + + }; + +}