You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Marco Massenzio (JIRA)" <ji...@apache.org> on 2015/06/01 23:24:17 UTC

[jira] [Commented] (MESOS-2766) Add to FlagsBase the default --help behavior

    [ https://issues.apache.org/jira/browse/MESOS-2766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14568038#comment-14568038 ] 

Marco Massenzio commented on MESOS-2766:
----------------------------------------

We should consider adding an {{onPostHelp()}} 'hook' whose default behavior is to just exit, but can be modified by derived classes:

{code}
// in FlagsBase:
...
protected:
  virtual void onPostHelp() { exit(EXIT_SUCCESS); }

// in MyFlags:
class MyFlags : public flags::FlagsBase {
  ...
protected:
  virtual void onPostHelp()
  {
    cout << "And that was your flags! << endl;
         << ".. and we can now carry on with the show!" << endl;
  }
}
{code}

or something to that effect.

> Add to FlagsBase the default --help behavior
> --------------------------------------------
>
>                 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 {{BaseFlags}} class, we should add this too there and remove it from everywhere else.
> This follows the DRY principle.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)