[Seqan-dev] small patch for CommandLineParser
Hi!
The patch file is attached.
The patch feature: show an error message when the required number of
command line parameters doesn't match the number of given parameters.
Best regards,
Konstantin
Index: core/include/seqan/misc/misc_cmdparser.h
===================================================================
--- core/include/seqan/misc/misc_cmdparser.h (revision 11051)
+++ core/include/seqan/misc/misc_cmdparser.h (working copy)
@@ -1425,12 +1425,19 @@
help(me, estream);
return false;
}
- if (argc == 1 && me.required_arguments > 0)
+ if ( length(me.arguments) < me.required_arguments )
{
- shortHelp(me, estream); // print short help and exit
- return 0;
+ if (argc == 1) {
+ shortHelp(me, estream); // print short help and exit
+ } else {
+ _streamWrite(estream, me.appName);
+ _streamWrite(estream, ": number of required arguments is ");
+ _streamPutInt(estream, me.required_arguments);
+ _streamWrite(estream, "\n");
+ }
+ return false;
}
- return _allMandatorySet(me) && (length(me.arguments) >= me.required_arguments);
+ return _allMandatorySet(me);
}
inline bool