8 #include "cetlib/filepath_maker.h" 23 return value ?
"true"s :
"false"s;
29 cet::filepath_maker& maker,
30 bool const report_unused)
31 : help_desc_{desc},
maker_{maker}
35 (
"help,h",
"produce help message")
37 (
"config,c", bpo::value<std::string>(),
"Configuration file.")
38 (
"process-name", bpo::value<std::string>(),
"art process name.")
40 bpo::value<bool>()->default_value(
true,
to_string(
true)),
41 "Remove unused modules and paths from the fully-processed configuration.")
43 bpo::value<bool>()->default_value(report_unused,
to_string(report_unused)),
44 "If 'true', the list of unused modules and paths will be printed to STDERR.")
46 bpo::value<std::string>(),
47 (
"List all available plugins with the provided suffix. Choose from:"s +
49 (
"print-available-modules",
50 "List all available modules that can be invoked in a FHiCL file.")
51 (
"print-available-services",
52 "List all available services that can be invoked in a FHiCL file.")
54 bpo::value<std::vector<std::string>>()->multitoken(),
55 "Print description of specified module, service, source, or other " 56 "plugin (multiple OK). Argument can be a regular expression used " 57 "to match the plugin specification. To narrow the search to " 58 "plugins with a particular suffix, preface the regular expression" 59 "with the suffix (e.g. service:TFileService).")
61 "Provide status bar that reports the progress of retrieving " 62 "plugin information for a 'print-available' command.");
71 if (vm.count(
"help")) {
77 for (std::string s; std::getline(ss, s);)
78 std::cout << std::string(2,
' ') << s <<
'\n';
82 bool const status_bar = vm.count(
"status-bar") > 0;
83 if (vm.count(
"print-available")) {
88 if (vm.count(
"print-available-modules")) {
92 if (vm.count(
"print-available-services")) {
98 <<
"The '--status-bar' option can be used only with the " 99 "'--print-available*' program options.\n";
102 if (vm.count(
"print-description")) {
104 vm[
"print-description"].as<std::vector<std::string>>());
107 if (vm.count(
"version")) {
112 if (!vm.count(
"config")) {
120 bpo::variables_map
const& vm,
127 std::cerr <<
"Failed to parse the configuration file '" 128 << vm[
"config"].as<std::string>() <<
"' with exception\n" 132 if (raw_config.
empty()) {
133 std::cerr <<
"INFO: provided configuration file '" 134 << vm[
"config"].as<std::string>() <<
"' is empty: \n" 135 <<
"using minimal defaults and command-line options.\n";
137 if (vm.count(
"process-name")) {
138 raw_config.
put(
"process_name", vm[
"process-name"].as<std::string>());
140 if (vm.count(
"prune-config")) {
141 raw_config.
put(
"services.scheduler.pruneConfig",
142 vm[
"prune-config"].as<bool>());
144 if (vm.count(
"report-unused")) {
145 raw_config.
put(
"services.scheduler.reportUnused",
146 vm[
"report-unused"].as<bool>());
static std::string print()
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
int doCheckOptions(bpo::variables_map const &vm) override
void print_available_plugins(std::string const &suffix, std::string const &spec, bool verbose)
shims::map< std::string, extended_value > table_t
std::string const & getReleaseVersion()
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()
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