{"action":"created","comment":{"url":"https://api.github.com/repos/dotnil/ssh-config/pulls/comments/33672236","id":33672236,"diff_hunk":"@@ -8,22 +8,37 @@ var sshConfig = require('..')\n \n describe('ssh-config', function() {\n   var fixture = fs.readFileSync(path.join(__dirname, 'fixture/config'), 'utf-8')\n+    .replace(/\\r\\n/g, '\\n')\n   var config = sshConfig.parse(fixture)\n \n-  it('.parse', function() {\n+  it('.parse ssh config text into object', function() {\n     expect(config.ControlMaster).to.equal('auto')\n-    expect(config.length).to.equal(2)\n+    expect(config.length).to.equal(4)\n \n     expect(config[0]).to.eql({\n       Host: 'tahoe1',\n-      HostName: 'tahoe1.linode',\n-      User: 'nil',\n-      ProxyCommand: 'ssh -q gateway -W %h:%p',\n-      ForwardAgent: 'true'\n+      HostName: 'tahoe1.com',\n+      Compression: 'yes'\n     })\n   })\n \n-  it('.stringify', function() {\n+  it('.query ssh config by host', function() {\n+    var opts = config.query('tahoe2')\n+\n+    expect(opts.User).to.equal('nil')\n+    expect(opts.IdentityFile).to.equal('~/.ssh/id_rsa')\n+\n+    // the first obtained parameter value will be used. So there's no way to\n+    // override parameter values.\n+    expect(opts.ServerAliveInterval).to.eql(80)\n+\n+    opts = config.query('tahoe1')\n+    expect(opts.User).to.equal('nil')\n+    expect(opts.ForwardAgent).to.equal('true')\n+    expect(opts.Compression).to.equal('yes')","path":"test/test.ssh-config.js","position":44,"original_position":44,"commit_id":"482500f4d079a27477366e7e0274ac0341985e1d","original_commit_id":"482500f4d079a27477366e7e0274ac0341985e1d","user":{"login":"dotnil","id":252317,"avatar_url":"https://avatars.githubusercontent.com/u/252317?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnil","html_url":"https://github.com/dotnil","followers_url":"https://api.github.com/users/dotnil/followers","following_url":"https://api.github.com/users/dotnil/following{/other_user}","gists_url":"https://api.github.com/users/dotnil/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnil/subscriptions","organizations_url":"https://api.github.com/users/dotnil/orgs","repos_url":"https://api.github.com/users/dotnil/repos","events_url":"https://api.github.com/users/dotnil/events{/privacy}","received_events_url":"https://api.github.com/users/dotnil/received_events","type":"User","site_admin":false},"body":"哈哈忘了，一开始的 fixture 不是这样的，被我改过","created_at":"2015-07-01T12:13:50Z","updated_at":"2015-07-01T12:13:50Z","html_url":"https://github.com/dotnil/ssh-config/pull/2#discussion_r33672236","pull_request_url":"https://api.github.com/repos/dotnil/ssh-config/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/dotnil/ssh-config/pulls/comments/33672236"},"html":{"href":"https://github.com/dotnil/ssh-config/pull/2#discussion_r33672236"},"pull_request":{"href":"https://api.github.com/repos/dotnil/ssh-config/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/dotnil/ssh-config/pulls/2","id":38889343,"html_url":"https://github.com/dotnil/ssh-config/pull/2","diff_url":"https://github.com/dotnil/ssh-config/pull/2.diff","patch_url":"https://github.com/dotnil/ssh-config/pull/2.patch","issue_url":"https://api.github.com/repos/dotnil/ssh-config/issues/2","number":2,"state":"open","locked":false,"title":"Implemented .query and support pattern matching (poorly)","user":{"login":"dotnil","id":252317,"avatar_url":"https://avatars.githubusercontent.com/u/252317?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnil","html_url":"https://github.com/dotnil","followers_url":"https://api.github.com/users/dotnil/followers","following_url":"https://api.github.com/users/dotnil/following{/other_user}","gists_url":"https://api.github.com/users/dotnil/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnil/subscriptions","organizations_url":"https://api.github.com/users/dotnil/orgs","repos_url":"https://api.github.com/users/dotnil/repos","events_url":"https://api.github.com/users/dotnil/events{/privacy}","received_events_url":"https://api.github.com/users/dotnil/received_events","type":"User","site_admin":false},"body":"Fixes #1 ","created_at":"2015-06-30T15:15:48Z","updated_at":"2015-07-01T12:13:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"35895e14ae6d335c0eec5c1f83c720151a3a0553","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnil/ssh-config/pulls/2/commits","review_comments_url":"https://api.github.com/repos/dotnil/ssh-config/pulls/2/comments","review_comment_url":"https://api.github.com/repos/dotnil/ssh-config/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnil/ssh-config/issues/2/comments","statuses_url":"https://api.github.com/repos/dotnil/ssh-config/statuses/482500f4d079a27477366e7e0274ac0341985e1d","head":{"label":"dotnil:add-query","ref":"add-query","sha":"482500f4d079a27477366e7e0274ac0341985e1d","user":{"login":"dotnil","id":252317,"avatar_url":"https://avatars.githubusercontent.com/u/252317?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnil","html_url":"https://github.com/dotnil","followers_url":"https://api.github.com/users/dotnil/followers","following_url":"https://api.github.com/users/dotnil/following{/other_user}","gists_url":"https://api.github.com/users/dotnil/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnil/subscriptions","organizations_url":"https://api.github.com/users/dotnil/orgs","repos_url":"https://api.github.com/users/dotnil/repos","events_url":"https://api.github.com/users/dotnil/events{/privacy}","received_events_url":"https://api.github.com/users/dotnil/received_events","type":"User","site_admin":false},"repo":{"id":29115613,"name":"ssh-config","full_name":"dotnil/ssh-config","owner":{"login":"dotnil","id":252317,"avatar_url":"https://avatars.githubusercontent.com/u/252317?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnil","html_url":"https://github.com/dotnil","followers_url":"https://api.github.com/users/dotnil/followers","following_url":"https://api.github.com/users/dotnil/following{/other_user}","gists_url":"https://api.github.com/users/dotnil/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnil/subscriptions","organizations_url":"https://api.github.com/users/dotnil/orgs","repos_url":"https://api.github.com/users/dotnil/repos","events_url":"https://api.github.com/users/dotnil/events{/privacy}","received_events_url":"https://api.github.com/users/dotnil/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dotnil/ssh-config","description":"SSH config parser and stringifier","fork":false,"url":"https://api.github.com/repos/dotnil/ssh-config","forks_url":"https://api.github.com/repos/dotnil/ssh-config/forks","keys_url":"https://api.github.com/repos/dotnil/ssh-config/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnil/ssh-config/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnil/ssh-config/teams","hooks_url":"https://api.github.com/repos/dotnil/ssh-config/hooks","issue_events_url":"https://api.github.com/repos/dotnil/ssh-config/issues/events{/number}","events_url":"https://api.github.com/repos/dotnil/ssh-config/events","assignees_url":"https://api.github.com/repos/dotnil/ssh-config/assignees{/user}","branches_url":"https://api.github.com/repos/dotnil/ssh-config/branches{/branch}","tags_url":"https://api.github.com/repos/dotnil/ssh-config/tags","blobs_url":"https://api.github.com/repos/dotnil/ssh-config/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnil/ssh-config/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnil/ssh-config/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnil/ssh-config/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnil/ssh-config/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnil/ssh-config/languages","stargazers_url":"https://api.github.com/repos/dotnil/ssh-config/stargazers","contributors_url":"https://api.github.com/repos/dotnil/ssh-config/contributors","subscribers_url":"https://api.github.com/repos/dotnil/ssh-config/subscribers","subscription_url":"https://api.github.com/repos/dotnil/ssh-config/subscription","commits_url":"https://api.github.com/repos/dotnil/ssh-config/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnil/ssh-config/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnil/ssh-config/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnil/ssh-config/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnil/ssh-config/contents/{+path}","compare_url":"https://api.github.com/repos/dotnil/ssh-config/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnil/ssh-config/merges","archive_url":"https://api.github.com/repos/dotnil/ssh-config/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnil/ssh-config/downloads","issues_url":"https://api.github.com/repos/dotnil/ssh-config/issues{/number}","pulls_url":"https://api.github.com/repos/dotnil/ssh-config/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnil/ssh-config/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnil/ssh-config/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnil/ssh-config/labels{/name}","releases_url":"https://api.github.com/repos/dotnil/ssh-config/releases{/id}","created_at":"2015-01-12T02:47:35Z","updated_at":"2015-07-01T02:51:33Z","pushed_at":"2015-07-01T02:47:38Z","git_url":"git://github.com/dotnil/ssh-config.git","ssh_url":"git@github.com:dotnil/ssh-config.git","clone_url":"https://github.com/dotnil/ssh-config.git","svn_url":"https://github.com/dotnil/ssh-config","homepage":"","size":134,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":3,"default_branch":"master"}},"base":{"label":"dotnil:master","ref":"master","sha":"aa75c1e2cdb8526e900fa296536325dd4c1d8698","user":{"login":"dotnil","id":252317,"avatar_url":"https://avatars.githubusercontent.com/u/252317?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnil","html_url":"https://github.com/dotnil","followers_url":"https://api.github.com/users/dotnil/followers","following_url":"https://api.github.com/users/dotnil/following{/other_user}","gists_url":"https://api.github.com/users/dotnil/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnil/subscriptions","organizations_url":"https://api.github.com/users/dotnil/orgs","repos_url":"https://api.github.com/users/dotnil/repos","events_url":"https://api.github.com/users/dotnil/events{/privacy}","received_events_url":"https://api.github.com/users/dotnil/received_events","type":"User","site_admin":false},"repo":{"id":29115613,"name":"ssh-config","full_name":"dotnil/ssh-config","owner":{"login":"dotnil","id":252317,"avatar_url":"https://avatars.githubusercontent.com/u/252317?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnil","html_url":"https://github.com/dotnil","followers_url":"https://api.github.com/users/dotnil/followers","following_url":"https://api.github.com/users/dotnil/following{/other_user}","gists_url":"https://api.github.com/users/dotnil/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnil/subscriptions","organizations_url":"https://api.github.com/users/dotnil/orgs","repos_url":"https://api.github.com/users/dotnil/repos","events_url":"https://api.github.com/users/dotnil/events{/privacy}","received_events_url":"https://api.github.com/users/dotnil/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dotnil/ssh-config","description":"SSH config parser and stringifier","fork":false,"url":"https://api.github.com/repos/dotnil/ssh-config","forks_url":"https://api.github.com/repos/dotnil/ssh-config/forks","keys_url":"https://api.github.com/repos/dotnil/ssh-config/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnil/ssh-config/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnil/ssh-config/teams","hooks_url":"https://api.github.com/repos/dotnil/ssh-config/hooks","issue_events_url":"https://api.github.com/repos/dotnil/ssh-config/issues/events{/number}","events_url":"https://api.github.com/repos/dotnil/ssh-config/events","assignees_url":"https://api.github.com/repos/dotnil/ssh-config/assignees{/user}","branches_url":"https://api.github.com/repos/dotnil/ssh-config/branches{/branch}","tags_url":"https://api.github.com/repos/dotnil/ssh-config/tags","blobs_url":"https://api.github.com/repos/dotnil/ssh-config/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnil/ssh-config/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnil/ssh-config/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnil/ssh-config/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnil/ssh-config/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnil/ssh-config/languages","stargazers_url":"https://api.github.com/repos/dotnil/ssh-config/stargazers","contributors_url":"https://api.github.com/repos/dotnil/ssh-config/contributors","subscribers_url":"https://api.github.com/repos/dotnil/ssh-config/subscribers","subscription_url":"https://api.github.com/repos/dotnil/ssh-config/subscription","commits_url":"https://api.github.com/repos/dotnil/ssh-config/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnil/ssh-config/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnil/ssh-config/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnil/ssh-config/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnil/ssh-config/contents/{+path}","compare_url":"https://api.github.com/repos/dotnil/ssh-config/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnil/ssh-config/merges","archive_url":"https://api.github.com/repos/dotnil/ssh-config/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnil/ssh-config/downloads","issues_url":"https://api.github.com/repos/dotnil/ssh-config/issues{/number}","pulls_url":"https://api.github.com/repos/dotnil/ssh-config/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnil/ssh-config/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnil/ssh-config/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnil/ssh-config/labels{/name}","releases_url":"https://api.github.com/repos/dotnil/ssh-config/releases{/id}","created_at":"2015-01-12T02:47:35Z","updated_at":"2015-07-01T02:51:33Z","pushed_at":"2015-07-01T02:47:38Z","git_url":"git://github.com/dotnil/ssh-config.git","ssh_url":"git@github.com:dotnil/ssh-config.git","clone_url":"https://github.com/dotnil/ssh-config.git","svn_url":"https://github.com/dotnil/ssh-config","homepage":"","size":134,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnil/ssh-config/pulls/2"},"html":{"href":"https://github.com/dotnil/ssh-config/pull/2"},"issue":{"href":"https://api.github.com/repos/dotnil/ssh-config/issues/2"},"comments":{"href":"https://api.github.com/repos/dotnil/ssh-config/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnil/ssh-config/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnil/ssh-config/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnil/ssh-config/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/dotnil/ssh-config/statuses/482500f4d079a27477366e7e0274ac0341985e1d"}}}}