add option to exit after make_help + fix exit code
- Defaults to previous behaviour, which was to exit. - Fix the returned exit code: was 1, but should be 0, as asking for help is not an error.
This commit is contained in:
parent
124701a364
commit
67aaf8b025
5 changed files with 8 additions and 6 deletions
|
|
@ -145,7 +145,7 @@ void run_ea(eoAlgo<eoEsFull<eoMinimizingFitness> >& _ga, eoPop<eoEsFull<eoMinimi
|
|||
|
||||
// end of parameter input (+ .status + help)
|
||||
// that one is not templatized, but is here for completeness
|
||||
void make_help(eoParser & _parser);
|
||||
void make_help(eoParser & _parser, bool exit_after = true);
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ void run_ea(eoAlgo<eoReal<eoMinimizingFitness> >& _ga, eoPop<eoReal<eoMinimizing
|
|||
// end of parameter input (+ .status + help)
|
||||
// that one is not templatized
|
||||
// Because of that, the source is in src/utils dir
|
||||
void make_help(eoParser & _parser);
|
||||
void make_help(eoParser & _parser, bool exit_after = true);
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ void run_ea(eoAlgo<eoBit<eoMinimizingFitness> >& _ga, eoPop<eoBit<eoMinimizingFi
|
|||
// end of parameter input (+ .status + help)
|
||||
// that one is not templatized
|
||||
// Because of that, the source is in src/utils dir
|
||||
void make_help(eoParser & _parser);
|
||||
void make_help(eoParser & _parser, bool exit_after = true);
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
#include "eoGenCounter.h"
|
||||
|
||||
// and make_help - any better suggestion to include it?
|
||||
void make_help(eoParser & _parser);
|
||||
void make_help(eoParser & _parser, bool exit_after = true);
|
||||
|
||||
#endif // !_CHECKPOINTING_
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ using namespace std;
|
|||
* It is declared in all make_xxx.h files in representation-dependent dirs
|
||||
* but it is NOT representation-dependent itself - that's why it's in utils
|
||||
*/
|
||||
void make_help(eoParser & _parser)
|
||||
void make_help(eoParser & _parser, bool exit_after)
|
||||
{
|
||||
// name of the "status" file where all actual parameter values will be saved
|
||||
string str_status = _parser.ProgramName() + ".status"; // default value
|
||||
|
|
@ -65,7 +65,9 @@ void make_help(eoParser & _parser)
|
|||
_parser.printHelp(cout);
|
||||
cout << "You can use an edited copy of file " << statusParam.value()
|
||||
<< " as parameter file" << endl;
|
||||
exit(1);
|
||||
if(exit_after) {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue