///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2017 Statoil ASA // // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RiaArgumentParser.h" #include "RiaBaseDefs.h" #include "RiaImportEclipseCaseTools.h" #include "RiaLogging.h" #include "RiaProjectModifier.h" #include "RiaRegressionTestRunner.h" #include "RimProject.h" #include "RiuMainWindow.h" #include "RiuPlotMainWindow.h" #include "RicfCommandFileExecutor.h" #include "ExportCommands/RicSnapshotAllPlotsToFileFeature.h" #include "ExportCommands/RicSnapshotAllViewsToFileFeature.h" #include "ExportCommands/RicSnapshotViewToFileFeature.h" #include "RicImportSummaryCasesFeature.h" #include "cafPdmScriptIOMessages.h" #include "cvfProgramOptions.h" #include "cvfqtUtils.h" #include "cafUtils.h" #include #include #include #include //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RiaArgumentParser::parseArguments( cvf::ProgramOptions* progOpt ) { CVF_ASSERT( progOpt ); progOpt->registerOption( "help", "", "Displays help text and exits." ); progOpt->registerOption( "?", "", "Displays help text and exits." ); progOpt->registerOption( "project", "", "Open project file .", cvf::ProgramOptions::SINGLE_VALUE ); progOpt->registerOption( "last", "", "Open last used project." ); progOpt->registerOption( "case", " [ ...]", "Imports the Eclipse cases specified by case name with or without extension." "If , import the corresponding grid file and summary file" "If has extension .GRRID/.EGRID, import the grid file and corresponding " "summary file" "If has extension .SMSPEC, import the summary file (does not open the " "corresponding grid file)", cvf::ProgramOptions::MULTI_VALUE ); progOpt->registerOption( "size", " ", "Set size of the main application window.", cvf::ProgramOptions::MULTI_VALUE ); progOpt->registerOption( "console", "", "Launch as a console application without graphics" ); progOpt->registerOption( "server", "[]", "Launch as a GRPC server. Default port is 50051", cvf::ProgramOptions::SINGLE_VALUE ); progOpt->registerOption( "portnumberfile", "[]", "Write the port number to this file.", cvf::ProgramOptions::SINGLE_VALUE ); progOpt->registerOption( "startdir", "", "Set startup directory.\n", cvf::ProgramOptions::SINGLE_VALUE ); progOpt->registerOption( "summaryplot", "[] ", "Creates a summary plot using all the ," "and all the summary vectors defined in ." "Use --summaryplot -help to show a more detailed help text.\n", cvf::ProgramOptions::OPTIONAL_MULTI_VALUE ); progOpt->registerOption( "commandFile", "", "Execute the command file.", cvf::ProgramOptions::SINGLE_VALUE ); progOpt->registerOption( "commandFileReplaceCases", "[] ", "Supply list of cases to replace in project, performing command file for each case.", cvf::ProgramOptions::SINGLE_VALUE ); progOpt->registerOption( "commandFileProject", "", "Project to use if performing case looping for command file. Used in conjunction with " "'commandFileReplaceCases'.\n", cvf::ProgramOptions::SINGLE_VALUE ); progOpt->registerOption( "snapshotsize", " ", "Set size of exported snapshot images.", cvf::ProgramOptions::MULTI_VALUE ); progOpt->registerOption( "snapshotfolder", "", "Set the destination folder for exported snapshot images.\n", cvf::ProgramOptions::SINGLE_VALUE ); progOpt->registerOption( "savesnapshots", "all|views|plots", "Save snapshot of all views or plots to project file location sub folder 'snapshots'. " "Option 'all' " "will include both views and plots. Application closes after snapshots have been written.", cvf::ProgramOptions::OPTIONAL_MULTI_VALUE ); progOpt->registerOption( "multiCaseSnapshots", "", "For each grid file listed in the file, replace the first case in the " "project and save " "snapshots of all views.\n", cvf::ProgramOptions::SINGLE_VALUE ); progOpt->registerOption( "replaceCase", "[] ", "Replace grid in or first case with . Repeat parameter for multiple " "replace operations.", cvf::ProgramOptions::MULTI_VALUE, cvf::ProgramOptions::COMBINE_REPEATED ); progOpt->registerOption( "replaceSourceCases", "[] ", "Replace source cases in or first grid case group with the grid files " "listed in the " " file. Repeat parameter for multiple replace operations.", cvf::ProgramOptions::MULTI_VALUE, cvf::ProgramOptions::COMBINE_REPEATED ); progOpt->registerOption( "replacePropertiesFolder", "[] ", "Replace the folder containing property files for an eclipse input case.\n", cvf::ProgramOptions::MULTI_VALUE ); progOpt->registerOption( "updateregressiontestbase", "", "System command", cvf::ProgramOptions::SINGLE_VALUE ); progOpt->registerOption( "regressiontest", "", "System command", cvf::ProgramOptions::SINGLE_VALUE ); #ifdef USE_UNIT_TESTS progOpt->registerOption( "unittest", "", "System command" ); #endif progOpt->registerOption( "generate", "[]", "Generate code or documentation", cvf::ProgramOptions::SINGLE_VALUE ); progOpt->registerOption( "ignoreArgs", "", "System command. Ignore all arguments. Mostly for testing purposes" ); progOpt->registerOption( "version", "", "Display the application version string" ); progOpt->registerOption( "openplotwindow", "", "Open the 2D plot window. By default, the 3D window is displayed." ); progOpt->setOptionPrefix( cvf::ProgramOptions::DOUBLE_DASH ); QStringList arguments = QCoreApplication::arguments(); bool parseOk = progOpt->parse( cvfqt::Utils::toStringVector( arguments ) ); // If positional parameter functionality is to be supported, the test for existence of positionalParameters must be // removed This is based on a pull request by @andlaus https://github.com/OPM/ResInsight/pull/162 return parseOk && progOpt->positionalParameters().empty(); }