mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
CommandLineInterface: Add countEnabledOptions() and joinOptionNames() helpers
This commit is contained in:
parent
b94a00baf6
commit
a806d48ad5
@ -58,6 +58,7 @@
|
|||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/filesystem/operations.hpp>
|
#include <boost/filesystem/operations.hpp>
|
||||||
|
#include <boost/range/adaptor/transformed.hpp>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
#ifdef _WIN32 // windows
|
#ifdef _WIN32 // windows
|
||||||
@ -1879,4 +1880,21 @@ void CommandLineInterface::outputCompilationResults()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t CommandLineInterface::countEnabledOptions(vector<string> const& _optionNames) const
|
||||||
|
{
|
||||||
|
size_t count = 0;
|
||||||
|
for (string const& _option: _optionNames)
|
||||||
|
count += m_args.count(_option);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
string CommandLineInterface::joinOptionNames(vector<string> const& _optionNames, string _separator)
|
||||||
|
{
|
||||||
|
return boost::algorithm::join(
|
||||||
|
_optionNames | boost::adaptors::transformed([](string const& _option){ return "--" + _option; }),
|
||||||
|
_separator
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,9 @@ private:
|
|||||||
/// @arg _json json string to be written
|
/// @arg _json json string to be written
|
||||||
void createJson(std::string const& _fileName, std::string const& _json);
|
void createJson(std::string const& _fileName, std::string const& _json);
|
||||||
|
|
||||||
|
size_t countEnabledOptions(std::vector<std::string> const& _optionNames) const;
|
||||||
|
static std::string joinOptionNames(std::vector<std::string> const& _optionNames, std::string _separator = ", ");
|
||||||
|
|
||||||
bool m_error = false; ///< If true, some error occurred.
|
bool m_error = false; ///< If true, some error occurred.
|
||||||
|
|
||||||
bool m_onlyAssemble = false;
|
bool m_onlyAssemble = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user