{"action":"created","issue":{"url":"https://api.github.com/repos/yargs/yargs-parser/issues/56","repository_url":"https://api.github.com/repos/yargs/yargs-parser","labels_url":"https://api.github.com/repos/yargs/yargs-parser/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/yargs/yargs-parser/issues/56/comments","events_url":"https://api.github.com/repos/yargs/yargs-parser/issues/56/events","html_url":"https://github.com/yargs/yargs-parser/issues/56","id":173051076,"number":56,"title":"normalize seems to override coerce callback result","user":{"login":"rpl","id":11484,"avatar_url":"https://avatars.githubusercontent.com/u/11484?v=3","gravatar_id":"","url":"https://api.github.com/users/rpl","html_url":"https://github.com/rpl","followers_url":"https://api.github.com/users/rpl/followers","following_url":"https://api.github.com/users/rpl/following{/other_user}","gists_url":"https://api.github.com/users/rpl/gists{/gist_id}","starred_url":"https://api.github.com/users/rpl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rpl/subscriptions","organizations_url":"https://api.github.com/users/rpl/orgs","repos_url":"https://api.github.com/users/rpl/repos","events_url":"https://api.github.com/users/rpl/events{/privacy}","received_events_url":"https://api.github.com/users/rpl/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yargs/yargs-parser/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-24T20:32:26Z","updated_at":"2016-08-27T14:22:57Z","closed_at":null,"body":"It seems that when the two property are combined, `normalize` overrides the coerced value with the normalized version of  the original value of the option.\r\n\r\nMinimal nodejs snippet to reproduce the issue:\r\n\r\n```\r\nvar yargs = require('yargs');\r\nvar path = require('path');\r\n\r\nvar argv = yargs.option('source-dir', {\r\n  normalize: true,\r\n  coerce: path.resolve\r\n}).argv;\r\n\r\nconsole.log(\"result\", {\r\n  sourceDir: argv.sourceDir,\r\n  resolvedSourceDir: path.resolve(argv.sourceDir)\r\n});\r\n```\r\n\r\n```\r\n$ node test-normalize-coerce.js --source-dir ../src/../src\r\nresult { sourceDir: '../src',\r\n  resolvedSourceDir: '/resolved/dir/src' }\r\n```"},"comment":{"url":"https://api.github.com/repos/yargs/yargs-parser/issues/comments/242919918","html_url":"https://github.com/yargs/yargs-parser/issues/56#issuecomment-242919918","issue_url":"https://api.github.com/repos/yargs/yargs-parser/issues/56","id":242919918,"user":{"login":"maxrimue","id":7421183,"avatar_url":"https://avatars.githubusercontent.com/u/7421183?v=3","gravatar_id":"","url":"https://api.github.com/users/maxrimue","html_url":"https://github.com/maxrimue","followers_url":"https://api.github.com/users/maxrimue/followers","following_url":"https://api.github.com/users/maxrimue/following{/other_user}","gists_url":"https://api.github.com/users/maxrimue/gists{/gist_id}","starred_url":"https://api.github.com/users/maxrimue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxrimue/subscriptions","organizations_url":"https://api.github.com/users/maxrimue/orgs","repos_url":"https://api.github.com/users/maxrimue/repos","events_url":"https://api.github.com/users/maxrimue/events{/privacy}","received_events_url":"https://api.github.com/users/maxrimue/received_events","type":"User","site_admin":false},"created_at":"2016-08-27T14:22:57Z","updated_at":"2016-08-27T14:22:57Z","body":"Hey, thanks for reporting! I suppose for now you can instead do something like this:\r\n```javascript\r\nvar argv = yargs.option('source-dir', {\r\n  coerce: val => path.resolve(path.normalize(val))\r\n}).argv;\r\n```\r\n\r\n"}}
{"actor":{"display_login":"maxrimue"}}