23 std::replace(s.begin(), s.end(),
'_',
'.');
30 return value ?
"true"s :
"false"s;
37 bool const report_unused)
42 (
"help,h",
"produce help message")
45 (
"config,c", bpo::value<std::string>(),
"Configuration file.")
46 (
"process-name", bpo::value<std::string>(),
"art process name.")
48 bpo::value<bool>()->default_value(
true,
to_string(
true)),
49 "Remove unused modules and paths from the fully-processed configuration.")
51 bpo::value<bool>()->default_value(report_unused,
to_string(report_unused)),
52 "If 'true', the list of unused modules and paths will be printed to STDERR.")
54 bpo::value<std::string>(),
55 (
"List all available plugins with the provided suffix. Choose from:"s +
57 (
"print-available-modules",
58 "List all available modules that can be invoked in a FHiCL file.")
59 (
"print-available-services",
60 "List all available services that can be invoked in a FHiCL file.")
62 bpo::value<std::vector<std::string>>()->multitoken(),
63 "Print description of specified module, service, source, or other " 64 "plugin (multiple OK). Argument can be a regular expression used " 65 "to match the plugin specification. To narrow the search to " 66 "plugins with a particular suffix, preface the regular expression" 67 "with the suffix (e.g. service:TFileService).")
69 "Provide status bar that reports the progress of retrieving " 70 "plugin information for a 'print-available' command.");
79 if (vm.count(
"help")) {
90 bool const status_bar = vm.count(
"status-bar") > 0;
91 if (vm.count(
"print-available")) {
96 if (vm.count(
"print-available-modules")) {
100 if (vm.count(
"print-available-services")) {
106 <<
"The '--status-bar' option can be used only with the " 107 "'--print-available*' program options.\n";
110 if (vm.count(
"print-description")) {
112 vm[
"print-description"].
as<std::vector<std::string>>());
115 if (vm.count(
"version")) {
120 if (!vm.count(
"config")) {
128 bpo::variables_map
const& vm,
135 std::cerr <<
"Failed to parse the configuration file '" 136 << vm[
"config"].as<
std::string>() <<
"' with exception\n" 140 if (raw_config.
empty()) {
141 std::cerr <<
"INFO: provided configuration file '" 142 << vm[
"config"].as<
std::string>() <<
"' is empty: \n" 143 <<
"using minimal defaults and command-line options.\n";
145 if (vm.count(
"process-name")) {
146 raw_config.
put(
"process_name", vm[
"process-name"].as<std::string>());
148 if (vm.count(
"prune-config")) {
149 raw_config.
put(
"services.scheduler.pruneConfig",
150 vm[
"prune-config"].as<bool>());
152 if (vm.count(
"report-unused")) {
153 raw_config.
put(
"services.scheduler.reportUnused",
154 vm[
"report-unused"].as<bool>());
static std::string print()
static constexpr double as
int doCheckOptions(bpo::variables_map const &vm) override
std::string const & getReleaseVersion()
void print_available_plugins(std::string const &suffix, std::string const &spec, bool verbose)
shims::map< std::string, extended_value > table_t
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
bpo::options_description const & help_desc_
void print_descriptions(std::vector< std::string > const &plugins)
intermediate_table parse_document(std::string const &filename, cet::filepath_maker &maker)
static std::string const & service()
constexpr int info_success()
cet::filepath_maker & maker_
static std::string const & module()
def maker(G, ac, typename)
int doProcessOptions(bpo::variables_map const &vm, fhicl::intermediate_table &raw_config) override
std::string to_string(ModuleType const mt)
BasicOptionsHandler(bpo::options_description &desc, cet::filepath_maker &maker, bool report_unused)
cet::coded_exception< error, detail::translate > exception