{"action":"created","issue":{"url":"https://api.github.com/repos/trevorsenior/node-main/issues/10","labels_url":"https://api.github.com/repos/trevorsenior/node-main/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/trevorsenior/node-main/issues/10/comments","events_url":"https://api.github.com/repos/trevorsenior/node-main/issues/10/events","html_url":"https://github.com/trevorsenior/node-main/issues/10","id":96305235,"number":10,"title":"Suggestions re default values and optional option-arguments","user":{"login":"mklement0","id":588825,"avatar_url":"https://avatars.githubusercontent.com/u/588825?v=3","gravatar_id":"","url":"https://api.github.com/users/mklement0","html_url":"https://github.com/mklement0","followers_url":"https://api.github.com/users/mklement0/followers","following_url":"https://api.github.com/users/mklement0/following{/other_user}","gists_url":"https://api.github.com/users/mklement0/gists{/gist_id}","starred_url":"https://api.github.com/users/mklement0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mklement0/subscriptions","organizations_url":"https://api.github.com/users/mklement0/orgs","repos_url":"https://api.github.com/users/mklement0/repos","events_url":"https://api.github.com/users/mklement0/events{/privacy}","received_events_url":"https://api.github.com/users/mklement0/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-21T12:33:43Z","updated_at":"2015-07-21T13:53:19Z","closed_at":null,"body":"Currently, the default value in `### --default=SOMETHING, -d SOMETHING (default=foo)` is applied as follows:\r\n\r\nIf neither `--default` nor `-d` are specified,  `$('default')` and `$('d')` contain `foo`.\r\n\r\nErgo: not specifying the option _at all_ on the command line assigns the corresponding property the default value.\r\n\r\nBy contrast, specifying it _without an option-argument_, e.g., just `-d` instead of `-d bar`, actually assigns `true` to `$('default')` and `$('d')`, which is unexpected. Based on the syntax, given that the option-argument `SOMETHING` is _not_ marked as optional, I would expect parsing to fail, given that the required option-argument was not specified.\r\n\r\nComplementarily, it would be great to be able to define _optional option-arguments_, such as with\r\n\r\n    ### --default[=SOMETHING], -d[SOMETHING] (default=foo)\r\n\r\nwhich would require slightly different logic:\r\n\r\n* If neither `--default` nor `-d` are specified, leave `$('default')` and `$('d')` _undefined_.\r\n* Apply the default value only if either `--default` or `-d` are specified _without option-argument_; e.g., just `-d`.\r\n* Note that specifying a value for an optional option-argument inherently requires that the option and its value form a single token; e.g., `--default=bar` or `-dbar`.\r\n\r\nA real-life example of such an option is `grep`'s  `--color[=WHEN]` option, which controls color-coding of the output; `WHEN` defaults to `never`, if only `--color` is specified."},"comment":{"url":"https://api.github.com/repos/trevorsenior/node-main/issues/comments/123313997","html_url":"https://github.com/trevorsenior/node-main/issues/10#issuecomment-123313997","issue_url":"https://api.github.com/repos/trevorsenior/node-main/issues/10","id":123313997,"user":{"login":"mklement0","id":588825,"avatar_url":"https://avatars.githubusercontent.com/u/588825?v=3","gravatar_id":"","url":"https://api.github.com/users/mklement0","html_url":"https://github.com/mklement0","followers_url":"https://api.github.com/users/mklement0/followers","following_url":"https://api.github.com/users/mklement0/following{/other_user}","gists_url":"https://api.github.com/users/mklement0/gists{/gist_id}","starred_url":"https://api.github.com/users/mklement0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mklement0/subscriptions","organizations_url":"https://api.github.com/users/mklement0/orgs","repos_url":"https://api.github.com/users/mklement0/repos","events_url":"https://api.github.com/users/mklement0/events{/privacy}","received_events_url":"https://api.github.com/users/mklement0/received_events","type":"User","site_admin":false},"created_at":"2015-07-21T13:53:19Z","updated_at":"2015-07-21T13:53:19Z","body":"That sounds great, thanks.\r\n\r\nIf you feel inspired, here are some more suggestions (I have no sense of how difficult they'd be to implement):\r\n\r\nYou could also consider supporting inline styles, such as ``### `--default`[=*something*]``, which renders better both in HTML and in a man page (though still not optimally).\r\n\r\nThe ability to use unordered list items (`*`) in lieu of `###` to mark options would be great too.\r\n\r\nFinally, moving to v2 may be an opportunity to (conceptually) rename the project to a more descriptive name."}}