25 std::string_view appType{
"Gaudi::Application" };
26 std::string_view optsFile;
28 gsl::span args{ argv,
static_cast<std::remove_cv_t<decltype( gsl::dynamic_extent )
>>( argc ) };
30 auto usage = [name = args[0]]( std::ostream& out ) -> std::ostream& {
31 return out <<
"usage: " << name <<
" [options] option_file\n";
34 auto arg = args.begin();
36 while ( arg != args.end() ) {
37 std::string_view opt{ *arg };
38 if ( opt ==
"--application" )
40 else if ( opt ==
"-h" || opt ==
"--help" ) {
44 -h, --help show this help message and exit
45 --application APPLICATION
46 name of the application class to use [default: Gaudi::Application]
49 }
else if ( opt[0] ==
'-' ) {
50 std::cerr <<
"error: unknown option " << opt <<
'\n';
59 if ( arg != args.end() ) { std::cerr <<
"warning: ignoring extra positional arguments\n"; }
60 if ( optsFile.empty() ) {
61 std::cerr <<
"error: missing option file argument\n";
66 if ( optsFile.size() > 3 && optsFile.substr( optsFile.size() - 3 ) ==
".py" ) {
67 opts[
"ApplicationMgr.EvtSel"] =
"NONE";
68 opts[
"ApplicationMgr.JobOptionsType"] =
"NONE";
69 opts[
"ApplicationMgr.DLLs"] =
"['GaudiPython']";
70 opts[
"ApplicationMgr.Runable"] =
"PythonScriptingSvc";
72 opts[
"ApplicationMgr.JobOptionsPath"] = optsFile;
77 std::cerr <<
"error: failure creating " << appType <<
'\n';
GAUDI_API int GaudiMain(int argc, char **argv)