{"action":"created","comment":{"url":"https://api.github.com/repos/Homebrew/brew/pulls/comments/62440079","id":62440079,"diff_hunk":"@@ -0,0 +1,64 @@\n+require 'shellwords'\n+\n+module Utils\n+  module Shell\n+    # take a path and heuristically convert it\n+    # to a shell, return nil if there's no match\n+    def self.path_to_shell(path)\n+      # remove leading - from login shell\n+      shell_name = File.basename(path).strip_prefix(\"-\")\n+      case shell_name\n+      when \"sh\", \"bash\", \"zsh\", \"csh\", \"tcsh\", \"fish\", \"ksh\"","path":"Library/Homebrew/utils/shell.rb","position":11,"original_position":11,"commit_id":"0bd67ae1678741b4a1ff4e399178e0ee341c34ae","original_commit_id":"0bd67ae1678741b4a1ff4e399178e0ee341c34ae","user":{"login":"UniqMartin","id":11892150,"avatar_url":"https://avatars.githubusercontent.com/u/11892150?v=3","gravatar_id":"","url":"https://api.github.com/users/UniqMartin","html_url":"https://github.com/UniqMartin","followers_url":"https://api.github.com/users/UniqMartin/followers","following_url":"https://api.github.com/users/UniqMartin/following{/other_user}","gists_url":"https://api.github.com/users/UniqMartin/gists{/gist_id}","starred_url":"https://api.github.com/users/UniqMartin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UniqMartin/subscriptions","organizations_url":"https://api.github.com/users/UniqMartin/orgs","repos_url":"https://api.github.com/users/UniqMartin/repos","events_url":"https://api.github.com/users/UniqMartin/events{/privacy}","received_events_url":"https://api.github.com/users/UniqMartin/received_events","type":"User","site_admin":false},"body":"Minor detail, but I'd prefer to keep these sorted alphabetically.","created_at":"2016-05-08T22:55:06Z","updated_at":"2016-05-08T22:55:06Z","html_url":"https://github.com/Homebrew/brew/pull/201#discussion_r62440079","pull_request_url":"https://api.github.com/repos/Homebrew/brew/pulls/201","_links":{"self":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/comments/62440079"},"html":{"href":"https://github.com/Homebrew/brew/pull/201#discussion_r62440079"},"pull_request":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/201"}}},"pull_request":{"url":"https://api.github.com/repos/Homebrew/brew/pulls/201","id":68941058,"html_url":"https://github.com/Homebrew/brew/pull/201","diff_url":"https://github.com/Homebrew/brew/pull/201.diff","patch_url":"https://github.com/Homebrew/brew/pull/201.patch","issue_url":"https://api.github.com/repos/Homebrew/brew/issues/201","number":201,"state":"open","locked":false,"title":"--env: support more shells, allow explicit shell selection","user":{"login":"gregory-nisbet","id":4076227,"avatar_url":"https://avatars.githubusercontent.com/u/4076227?v=3","gravatar_id":"","url":"https://api.github.com/users/gregory-nisbet","html_url":"https://github.com/gregory-nisbet","followers_url":"https://api.github.com/users/gregory-nisbet/followers","following_url":"https://api.github.com/users/gregory-nisbet/following{/other_user}","gists_url":"https://api.github.com/users/gregory-nisbet/gists{/gist_id}","starred_url":"https://api.github.com/users/gregory-nisbet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregory-nisbet/subscriptions","organizations_url":"https://api.github.com/users/gregory-nisbet/orgs","repos_url":"https://api.github.com/users/gregory-nisbet/repos","events_url":"https://api.github.com/users/gregory-nisbet/events{/privacy}","received_events_url":"https://api.github.com/users/gregory-nisbet/received_events","type":"User","site_admin":false},"body":"- [x] Have you followed the guidelines in our [Contributing](https://github.com/Homebrew/brew/blob/master/.github/CONTRIBUTING.md) document?\r\n- [x] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/Homebrew/brew/pulls) for the same change?\r\n- [x] Have you added an explanation of what your changes do and why you'd like us to include them?\r\n- [ ] Have you written new tests for your changes? [Here's an example](https://github.com/Homebrew/homebrew/pull/49031).\r\n- [x] Have you successfully run `brew tests` with your changes locally?\r\n\r\n-----\r\n\r\n`brew --env` can be given an explicit shell argument via shell.\r\nThe basename of the path is compared against a known list of\r\nshells.\r\n\r\nAn explicit argument of `--shell=` or `--shell ''`\r\nwith an empty string forces brew --env to dump the environment in\r\nthe key: value format that it uses when it detects that\r\nstdout is a tty.\r\n\r\nIf an explicit shell is not supplied from the command line and\r\nstdout is not a tty, then `brew --env` will check the parent process,\r\nthen its parent process etc until it finds a process with an\r\nargv[0] that is either a known shell name or a known shell name with\r\n`-` prepended\r\n\r\nWhen I ran the test suite I encountered one failure in an integration test\r\nif I run the test suite under `tcsh` but none if I run it under `bash`. The integration test\r\nwill probably need to be updated to use an explicit shell.\r\n\r\nHere's an excerpt of the failing case.\r\n\r\n```\r\n  1) Failure:\r\nIntegrationCommandTests#test_env [/Users/greg/opt/brew/brew-dev/Library/Homebrew/test/test_integration_cmds.rb:113]:\r\n```","created_at":"2016-05-04T22:16:53Z","updated_at":"2016-05-08T22:55:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2e99c3b5d306364295abbf0e0bca8741990e9731","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Homebrew/brew/pulls/201/commits","review_comments_url":"https://api.github.com/repos/Homebrew/brew/pulls/201/comments","review_comment_url":"https://api.github.com/repos/Homebrew/brew/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Homebrew/brew/issues/201/comments","statuses_url":"https://api.github.com/repos/Homebrew/brew/statuses/0bd67ae1678741b4a1ff4e399178e0ee341c34ae","head":{"label":"gregory-nisbet:feature-env-shells","ref":"feature-env-shells","sha":"0bd67ae1678741b4a1ff4e399178e0ee341c34ae","user":{"login":"gregory-nisbet","id":4076227,"avatar_url":"https://avatars.githubusercontent.com/u/4076227?v=3","gravatar_id":"","url":"https://api.github.com/users/gregory-nisbet","html_url":"https://github.com/gregory-nisbet","followers_url":"https://api.github.com/users/gregory-nisbet/followers","following_url":"https://api.github.com/users/gregory-nisbet/following{/other_user}","gists_url":"https://api.github.com/users/gregory-nisbet/gists{/gist_id}","starred_url":"https://api.github.com/users/gregory-nisbet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregory-nisbet/subscriptions","organizations_url":"https://api.github.com/users/gregory-nisbet/orgs","repos_url":"https://api.github.com/users/gregory-nisbet/repos","events_url":"https://api.github.com/users/gregory-nisbet/events{/privacy}","received_events_url":"https://api.github.com/users/gregory-nisbet/received_events","type":"User","site_admin":false},"repo":{"id":57940544,"name":"brew","full_name":"gregory-nisbet/brew","owner":{"login":"gregory-nisbet","id":4076227,"avatar_url":"https://avatars.githubusercontent.com/u/4076227?v=3","gravatar_id":"","url":"https://api.github.com/users/gregory-nisbet","html_url":"https://github.com/gregory-nisbet","followers_url":"https://api.github.com/users/gregory-nisbet/followers","following_url":"https://api.github.com/users/gregory-nisbet/following{/other_user}","gists_url":"https://api.github.com/users/gregory-nisbet/gists{/gist_id}","starred_url":"https://api.github.com/users/gregory-nisbet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregory-nisbet/subscriptions","organizations_url":"https://api.github.com/users/gregory-nisbet/orgs","repos_url":"https://api.github.com/users/gregory-nisbet/repos","events_url":"https://api.github.com/users/gregory-nisbet/events{/privacy}","received_events_url":"https://api.github.com/users/gregory-nisbet/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gregory-nisbet/brew","description":":beer: The missing package manager for OS X","fork":true,"url":"https://api.github.com/repos/gregory-nisbet/brew","forks_url":"https://api.github.com/repos/gregory-nisbet/brew/forks","keys_url":"https://api.github.com/repos/gregory-nisbet/brew/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gregory-nisbet/brew/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gregory-nisbet/brew/teams","hooks_url":"https://api.github.com/repos/gregory-nisbet/brew/hooks","issue_events_url":"https://api.github.com/repos/gregory-nisbet/brew/issues/events{/number}","events_url":"https://api.github.com/repos/gregory-nisbet/brew/events","assignees_url":"https://api.github.com/repos/gregory-nisbet/brew/assignees{/user}","branches_url":"https://api.github.com/repos/gregory-nisbet/brew/branches{/branch}","tags_url":"https://api.github.com/repos/gregory-nisbet/brew/tags","blobs_url":"https://api.github.com/repos/gregory-nisbet/brew/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gregory-nisbet/brew/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gregory-nisbet/brew/git/refs{/sha}","trees_url":"https://api.github.com/repos/gregory-nisbet/brew/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gregory-nisbet/brew/statuses/{sha}","languages_url":"https://api.github.com/repos/gregory-nisbet/brew/languages","stargazers_url":"https://api.github.com/repos/gregory-nisbet/brew/stargazers","contributors_url":"https://api.github.com/repos/gregory-nisbet/brew/contributors","subscribers_url":"https://api.github.com/repos/gregory-nisbet/brew/subscribers","subscription_url":"https://api.github.com/repos/gregory-nisbet/brew/subscription","commits_url":"https://api.github.com/repos/gregory-nisbet/brew/commits{/sha}","git_commits_url":"https://api.github.com/repos/gregory-nisbet/brew/git/commits{/sha}","comments_url":"https://api.github.com/repos/gregory-nisbet/brew/comments{/number}","issue_comment_url":"https://api.github.com/repos/gregory-nisbet/brew/issues/comments{/number}","contents_url":"https://api.github.com/repos/gregory-nisbet/brew/contents/{+path}","compare_url":"https://api.github.com/repos/gregory-nisbet/brew/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gregory-nisbet/brew/merges","archive_url":"https://api.github.com/repos/gregory-nisbet/brew/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gregory-nisbet/brew/downloads","issues_url":"https://api.github.com/repos/gregory-nisbet/brew/issues{/number}","pulls_url":"https://api.github.com/repos/gregory-nisbet/brew/pulls{/number}","milestones_url":"https://api.github.com/repos/gregory-nisbet/brew/milestones{/number}","notifications_url":"https://api.github.com/repos/gregory-nisbet/brew/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gregory-nisbet/brew/labels{/name}","releases_url":"https://api.github.com/repos/gregory-nisbet/brew/releases{/id}","deployments_url":"https://api.github.com/repos/gregory-nisbet/brew/deployments","created_at":"2016-05-03T04:08:09Z","updated_at":"2016-05-03T04:08:10Z","pushed_at":"2016-05-08T21:00:36Z","git_url":"git://github.com/gregory-nisbet/brew.git","ssh_url":"git@github.com:gregory-nisbet/brew.git","clone_url":"https://github.com/gregory-nisbet/brew.git","svn_url":"https://github.com/gregory-nisbet/brew","homepage":"http://brew.sh","size":11689,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Homebrew:master","ref":"master","sha":"59de2c7ecf34c46ead29c787ce409afdc15f609c","user":{"login":"Homebrew","id":1503512,"avatar_url":"https://avatars.githubusercontent.com/u/1503512?v=3","gravatar_id":"","url":"https://api.github.com/users/Homebrew","html_url":"https://github.com/Homebrew","followers_url":"https://api.github.com/users/Homebrew/followers","following_url":"https://api.github.com/users/Homebrew/following{/other_user}","gists_url":"https://api.github.com/users/Homebrew/gists{/gist_id}","starred_url":"https://api.github.com/users/Homebrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Homebrew/subscriptions","organizations_url":"https://api.github.com/users/Homebrew/orgs","repos_url":"https://api.github.com/users/Homebrew/repos","events_url":"https://api.github.com/users/Homebrew/events{/privacy}","received_events_url":"https://api.github.com/users/Homebrew/received_events","type":"Organization","site_admin":false},"repo":{"id":53238813,"name":"brew","full_name":"Homebrew/brew","owner":{"login":"Homebrew","id":1503512,"avatar_url":"https://avatars.githubusercontent.com/u/1503512?v=3","gravatar_id":"","url":"https://api.github.com/users/Homebrew","html_url":"https://github.com/Homebrew","followers_url":"https://api.github.com/users/Homebrew/followers","following_url":"https://api.github.com/users/Homebrew/following{/other_user}","gists_url":"https://api.github.com/users/Homebrew/gists{/gist_id}","starred_url":"https://api.github.com/users/Homebrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Homebrew/subscriptions","organizations_url":"https://api.github.com/users/Homebrew/orgs","repos_url":"https://api.github.com/users/Homebrew/repos","events_url":"https://api.github.com/users/Homebrew/events{/privacy}","received_events_url":"https://api.github.com/users/Homebrew/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Homebrew/brew","description":":beer: The missing package manager for OS X","fork":false,"url":"https://api.github.com/repos/Homebrew/brew","forks_url":"https://api.github.com/repos/Homebrew/brew/forks","keys_url":"https://api.github.com/repos/Homebrew/brew/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Homebrew/brew/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Homebrew/brew/teams","hooks_url":"https://api.github.com/repos/Homebrew/brew/hooks","issue_events_url":"https://api.github.com/repos/Homebrew/brew/issues/events{/number}","events_url":"https://api.github.com/repos/Homebrew/brew/events","assignees_url":"https://api.github.com/repos/Homebrew/brew/assignees{/user}","branches_url":"https://api.github.com/repos/Homebrew/brew/branches{/branch}","tags_url":"https://api.github.com/repos/Homebrew/brew/tags","blobs_url":"https://api.github.com/repos/Homebrew/brew/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Homebrew/brew/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Homebrew/brew/git/refs{/sha}","trees_url":"https://api.github.com/repos/Homebrew/brew/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Homebrew/brew/statuses/{sha}","languages_url":"https://api.github.com/repos/Homebrew/brew/languages","stargazers_url":"https://api.github.com/repos/Homebrew/brew/stargazers","contributors_url":"https://api.github.com/repos/Homebrew/brew/contributors","subscribers_url":"https://api.github.com/repos/Homebrew/brew/subscribers","subscription_url":"https://api.github.com/repos/Homebrew/brew/subscription","commits_url":"https://api.github.com/repos/Homebrew/brew/commits{/sha}","git_commits_url":"https://api.github.com/repos/Homebrew/brew/git/commits{/sha}","comments_url":"https://api.github.com/repos/Homebrew/brew/comments{/number}","issue_comment_url":"https://api.github.com/repos/Homebrew/brew/issues/comments{/number}","contents_url":"https://api.github.com/repos/Homebrew/brew/contents/{+path}","compare_url":"https://api.github.com/repos/Homebrew/brew/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Homebrew/brew/merges","archive_url":"https://api.github.com/repos/Homebrew/brew/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Homebrew/brew/downloads","issues_url":"https://api.github.com/repos/Homebrew/brew/issues{/number}","pulls_url":"https://api.github.com/repos/Homebrew/brew/pulls{/number}","milestones_url":"https://api.github.com/repos/Homebrew/brew/milestones{/number}","notifications_url":"https://api.github.com/repos/Homebrew/brew/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Homebrew/brew/labels{/name}","releases_url":"https://api.github.com/repos/Homebrew/brew/releases{/id}","deployments_url":"https://api.github.com/repos/Homebrew/brew/deployments","created_at":"2016-03-06T05:08:38Z","updated_at":"2016-05-08T19:23:42Z","pushed_at":"2016-05-08T22:02:41Z","git_url":"git://github.com/Homebrew/brew.git","ssh_url":"git@github.com:Homebrew/brew.git","clone_url":"https://github.com/Homebrew/brew.git","svn_url":"https://github.com/Homebrew/brew","homepage":"http://brew.sh","size":11881,"stargazers_count":923,"watchers_count":923,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":237,"mirror_url":null,"open_issues_count":26,"forks":237,"open_issues":26,"watchers":923,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/201"},"html":{"href":"https://github.com/Homebrew/brew/pull/201"},"issue":{"href":"https://api.github.com/repos/Homebrew/brew/issues/201"},"comments":{"href":"https://api.github.com/repos/Homebrew/brew/issues/201/comments"},"review_comments":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/201/comments"},"review_comment":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/201/commits"},"statuses":{"href":"https://api.github.com/repos/Homebrew/brew/statuses/0bd67ae1678741b4a1ff4e399178e0ee341c34ae"}}}}