From: José Iván López González Date: Wed, 30 Oct 2019 23:18:19 +0000 (+0000) Subject: Add ListConfigs command X-Git-Tag: v0.8.6~10^2~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ce14959576c4b94d7fd439eb46e8fcdb2debabad;p=thirdparty%2Fsnapper.git Add ListConfigs command --- diff --git a/client/Command/ListConfigs.cc b/client/Command/ListConfigs.cc new file mode 100644 index 00000000..5f070e57 --- /dev/null +++ b/client/Command/ListConfigs.cc @@ -0,0 +1,115 @@ +/* + * Copyright (c) [2019] 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. + */ + +#include + +#include "client/utils/text.h" +#include "client/Command/ListConfigs.h" +#include "client/Command/ListConfigs/Options.h" +#include "client/Command/ListConfigs/SnappersData/Table.h" +#include "client/Command/ListConfigs/SnappersData/Csv.h" +#include "client/Command/ListConfigs/SnappersData/Json.h" + +using namespace std; + +namespace snapper +{ + namespace cli + { + + string Command::ListConfigs::help() + { + return + string( + _(" List configs:\n" + "\tsnapper list-configs\n" + "\n") + ) + Options::help_text(); + } + + + Command::ListConfigs::ListConfigs(const GlobalOptions& global_options, + GetOpts& options_parser, ProxySnappers& snappers) : + Command(global_options, options_parser, snappers), _options(new Options(options_parser)) + {} + + + Command::ListConfigs::ListConfigs::~ListConfigs() + {} + + + const Command::ListConfigs::Options& Command::ListConfigs::options() const + { + return *_options.get(); + } + + + vector Command::ListConfigs::errors() const + { + return options().errors(); + } + + + void Command::ListConfigs::run() + { + if (_options_parser.hasArgs()) + { + cerr << _("Command 'list-configs' does not take arguments.") << endl; + exit(EXIT_FAILURE); + } + + if (options().has_errors()) + { + cerr << options().errors().front() << endl; + exit(EXIT_FAILURE); + } + + string output; + + switch (global_options().output_format()) + { + case GlobalOptions::OutputFormat::TABLE: + { + SnappersData::Table table(*this, global_options().table_style()); + output = table.output(); + } + break; + + case GlobalOptions::OutputFormat::CSV: + { + SnappersData::Csv csv(*this, global_options().separator()); + output = csv.output(); + } + break; + + case GlobalOptions::OutputFormat::JSON: + { + SnappersData::Json json(*this); + output = json.output() + "\n"; + } + break; + } + + cout << output; + } + + } +} diff --git a/client/Command/ListConfigs.h b/client/Command/ListConfigs.h new file mode 100644 index 00000000..25e805ee --- /dev/null +++ b/client/Command/ListConfigs.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) [2019] 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. + */ + +#ifndef SNAPPER_CLI_COMMAND_LIST_CONFIGS_H +#define SNAPPER_CLI_COMMAND_LIST_CONFIGS_H + +#include + +#include "client/Command.h" +#include "client/proxy.h" + +namespace snapper +{ + namespace cli + { + + class Command::ListConfigs : public Command + { + + public: + + class Options; + + class ColumnsOption; + + class SnappersData; + + static std::string help(); + + ListConfigs(const GlobalOptions& global_options, GetOpts& options_parser, + ProxySnappers& snappers); + + const Options& options() const; + + virtual std::vector errors() const override; + + virtual void run() override; + + virtual ~ListConfigs(); + + private: + + std::unique_ptr _options; + }; + + } +} + +#endif diff --git a/client/Command/ListConfigs/Makefile.am b/client/Command/ListConfigs/Makefile.am new file mode 100644 index 00000000..c8cf730c --- /dev/null +++ b/client/Command/ListConfigs/Makefile.am @@ -0,0 +1,19 @@ +# +# Makefile.am for snapper/client/Command/ListConfigs +# + +SUBDIRS = SnappersData + +AM_CPPFLAGS = -I$(top_srcdir) $(DBUS_CFLAGS) + +noinst_LTLIBRARIES = libcommandlistconfigs.la + +libcommandlistconfigs_la_SOURCES = \ + Options.cc Options.h \ + SnappersData.cc SnappersData.h + +libcommandlistconfigs_la_LIBADD = \ + ../../../snapper/libsnapper.la \ + ../../utils/libutils.la \ + ../../../dbus/libdbus.la \ + SnappersData/libcommandlistconfigssnappersdata.la diff --git a/client/Command/ListConfigs/Options.cc b/client/Command/ListConfigs/Options.cc new file mode 100644 index 00000000..8403e996 --- /dev/null +++ b/client/Command/ListConfigs/Options.cc @@ -0,0 +1,104 @@ +/* + * Copyright (c) [2019] 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. + */ + +#include + +#include "client/Command/ListConfigs/Options.h" +#include "client/utils/text.h" + +using namespace std; + +namespace snapper +{ + namespace cli + { + + namespace + { + + const option OPTIONS[] = { + { "columns", required_argument, 0, 0}, + { 0, 0, 0, 0 } + }; + + } + + + const string Command::ListConfigs::Options::Columns::CONFIG = "config"; + const string Command::ListConfigs::Options::Columns::SUBVOLUME = "subvolume"; + + + const vector Command::ListConfigs::Options::ALL_COLUMNS = { + Columns::CONFIG, + Columns::SUBVOLUME + }; + + + string Command::ListConfigs::Options::help_text() + { + return _(" Options for 'list-configs' command:\n" + "\t--columns \t\tColumns to show separated by comma.\n" + "\t\t\t\t\tPossible columns: config, subvolume.\n"); + } + + + Command::ListConfigs::Options::Options(GetOpts& parser) : + cli::Options(parser), _columns_option(ALL_COLUMNS) + { + parse_options(); + + _columns_option.set_raw_columns(columns_raw()); + } + + + void Command::ListConfigs::Options::parse_options() + { + _options = _parser.parse("list-configs", OPTIONS); + } + + + vector Command::ListConfigs::Options::columns() const + { + if (has_option("columns")) + return _columns_option.selected_columns(); + + return { Columns::CONFIG, Columns::SUBVOLUME }; + } + + + vector Command::ListConfigs::Options::errors() const + { + vector detected_errors; + + if (!_columns_option.wrong_columns().empty()) + detected_errors.push_back(_columns_option.error()); + + return detected_errors; + } + + + string Command::ListConfigs::Options::columns_raw() const + { + return has_option("columns") ? get_option("columns")->second : ""; + } + + } +} diff --git a/client/Command/ListConfigs/Options.h b/client/Command/ListConfigs/Options.h new file mode 100644 index 00000000..531e8dd9 --- /dev/null +++ b/client/Command/ListConfigs/Options.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) [2019] 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. + */ + +#ifndef SNAPPER_CLI_COMMAND_LIST_CONFIGS_OPTIONS_H +#define SNAPPER_CLI_COMMAND_LIST_CONFIGS_OPTIONS_H + +#include "client/Options.h" +#include "client/Command/ListConfigs.h" +#include "client/Command/ColumnsOption.h" + +namespace snapper +{ + namespace cli + { + + class Command::ListConfigs::Options : public cli::Options + { + + public: + + struct Columns + { + static const std::string CONFIG; + static const std::string SUBVOLUME; + }; + + static const std::vector ALL_COLUMNS; + + static std::string help_text(); + + Options(GetOpts& parser); + + std::vector columns() const; + + virtual std::vector errors() const override; + + private: + + void parse_options(); + + string columns_raw() const; + + Command::ColumnsOption _columns_option; + + }; + + } +} + +#endif diff --git a/client/Command/ListConfigs/SnappersData.cc b/client/Command/ListConfigs/SnappersData.cc new file mode 100644 index 00000000..2d4da198 --- /dev/null +++ b/client/Command/ListConfigs/SnappersData.cc @@ -0,0 +1,81 @@ +/* + * Copyright (c) [2019] 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. + */ + +#include "client/Command/ListConfigs.h" +#include "client/Command/ListConfigs/Options.h" +#include "client/Command/ListConfigs/SnappersData.h" + +using namespace std; + +namespace snapper +{ + namespace cli + { + + Command::ListConfigs::SnappersData::SnappersData(const Command::ListConfigs& command) : + _command(command) + {} + + + Command::ListConfigs::SnappersData::~SnappersData() + {} + + + string Command::ListConfigs::SnappersData::value_for(const string& column, + ProxySnapper* snapper) const + { + if (column == Options::Columns::CONFIG) + return snapper->configName(); + + if (column == Options::Columns::SUBVOLUME) + return snapper->getConfig().getSubvolume(); + + return ""; + } + + + vector Command::ListConfigs::SnappersData::snappers() const + { + vector snappers; + + for (auto config_name : configs()) + { + ProxySnapper* snapper = _command.snappers().getSnapper(config_name); + + snappers.push_back(snapper); + } + + return snappers; + } + + + vector Command::ListConfigs::SnappersData::configs() const + { + vector names; + + for (map::value_type it : _command.snappers().getConfigs()) + names.push_back(it.first); + + return names; + } + + } +} diff --git a/client/Command/ListConfigs/SnappersData.h b/client/Command/ListConfigs/SnappersData.h new file mode 100644 index 00000000..ab581c99 --- /dev/null +++ b/client/Command/ListConfigs/SnappersData.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) [2019] 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. + */ + +#ifndef SNAPPER_CLI_COMMAND_LIST_CONFIGS_SNAPPERS_DATA_H +#define SNAPPER_CLI_COMMAND_LIST_CONFIGS_SNAPPERS_DATA_H + +#include +#include + +#include "client/Command/ListConfigs.h" +#include "client/proxy.h" + +namespace snapper +{ + namespace cli + { + + class Command::ListConfigs::SnappersData + { + + public: + + class Table; + + class Csv; + + class Json; + + SnappersData(const Command::ListConfigs& command); + + virtual ~SnappersData(); + + virtual std::string output() const = 0; + + protected: + + std::string value_for(const std::string& column, ProxySnapper* snapper) const; + + std::vector snappers() const; + + private: + + std::vector configs() const; + + const ListConfigs& _command; + }; + + } +} + +#endif diff --git a/client/Command/ListConfigs/SnappersData/Csv.cc b/client/Command/ListConfigs/SnappersData/Csv.cc new file mode 100644 index 00000000..5bd96374 --- /dev/null +++ b/client/Command/ListConfigs/SnappersData/Csv.cc @@ -0,0 +1,66 @@ +/* + * Copyright (c) [2019] 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. + */ + +#include + +#include "client/Command/ListConfigs/SnappersData/Csv.h" +#include "client/Command/ListConfigs/Options.h" +#include "client/utils/CsvFormatter.h" + +using namespace std; + +namespace snapper +{ + namespace cli + { + + Command::ListConfigs::SnappersData::Csv::Csv( + const Command::ListConfigs& command, const string separator) : + SnappersData(command), _separator(separator) + {} + + + std::string Command::ListConfigs::SnappersData::Csv::output() const + { + vector columns; + + vector> rows; + + for (const string& column : _command.options().columns()) + columns.push_back(column); + + for (ProxySnapper* snapper : snappers()) + { + vector row; + + for (const string& column : _command.options().columns()) + row.push_back(value_for(column, snapper)); + + rows.push_back(row); + } + + CsvFormatter formatter(columns, rows, _separator); + + return formatter.output(); + } + + } +} diff --git a/client/Command/ListConfigs/SnappersData/Csv.h b/client/Command/ListConfigs/SnappersData/Csv.h new file mode 100644 index 00000000..220fdc1c --- /dev/null +++ b/client/Command/ListConfigs/SnappersData/Csv.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) [2019] 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. + */ + +#ifndef SNAPPER_CLI_COMMAND_LIST_CONFIGS_SNAPPERS_DATA_CSV_H +#define SNAPPER_CLI_COMMAND_LIST_CONFIGS_SNAPPERS_DATA_CSV_H + +#include + +#include "client/Command/ListConfigs/SnappersData.h" + +namespace snapper +{ + namespace cli + { + + class Command::ListConfigs::SnappersData::Csv : public Command::ListConfigs::SnappersData + { + + public: + + Csv(const ListConfigs& command, const std::string separator); + + virtual std::string output() const override; + + private: + + const std::string _separator; + }; + + } +} + +#endif diff --git a/client/Command/ListConfigs/SnappersData/Json.cc b/client/Command/ListConfigs/SnappersData/Json.cc new file mode 100644 index 00000000..8206c0f6 --- /dev/null +++ b/client/Command/ListConfigs/SnappersData/Json.cc @@ -0,0 +1,84 @@ +/* + * Copyright (c) [2019] 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. + */ + +#include "client/Command/ListConfigs/SnappersData/Json.h" +#include "client/Command/ListConfigs/Options.h" +#include "client/utils/JsonFormatter.h" + +using namespace std; + +namespace snapper +{ + namespace cli + { + + namespace + { + + const string SNAPPERS_KEY = "configs"; + + } + + + std::string Command::ListConfigs::SnappersData::Json::output() const + { + JsonFormatter::Data data; + + data.emplace_back(SNAPPERS_KEY, snappers_json()); + + JsonFormatter formatter(data); + + formatter.skip_format_values({ SNAPPERS_KEY }); + + return formatter.output(); + } + + + string + Command::ListConfigs::SnappersData::Json::snappers_json() const + { + vector data; + + for (ProxySnapper* snapper : snappers()) + { + data.push_back(snapper_json(snapper)); + } + + JsonFormatter::List json_list(data); + + return json_list.output(1); + } + + + string Command::ListConfigs::SnappersData::Json::snapper_json(ProxySnapper* snapper) const + { + JsonFormatter::Data data; + + for (const string& column : _command.options().columns()) + data.emplace_back(column, value_for(column, snapper)); + + JsonFormatter formatter(data); + + return formatter.output(2); + } + + } +} diff --git a/client/Command/ListConfigs/SnappersData/Json.h b/client/Command/ListConfigs/SnappersData/Json.h new file mode 100644 index 00000000..0f10699e --- /dev/null +++ b/client/Command/ListConfigs/SnappersData/Json.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) [2019] 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. + */ + +#ifndef SNAPPER_CLI_COMMAND_LIST_CONFIGS_SNAPPERS_DATA_JSON_H +#define SNAPPER_CLI_COMMAND_LIST_CONFIGS_SNAPPERS_DATA_JSON_H + +#include +#include + +#include "client/Command/ListConfigs/SnappersData.h" +#include "client/proxy.h" + +namespace snapper +{ + namespace cli + { + + class Command::ListConfigs::SnappersData::Json : public Command::ListConfigs::SnappersData + { + + public: + + using Command::ListConfigs::SnappersData::SnappersData; + + virtual std::string output() const override; + + private: + + std::string snappers_json() const; + + std::string snapper_json(ProxySnapper* snapper) const; + + }; + + } +} + +#endif diff --git a/client/Command/ListConfigs/SnappersData/Makefile.am b/client/Command/ListConfigs/SnappersData/Makefile.am new file mode 100644 index 00000000..fd23dfed --- /dev/null +++ b/client/Command/ListConfigs/SnappersData/Makefile.am @@ -0,0 +1,17 @@ +# +# Makefile.am for snapper/client/Command/ListConfigs/SnappersData +# + +AM_CPPFLAGS = -I$(top_srcdir) $(DBUS_CFLAGS) + +noinst_LTLIBRARIES = libcommandlistconfigssnappersdata.la + +libcommandlistconfigssnappersdata_la_SOURCES = \ + Table.cc Table.h \ + Csv.cc Csv.h \ + Json.cc Json.h + +libcommandlistconfigssnappersdata_la_LIBADD = \ + ../../../../snapper/libsnapper.la \ + ../../../utils/libutils.la \ + ../../../../dbus/libdbus.la diff --git a/client/Command/ListConfigs/SnappersData/Table.cc b/client/Command/ListConfigs/SnappersData/Table.cc new file mode 100644 index 00000000..62f097b2 --- /dev/null +++ b/client/Command/ListConfigs/SnappersData/Table.cc @@ -0,0 +1,77 @@ +/* + * Copyright (c) [2019] 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. + */ + +#include "client/Command/ListConfigs/SnappersData/Table.h" +#include "client/Command/ListConfigs/Options.h" +#include "client/utils/TableFormatter.h" +#include "client/utils/text.h" + +using namespace std; + +namespace snapper +{ + namespace cli + { + + Command::ListConfigs::SnappersData::Table::Table( + const Command::ListConfigs& command, TableLineStyle style) : + SnappersData(command), _style(style) + {} + + + string Command::ListConfigs::SnappersData::Table::output() const + { + vector> columns; + + vector> rows; + + for (const string& column : _command.options().columns()) + columns.emplace_back(label_for(column), TableAlign::LEFT); + + for (ProxySnapper* snapper : snappers()) + { + vector row; + + for (auto attribute : _command.options().columns()) + row.push_back(value_for(attribute, snapper)); + + rows.push_back(row); + } + + TableFormatter formatter(columns, rows, _style); + + return formatter.output(); + } + + + string Command::ListConfigs::SnappersData::Table::label_for(const string& column) const + { + if (column == Options::Columns::CONFIG) + return _("Config"); + + if (column == Options::Columns::SUBVOLUME) + return _("Subvolume"); + + return ""; + } + + } +} diff --git a/client/Command/ListConfigs/SnappersData/Table.h b/client/Command/ListConfigs/SnappersData/Table.h new file mode 100644 index 00000000..13d2aeea --- /dev/null +++ b/client/Command/ListConfigs/SnappersData/Table.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) [2019] 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. + */ + +#ifndef SNAPPER_CLI_COMMAND_LIST_CONFIGS_SNAPPERS_DATA_TABLE_H +#define SNAPPER_CLI_COMMAND_LIST_CONFIGS_SNAPPERS_DATA_TABLE_H + +#include + +#include "client/Command/ListConfigs/SnappersData.h" +#include "client/utils/Table.h" + +namespace snapper +{ + namespace cli + { + + class Command::ListConfigs::SnappersData::Table : public Command::ListConfigs::SnappersData + { + + public: + + Table(const ListConfigs& command, TableLineStyle style); + + virtual std::string output() const override; + + private: + + std::string label_for(const std::string& column) const; + + TableLineStyle _style; + + }; + + } +} + +#endif