[
https://issues.apache.org/jira/browse/MESOS-2766?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Marco Massenzio updated MESOS-2766:
-----------------------------------
Description:
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.
was:
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.
This follows the DRY principle.
> Add validation behavior to FlagsBase
> ------------------------------------
>
> Key: MESOS-2766
> URL: https://issues.apache.org/jira/browse/MESOS-2766
> Project: Mesos
> Issue Type: Bug
> Components: stout
> Reporter: Marco Massenzio
> Assignee: Anand Mazumdar
> Priority: Minor
> Labels: tech-debt
>
> 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)