2014-10-18 19:31:52 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* Icinga 2 *
|
2018-01-02 12:06:00 +01:00
|
|
|
* Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/) *
|
2014-10-18 19:31:52 +02:00
|
|
|
* *
|
|
|
|
* 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 St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef FEATUREUTILITY_H
|
|
|
|
#define FEATUREUTILITY_H
|
|
|
|
|
|
|
|
#include "base/i2-base.hpp"
|
2015-02-26 11:04:57 +01:00
|
|
|
#include "cli/i2-cli.hpp"
|
2014-10-19 14:48:19 +02:00
|
|
|
#include "base/string.hpp"
|
2014-10-18 19:31:52 +02:00
|
|
|
#include <vector>
|
2015-02-15 13:09:53 +01:00
|
|
|
#include <iostream>
|
2014-10-18 19:31:52 +02:00
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup cli
|
|
|
|
*/
|
2017-12-31 07:22:16 +01:00
|
|
|
class FeatureUtility
|
2014-10-18 19:31:52 +02:00
|
|
|
{
|
|
|
|
public:
|
2018-01-04 04:25:35 +01:00
|
|
|
static String GetFeaturesAvailablePath();
|
|
|
|
static String GetFeaturesEnabledPath();
|
2014-10-18 19:31:52 +02:00
|
|
|
|
2014-10-21 18:35:43 +02:00
|
|
|
static std::vector<String> GetFieldCompletionSuggestions(const String& word, bool enable);
|
|
|
|
|
2018-06-05 13:43:10 +02:00
|
|
|
static int EnableFeatures(const std::vector<std::string>& features, bool quiet = false);
|
|
|
|
static int DisableFeatures(const std::vector<std::string>& features, bool quiet = false);
|
2015-01-22 12:10:32 +01:00
|
|
|
static int ListFeatures(std::ostream& os = std::cout);
|
2014-10-21 18:35:43 +02:00
|
|
|
|
|
|
|
static bool GetFeatures(std::vector<String>& features, bool enable);
|
2015-06-25 10:14:19 +02:00
|
|
|
static bool CheckFeatureEnabled(const String& feature);
|
|
|
|
static bool CheckFeatureDisabled(const String& feature);
|
2014-10-21 18:35:43 +02:00
|
|
|
|
2014-10-18 19:31:52 +02:00
|
|
|
private:
|
2018-01-04 04:25:35 +01:00
|
|
|
FeatureUtility();
|
2014-10-18 19:31:52 +02:00
|
|
|
static void CollectFeatures(const String& feature_file, std::vector<String>& features);
|
2015-06-25 10:14:19 +02:00
|
|
|
static bool CheckFeatureInternal(const String& feature, bool check_disabled);
|
2014-10-18 19:31:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* FEATUREUTILITY_H */
|