Changeset eea0bb
- Timestamp:
- Jan 29, 2015, 7:38:23 AM (10 years ago)
- Children:
- 7e6c0d
- Parents:
- 27e464 (diff), 7305d5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/Actions/CommandAction/HelpAction.def ¶
r27e464 reea0bb 18 18 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 19 19 #define paramtypes (std::string) 20 #define paramtokens (" actionname")20 #define paramtokens ("help") 21 21 #define paramdescriptions ("Name of an action whose option list is then given") 22 22 #define paramdefaults (PARAM_DEFAULT(std::string("none"))) -
TabularUnified src/UIElements/CommandLineUI/CommandLineParser.cpp ¶
r27e464 reea0bb 147 147 // std::cout << std::endl; 148 148 149 AddOptionToParser(currentOption, (CmdParserLookup["options"])); 149 AddOptionToParser(currentOption, (CmdParserLookup["options"]), 150 (optioniter->first == *iter) ? 151 true : false); 150 152 151 153 AlreadyAddedOptionNames.insert(optioniter->first); … … 174 176 ASSERT(CmdParserLookup.find(CurrentTrait.getMenuName()) != CmdParserLookup.end(), 175 177 "CommandLineParser: boost::program_options::options_description for this Action not present."); 176 AddOptionToParser(dynamic_cast<const OptionTrait * const>(&CurrentTrait),(CmdParserLookup[CurrentTrait.getMenuName()])); 178 AddOptionToParser( 179 dynamic_cast<const OptionTrait * const>(&CurrentTrait), 180 (CmdParserLookup[CurrentTrait.getMenuName()]), 181 false); 177 182 } 178 183 } … … 191 196 * \param *currentOption pointer to Action/Option to add 192 197 * \param *OptionList program_options list to add to 193 */ 194 void CommandLineParser::AddOptionToParser(const OptionTrait * const currentOption, po::options_description* OptionList) 198 * \param _DefaultAsImplicit whether to add a default value as default_value or 199 * as implicit_value (default = option token present or not, implicit = 200 option token present but not necessarily followed by argument) 201 */ 202 void CommandLineParser::AddOptionToParser( 203 const OptionTrait * const currentOption, 204 po::options_description* OptionList, 205 const bool _DefaultAsImplicit) 195 206 { 196 207 // check whether dynamic_cast in Init() suceeded … … 212 223 (currentOption->getKeyAndShortForm().c_str(), 213 224 currentOption->hasDefaultValue() ? 214 po::value < bool >()->default_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str())) : 225 (_DefaultAsImplicit ? 226 po::value < bool >()->implicit_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str())) : 227 po::value < bool >()->default_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str()))) : 215 228 po::value < bool >(), 216 229 currentOption->getDescription().c_str()) … … 239 252 (currentOption->getKeyAndShortForm().c_str(), 240 253 currentOption->hasDefaultValue() ? 241 po::value < int >()->default_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str())) : 254 (_DefaultAsImplicit ? 255 po::value < int >()->implicit_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str())) : 256 po::value < int >()->default_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str()))) : 242 257 po::value < int >(), 243 258 currentOption->getDescription().c_str()) … … 257 272 (currentOption->getKeyAndShortForm().c_str(), 258 273 currentOption->hasDefaultValue() ? 259 po::value < unsigned int >()->default_value(boost::lexical_cast<unsigned int>(currentOption->getDefaultValue().c_str())) : 274 (_DefaultAsImplicit ? 275 po::value < unsigned int >()->implicit_value(boost::lexical_cast<unsigned int>(currentOption->getDefaultValue().c_str())) : 276 po::value < unsigned int >()->default_value(boost::lexical_cast<unsigned int>(currentOption->getDefaultValue().c_str()))) : 260 277 po::value < unsigned int >(), 261 278 currentOption->getDescription().c_str()) … … 275 292 (currentOption->getKeyAndShortForm().c_str(), 276 293 currentOption->hasDefaultValue() ? 277 po::value < double >()->default_value(boost::lexical_cast<double>(currentOption->getDefaultValue().c_str())) : 294 (_DefaultAsImplicit ? 295 po::value < double >()->implicit_value(boost::lexical_cast<double>(currentOption->getDefaultValue().c_str())) : 296 po::value < double >()->default_value(boost::lexical_cast<double>(currentOption->getDefaultValue().c_str()))) : 278 297 po::value < double >(), 279 298 currentOption->getDescription().c_str()) … … 293 312 (currentOption->getKeyAndShortForm().c_str(), 294 313 currentOption->hasDefaultValue() ? 295 po::value < std::string >()->default_value(currentOption->getDefaultValue()) : 314 (_DefaultAsImplicit ? 315 po::value < std::string >()->implicit_value(currentOption->getDefaultValue()) : 316 po::value < std::string >()->default_value(currentOption->getDefaultValue())) : 296 317 po::value < std::string >(), 297 318 currentOption->getDescription().c_str()) … … 347 368 (currentOption->getKeyAndShortForm().c_str(), 348 369 currentOption->hasDefaultValue() ? 349 po::value < int >()->default_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str())) : 370 (_DefaultAsImplicit ? 371 po::value < int >()->implicit_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str())) : 372 po::value < int >()->default_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str()))) : 350 373 po::value < int >(), 351 374 currentOption->getDescription().c_str()) … … 383 406 (currentOption->getKeyAndShortForm().c_str(), 384 407 currentOption->hasDefaultValue() ? 385 po::value < std::string >()->default_value(boost::lexical_cast< std::string >(currentOption->getDefaultValue().c_str())) : 408 (_DefaultAsImplicit ? 409 po::value < std::string >()->implicit_value(boost::lexical_cast< std::string >(currentOption->getDefaultValue().c_str())) : 410 po::value < std::string >()->default_value(boost::lexical_cast< std::string >(currentOption->getDefaultValue().c_str()))) : 386 411 po::value < std::string >(), 387 412 currentOption->getDescription().c_str()) … … 438 463 po::store(po::command_line_parser(argc,argv).options(cmdline_options).run(), vm); 439 464 } catch (std::exception &e) { 440 std::cerr << "Something went wrong with parsing the command-line arguments." << std::endl; 465 std::cerr << "Something went wrong with parsing the command-line arguments: " 466 << e.what() << std::endl; 441 467 World::getInstance().setExitFlag(134); 442 468 #ifdef HAVE_ACTION_THREAD -
TabularUnified src/UIElements/CommandLineUI/CommandLineParser.hpp ¶
r27e464 reea0bb 90 90 91 91 // adds options to the parser 92 void AddOptionToParser(const MoleCuilder::OptionTrait * const currentOption, po::options_description* OptionList); 92 void AddOptionToParser( 93 const MoleCuilder::OptionTrait * const currentOption, 94 po::options_description* OptionList, 95 const bool _DefaultAsImplicit); 93 96 94 97 // creates a map from short forms to action tokens needed to parse command line -
TabularUnified tests/Python/AllActions/options.dat ¶
r27e464 reea0bb 1 1 #key value 2 actionname "help"3 2 add-atom "1" 4 3 add-empty-boundary "5,5,5" … … 88 87 fragment-resultfile "results.dat" 89 88 grid-level "5" 89 help "help" 90 90 id-mapping "1" 91 91 input "test.data" -
TabularUnified tests/regression/Options/Help/testsuite-options-help.at ¶
r27e464 reea0bb 27 27 AT_CHECK([fgrep "list of all available Actions" stdout], 0, [ignore], [ignore]) 28 28 AT_CHECK([fgrep "Usage help" stdout], 0, [ignore], [ignore]) 29 AT_CHECK([../../molecuilder --help --actionname"help"], 0, [stdout], [ignore])29 AT_CHECK([../../molecuilder --help "help"], 0, [stdout], [ignore]) 30 30 AT_CHECK([fgrep "Options available for action 'help'" stdout], 0, [ignore], [ignore]) 31 31 -
TabularUnified tests/regression/Potential/FitPotential/testsuite-potential-fit-potential.at ¶
r27e464 reea0bb 21 21 AT_SETUP([Potential - Fit morse potential to water]) 22 22 AT_KEYWORDS([potential parse-homologies fit-potential morse]) 23 AT_SKIP_IF([../../molecuilder --help --actionnamefit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])23 AT_SKIP_IF([../../molecuilder --help fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 24 24 25 25 file=length_homology.dat … … 47 47 AT_SETUP([Potential - Fit harmonic potential to water]) 48 48 AT_KEYWORDS([potential parse-homologies fit-potential harmonic]) 49 AT_SKIP_IF([../../molecuilder --help --actionnamefit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])49 AT_SKIP_IF([../../molecuilder --help fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 50 50 51 51 file=harmonic_homology.dat … … 73 73 AT_SETUP([Potential - Fit harmonic_angle potential to water]) 74 74 AT_KEYWORDS([potential parse-homologies fit-potential harmonic_angle]) 75 AT_SKIP_IF([../../molecuilder --help --actionnamefit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])75 AT_SKIP_IF([../../molecuilder --help fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 76 76 77 77 file=angle_homology.dat … … 99 99 AT_SETUP([Potential - Fit torsion potential to butane]) 100 100 AT_KEYWORDS([potential parse-homologies fit-potential torsion]) 101 AT_SKIP_IF([../../molecuilder --help --actionnamefit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])101 AT_SKIP_IF([../../molecuilder --help fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 102 102 103 103 file=torsion_homology.dat … … 125 125 AT_SETUP([Potential - Fit improper potential to ammonia]) 126 126 AT_KEYWORDS([potential parse-homologies fit-potential improper]) 127 AT_SKIP_IF([../../molecuilder --help --actionnamefit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])127 AT_SKIP_IF([../../molecuilder --help fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 128 128 129 129 file=improper_homology.dat … … 152 152 AT_SETUP([Potential - Fit LJ potential to argon]) 153 153 AT_KEYWORDS([potential parse-homologies fit-potential lennardjones]) 154 AT_SKIP_IF([../../molecuilder --help --actionnamefit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])154 AT_SKIP_IF([../../molecuilder --help fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 155 155 156 156 file=lj_homology.dat
Note:
See TracChangeset
for help on using the changeset viewer.