21 std::pair<std::string, std::string>>
const block_parameters = {
32 std::vector<art::detail::PluginMetadata>
33 matchesBySpec(std::string
const& specified_plugin_type,
34 std::string
const& instance_pattern)
36 std::vector<PluginMetadata>
result;
37 auto collect_metadata = [&
result,
38 &instance_pattern](std::string
const& suffix) {
42 std::string header_label{
"plugin_type"};
43 std::string param_to_replace{
"plugin_type"};
44 auto params = block_parameters.find(suffix);
47 param_to_replace =
params->second.second;
51 back_inserter(result),
52 [&mc, &header_label, ¶m_to_replace](
auto const&
info) {
53 return mc->collect(
info,
indent__2(), header_label, param_to_replace);
57 if (specified_plugin_type.empty()) {
61 collect_metadata(suffix);
64 collect_metadata(specified_plugin_type);
69 using Duplicates_t = std::map<std::string, std::vector<std::string>>;
71 duplicates_message(std::string
const& suffix, Duplicates_t
const& duplicates)
74 std::string
const type_spec =
77 <<
indent0() <<
"The " << suffix
78 <<
"s marked '*' above are degenerate--i.e. specifying the short\n" 80 <<
" value leads to an ambiguity. In order to use a degenerate\n" 82 <<
", in your configuration file, give the long specification (as\n" 84 <<
"shown in the table below), surrounded by quotation (\") marks.\n\n";
85 std::size_t
const firstColW{
86 columnWidth(duplicates, &Duplicates_t::value_type::first,
"module_type")};
88 <<
std::left <<
"Long specification" <<
'\n';
89 cout <<
indent0() << fixed_rule(
'-') <<
'\n';
90 for (
auto const& dup : duplicates) {
91 auto const& long_specs = dup.second;
93 << std::left << long_specs[0] <<
'\n';
94 for (
auto it = long_specs.begin() + 1,
end = long_specs.end(); it !=
end;
106 std::string
const& spec,
111 cout <<
"Unable to find any plugins with suffix '" << suffix <<
"'.\n";
120 <<
ms->header() <<
'\n' 121 << rule(
'-') <<
'\n';
124 Duplicates_t duplicates;
125 for (
auto const&
info : coll) {
129 duplicates[
info.short_spec()].push_back(
info.long_spec());
131 cout << rule(
'=') <<
"\n\n";
133 if (duplicates.empty())
136 duplicates_message(suffix, duplicates);
142 std::string
const& spec,
143 std::string
const&
key)
148 throw e << (spec.empty() ?
"[Missing specification]" :
150 <<
" did not match any plugin.\n";
151 }
else if (coll.size() > 1ull) {
153 <<
"When querying plugin configurations, the plugin specification\n" 154 <<
"must resolve to a unique library.\n";
156 if (
auto config = coll.begin()->allowed_config()) {
166 for (
auto const&
m : matches) {
167 cout <<
m.header() <<
m.details() <<
m.allowed_configuration();
168 cout <<
'\n' << fixed_rule(
'=') <<
"\n\n";
173 std::pair<std::string, std::string>
174 parse_specified_plugin(std::string
const& spec)
181 std::string specified_plugin_type{};
182 std::string instance_pattern{spec};
183 auto const pos = spec.find(
":");
184 if (
pos != std::string::npos) {
185 specified_plugin_type = spec.substr(0,
pos);
186 if (specified_plugin_type.empty()) {
188 "Error while parsing specified plugins:\n"}
189 <<
"The specification '" << spec
190 <<
"' is missing a module type before the colon (':').\n" 191 "If you intend to search through all plugin types, remove the " 192 "colon; otherwise specify\n" 193 "one of the following plugin types:" 196 instance_pattern = spec.substr(
pos + 1);
198 return std::make_pair(
move(specified_plugin_type),
move(instance_pattern));
205 cout <<
'\n' << fixed_rule(
'=') <<
"\n\n";
206 for (
auto const& spec : specs) {
207 auto const [plugin_type, instance_pattern] = parse_specified_plugin(spec);
209 auto matches = matchesBySpec(plugin_type, instance_pattern);
212 << (instance_pattern.empty() ?
"[Missing specification]" :
214 <<
" did not match any plugin";
215 cout << (plugin_type.empty() ?
"" :
" of type '" + plugin_type +
"'");
217 cout <<
'\n' << fixed_rule(
'=') <<
"\n\n";
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
static std::string const & mfStatsPlugin()
LibraryInfoCollection get_LibraryInfoCollection(std::string const &suffix, std::string const &pattern, bool verbose=false)
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
std::size_t columnWidth(T const &coll, std::string const Elem::*cp, std::string const &header)
static std::vector< std::string > const & all()
static std::string print()
static std::string const & source()
std::size_t rule_size(Widths const &widths)
bool supports_key(std::string const &suffix, std::string const &spec, std::string const &key)
static constexpr double ms
std::unique_ptr< MetadataSummary > get_MetadataSummary(std::string const &suffix, LibraryInfoCollection const &coll)
std::string bold_fontify(std::string const &s)
void print_available_plugins(std::string const &suffix, std::string const &spec, bool verbose)
static std::string const & plugin()
auto transform_all(Container &, OutputIt, UnaryOp)
static std::string const & tool()
Q_EXPORT QTSManip setw(int w)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
void print_descriptions(std::vector< std::string > const &plugins)
static std::string const & mfPlugin()
static std::string const & service()
std::unique_ptr< MetadataCollector > get_MetadataCollector(std::string const &suffix)
void print_description(std::vector< PluginMetadata > const &matches)
static std::string const & module()
static bool supports_key(ParameterBase const &pb, std::string const &searched_for_key)