{"action":"created","comment":{"url":"https://api.github.com/repos/scopatz/xonsh/pulls/comments/30752372","id":30752372,"diff_hunk":"@@ -136,10 +138,19 @@ def cmd_complete(self, cmd):\n         return {s + space for s in self._all_commands() if s.startswith(cmd)}\n \n     def module_complete(self, prefix):\n-        \"\"\"Completes a name of a module to import\"\"\"\n+        \"\"\"Completes a name of a module to import.\"\"\"\n         modules = set(sys.modules.keys())\n         return {s for s in modules if s.startswith(prefix)}\n \n+    def option_complete(self, prefix, cmd):\n+        \"\"\"Completes an option name, basing on content of man page.\"\"\"\n+        manpage = subprocess.Popen([\"man\", cmd], stdout=subprocess.PIPE)\n+        # This is a trick to get rid of reverse line feeds\n+        text = subprocess.check_output([\"col\", \"-b\"], stdin=manpage.stdout).decode('utf-8')\n+        pattern = r'^\\s*(-\\w|--[a-z-]+)[\\s,]'\n+        matches = re.findall(pattern, text, re.M)","path":"xonsh/completer.py","position":24,"original_position":24,"commit_id":"9ae796e4770ed86ac62cb8e9793335d7cd4f9b3c","original_commit_id":"9ae796e4770ed86ac62cb8e9793335d7cd4f9b3c","user":{"login":"scopatz","id":320553,"avatar_url":"https://avatars.githubusercontent.com/u/320553?v=3","gravatar_id":"","url":"https://api.github.com/users/scopatz","html_url":"https://github.com/scopatz","followers_url":"https://api.github.com/users/scopatz/followers","following_url":"https://api.github.com/users/scopatz/following{/other_user}","gists_url":"https://api.github.com/users/scopatz/gists{/gist_id}","starred_url":"https://api.github.com/users/scopatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopatz/subscriptions","organizations_url":"https://api.github.com/users/scopatz/orgs","repos_url":"https://api.github.com/users/scopatz/repos","events_url":"https://api.github.com/users/scopatz/events{/privacy}","received_events_url":"https://api.github.com/users/scopatz/received_events","type":"User","site_admin":false},"body":"Please precompile the regex globally. ","created_at":"2015-05-20T21:38:27Z","updated_at":"2015-05-20T21:38:27Z","html_url":"https://github.com/scopatz/xonsh/pull/248#discussion_r30752372","pull_request_url":"https://api.github.com/repos/scopatz/xonsh/pulls/248","_links":{"self":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/comments/30752372"},"html":{"href":"https://github.com/scopatz/xonsh/pull/248#discussion_r30752372"},"pull_request":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/248"}}},"pull_request":{"url":"https://api.github.com/repos/scopatz/xonsh/pulls/248","id":35827161,"html_url":"https://github.com/scopatz/xonsh/pull/248","diff_url":"https://github.com/scopatz/xonsh/pull/248.diff","patch_url":"https://github.com/scopatz/xonsh/pull/248.patch","issue_url":"https://api.github.com/repos/scopatz/xonsh/issues/248","number":248,"state":"open","locked":false,"title":"Completion from man pages","user":{"login":"zajaczajac","id":4266489,"avatar_url":"https://avatars.githubusercontent.com/u/4266489?v=3","gravatar_id":"","url":"https://api.github.com/users/zajaczajac","html_url":"https://github.com/zajaczajac","followers_url":"https://api.github.com/users/zajaczajac/followers","following_url":"https://api.github.com/users/zajaczajac/following{/other_user}","gists_url":"https://api.github.com/users/zajaczajac/gists{/gist_id}","starred_url":"https://api.github.com/users/zajaczajac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zajaczajac/subscriptions","organizations_url":"https://api.github.com/users/zajaczajac/orgs","repos_url":"https://api.github.com/users/zajaczajac/repos","events_url":"https://api.github.com/users/zajaczajac/events{/privacy}","received_events_url":"https://api.github.com/users/zajaczajac/received_events","type":"User","site_admin":false},"body":"This is a pull request concerning issue https://github.com/scopatz/xonsh/issues/247","created_at":"2015-05-20T12:40:46Z","updated_at":"2015-05-20T21:38:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"632055fbdd75819d80b4e1dd142d42c29c897e4b","assignee":null,"milestone":{"url":"https://api.github.com/repos/scopatz/xonsh/milestones/1","html_url":"https://github.com/scopatz/xonsh/milestones/v0.2","labels_url":"https://api.github.com/repos/scopatz/xonsh/milestones/1/labels","id":1013181,"number":1,"title":"v0.2","description":"","creator":{"login":"scopatz","id":320553,"avatar_url":"https://avatars.githubusercontent.com/u/320553?v=3","gravatar_id":"","url":"https://api.github.com/users/scopatz","html_url":"https://github.com/scopatz","followers_url":"https://api.github.com/users/scopatz/followers","following_url":"https://api.github.com/users/scopatz/following{/other_user}","gists_url":"https://api.github.com/users/scopatz/gists{/gist_id}","starred_url":"https://api.github.com/users/scopatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopatz/subscriptions","organizations_url":"https://api.github.com/users/scopatz/orgs","repos_url":"https://api.github.com/users/scopatz/repos","events_url":"https://api.github.com/users/scopatz/events{/privacy}","received_events_url":"https://api.github.com/users/scopatz/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":199,"state":"open","created_at":"2015-03-09T18:29:10Z","updated_at":"2015-05-20T21:35:41Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/scopatz/xonsh/pulls/248/commits","review_comments_url":"https://api.github.com/repos/scopatz/xonsh/pulls/248/comments","review_comment_url":"https://api.github.com/repos/scopatz/xonsh/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scopatz/xonsh/issues/248/comments","statuses_url":"https://api.github.com/repos/scopatz/xonsh/statuses/9ae796e4770ed86ac62cb8e9793335d7cd4f9b3c","head":{"label":"zajaczajac:master","ref":"master","sha":"9ae796e4770ed86ac62cb8e9793335d7cd4f9b3c","user":{"login":"zajaczajac","id":4266489,"avatar_url":"https://avatars.githubusercontent.com/u/4266489?v=3","gravatar_id":"","url":"https://api.github.com/users/zajaczajac","html_url":"https://github.com/zajaczajac","followers_url":"https://api.github.com/users/zajaczajac/followers","following_url":"https://api.github.com/users/zajaczajac/following{/other_user}","gists_url":"https://api.github.com/users/zajaczajac/gists{/gist_id}","starred_url":"https://api.github.com/users/zajaczajac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zajaczajac/subscriptions","organizations_url":"https://api.github.com/users/zajaczajac/orgs","repos_url":"https://api.github.com/users/zajaczajac/repos","events_url":"https://api.github.com/users/zajaczajac/events{/privacy}","received_events_url":"https://api.github.com/users/zajaczajac/received_events","type":"User","site_admin":false},"repo":{"id":35102789,"name":"xonsh","full_name":"zajaczajac/xonsh","owner":{"login":"zajaczajac","id":4266489,"avatar_url":"https://avatars.githubusercontent.com/u/4266489?v=3","gravatar_id":"","url":"https://api.github.com/users/zajaczajac","html_url":"https://github.com/zajaczajac","followers_url":"https://api.github.com/users/zajaczajac/followers","following_url":"https://api.github.com/users/zajaczajac/following{/other_user}","gists_url":"https://api.github.com/users/zajaczajac/gists{/gist_id}","starred_url":"https://api.github.com/users/zajaczajac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zajaczajac/subscriptions","organizations_url":"https://api.github.com/users/zajaczajac/orgs","repos_url":"https://api.github.com/users/zajaczajac/repos","events_url":"https://api.github.com/users/zajaczajac/events{/privacy}","received_events_url":"https://api.github.com/users/zajaczajac/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zajaczajac/xonsh","description":"xonsh is a Python-ish, BASHwards-compatible shell.","fork":true,"url":"https://api.github.com/repos/zajaczajac/xonsh","forks_url":"https://api.github.com/repos/zajaczajac/xonsh/forks","keys_url":"https://api.github.com/repos/zajaczajac/xonsh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zajaczajac/xonsh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zajaczajac/xonsh/teams","hooks_url":"https://api.github.com/repos/zajaczajac/xonsh/hooks","issue_events_url":"https://api.github.com/repos/zajaczajac/xonsh/issues/events{/number}","events_url":"https://api.github.com/repos/zajaczajac/xonsh/events","assignees_url":"https://api.github.com/repos/zajaczajac/xonsh/assignees{/user}","branches_url":"https://api.github.com/repos/zajaczajac/xonsh/branches{/branch}","tags_url":"https://api.github.com/repos/zajaczajac/xonsh/tags","blobs_url":"https://api.github.com/repos/zajaczajac/xonsh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zajaczajac/xonsh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zajaczajac/xonsh/git/refs{/sha}","trees_url":"https://api.github.com/repos/zajaczajac/xonsh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zajaczajac/xonsh/statuses/{sha}","languages_url":"https://api.github.com/repos/zajaczajac/xonsh/languages","stargazers_url":"https://api.github.com/repos/zajaczajac/xonsh/stargazers","contributors_url":"https://api.github.com/repos/zajaczajac/xonsh/contributors","subscribers_url":"https://api.github.com/repos/zajaczajac/xonsh/subscribers","subscription_url":"https://api.github.com/repos/zajaczajac/xonsh/subscription","commits_url":"https://api.github.com/repos/zajaczajac/xonsh/commits{/sha}","git_commits_url":"https://api.github.com/repos/zajaczajac/xonsh/git/commits{/sha}","comments_url":"https://api.github.com/repos/zajaczajac/xonsh/comments{/number}","issue_comment_url":"https://api.github.com/repos/zajaczajac/xonsh/issues/comments{/number}","contents_url":"https://api.github.com/repos/zajaczajac/xonsh/contents/{+path}","compare_url":"https://api.github.com/repos/zajaczajac/xonsh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zajaczajac/xonsh/merges","archive_url":"https://api.github.com/repos/zajaczajac/xonsh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zajaczajac/xonsh/downloads","issues_url":"https://api.github.com/repos/zajaczajac/xonsh/issues{/number}","pulls_url":"https://api.github.com/repos/zajaczajac/xonsh/pulls{/number}","milestones_url":"https://api.github.com/repos/zajaczajac/xonsh/milestones{/number}","notifications_url":"https://api.github.com/repos/zajaczajac/xonsh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zajaczajac/xonsh/labels{/name}","releases_url":"https://api.github.com/repos/zajaczajac/xonsh/releases{/id}","created_at":"2015-05-05T13:52:24Z","updated_at":"2015-05-06T15:00:10Z","pushed_at":"2015-05-19T16:07:42Z","git_url":"git://github.com/zajaczajac/xonsh.git","ssh_url":"git@github.com:zajaczajac/xonsh.git","clone_url":"https://github.com/zajaczajac/xonsh.git","svn_url":"https://github.com/zajaczajac/xonsh","homepage":"http://xonsh.org","size":2098,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"scopatz:master","ref":"master","sha":"f3f9f0a8c26f263eee77675d55ec3211fda616b6","user":{"login":"scopatz","id":320553,"avatar_url":"https://avatars.githubusercontent.com/u/320553?v=3","gravatar_id":"","url":"https://api.github.com/users/scopatz","html_url":"https://github.com/scopatz","followers_url":"https://api.github.com/users/scopatz/followers","following_url":"https://api.github.com/users/scopatz/following{/other_user}","gists_url":"https://api.github.com/users/scopatz/gists{/gist_id}","starred_url":"https://api.github.com/users/scopatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopatz/subscriptions","organizations_url":"https://api.github.com/users/scopatz/orgs","repos_url":"https://api.github.com/users/scopatz/repos","events_url":"https://api.github.com/users/scopatz/events{/privacy}","received_events_url":"https://api.github.com/users/scopatz/received_events","type":"User","site_admin":false},"repo":{"id":29620400,"name":"xonsh","full_name":"scopatz/xonsh","owner":{"login":"scopatz","id":320553,"avatar_url":"https://avatars.githubusercontent.com/u/320553?v=3","gravatar_id":"","url":"https://api.github.com/users/scopatz","html_url":"https://github.com/scopatz","followers_url":"https://api.github.com/users/scopatz/followers","following_url":"https://api.github.com/users/scopatz/following{/other_user}","gists_url":"https://api.github.com/users/scopatz/gists{/gist_id}","starred_url":"https://api.github.com/users/scopatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopatz/subscriptions","organizations_url":"https://api.github.com/users/scopatz/orgs","repos_url":"https://api.github.com/users/scopatz/repos","events_url":"https://api.github.com/users/scopatz/events{/privacy}","received_events_url":"https://api.github.com/users/scopatz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/scopatz/xonsh","description":"xonsh is a Python-ish, BASHwards-compatible shell.","fork":false,"url":"https://api.github.com/repos/scopatz/xonsh","forks_url":"https://api.github.com/repos/scopatz/xonsh/forks","keys_url":"https://api.github.com/repos/scopatz/xonsh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scopatz/xonsh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scopatz/xonsh/teams","hooks_url":"https://api.github.com/repos/scopatz/xonsh/hooks","issue_events_url":"https://api.github.com/repos/scopatz/xonsh/issues/events{/number}","events_url":"https://api.github.com/repos/scopatz/xonsh/events","assignees_url":"https://api.github.com/repos/scopatz/xonsh/assignees{/user}","branches_url":"https://api.github.com/repos/scopatz/xonsh/branches{/branch}","tags_url":"https://api.github.com/repos/scopatz/xonsh/tags","blobs_url":"https://api.github.com/repos/scopatz/xonsh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scopatz/xonsh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scopatz/xonsh/git/refs{/sha}","trees_url":"https://api.github.com/repos/scopatz/xonsh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scopatz/xonsh/statuses/{sha}","languages_url":"https://api.github.com/repos/scopatz/xonsh/languages","stargazers_url":"https://api.github.com/repos/scopatz/xonsh/stargazers","contributors_url":"https://api.github.com/repos/scopatz/xonsh/contributors","subscribers_url":"https://api.github.com/repos/scopatz/xonsh/subscribers","subscription_url":"https://api.github.com/repos/scopatz/xonsh/subscription","commits_url":"https://api.github.com/repos/scopatz/xonsh/commits{/sha}","git_commits_url":"https://api.github.com/repos/scopatz/xonsh/git/commits{/sha}","comments_url":"https://api.github.com/repos/scopatz/xonsh/comments{/number}","issue_comment_url":"https://api.github.com/repos/scopatz/xonsh/issues/comments{/number}","contents_url":"https://api.github.com/repos/scopatz/xonsh/contents/{+path}","compare_url":"https://api.github.com/repos/scopatz/xonsh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scopatz/xonsh/merges","archive_url":"https://api.github.com/repos/scopatz/xonsh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scopatz/xonsh/downloads","issues_url":"https://api.github.com/repos/scopatz/xonsh/issues{/number}","pulls_url":"https://api.github.com/repos/scopatz/xonsh/pulls{/number}","milestones_url":"https://api.github.com/repos/scopatz/xonsh/milestones{/number}","notifications_url":"https://api.github.com/repos/scopatz/xonsh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scopatz/xonsh/labels{/name}","releases_url":"https://api.github.com/repos/scopatz/xonsh/releases{/id}","created_at":"2015-01-21T22:05:27Z","updated_at":"2015-05-17T01:19:19Z","pushed_at":"2015-05-20T18:48:49Z","git_url":"git://github.com/scopatz/xonsh.git","ssh_url":"git@github.com:scopatz/xonsh.git","clone_url":"https://github.com/scopatz/xonsh.git","svn_url":"https://github.com/scopatz/xonsh","homepage":"http://xonsh.org","size":5360,"stargazers_count":373,"watchers_count":373,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":40,"forks":36,"open_issues":40,"watchers":373,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/248"},"html":{"href":"https://github.com/scopatz/xonsh/pull/248"},"issue":{"href":"https://api.github.com/repos/scopatz/xonsh/issues/248"},"comments":{"href":"https://api.github.com/repos/scopatz/xonsh/issues/248/comments"},"review_comments":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/248/comments"},"review_comment":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/248/commits"},"statuses":{"href":"https://api.github.com/repos/scopatz/xonsh/statuses/9ae796e4770ed86ac62cb8e9793335d7cd4f9b3c"}}}}