Project: mesos
Issue MESOS-2766: Add validation behavior to FlagsBase
In every "launcher" file (ie, those containing some variation on {{main()}}) there is a minor variation on: {code} if (flags.help) { cout << flags.usage() << endl; // arguably this is not an error: the user asked for help, // and she got it: // the program execution ought to be // considered successful. return EXIT_SUCCESS; } {code} As this is default behavior, and we've added support for the {{--help}} flag in the {{FlagsBase}} class, we should add this too there and remove it from everywhere else. Additionally, a recurring behavior is checking for the presence of a {{required}} flag: {code} if (flags.master.isNone()) { EXIT(EXIT_FAILURE) << flags.usage("--master is required"); } {code} or some variation thereof: we should add automatic validation for required flags during parsing. This follows the DRY principle.
Story points: 1