{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/44506718","id":44506718,"diff_hunk":"@@ -190,15 +194,59 @@ be emitted.\n Example of listening for `reset`:\n \n     // Extend the initial repl context.\n-    var r = repl.start({ options ... });\n+    var replServer = repl.start({ options ... });\n     someExtension.extend(r.context);\n \n     // When a new context is created extend it as well.\n-    r.on('reset', function (context) {\n+    replServer.on('reset', function (context) {\n       console.log('repl has a new context');\n       someExtension.extend(context);\n     });\n \n+### replServer.displayPrompt([preserveCursor])\n+\n+* `preserveCursor` {Boolean}\n+\n+Like [readline.prompt][] except also adding indents with ellipses when inside\n+blocks. The `preserveCursor` argument is passed to [readline.prompt][]. This is\n+used primarily with `defineCommand`. It's also used internally to render each\n+prompt line.\n+\n+### replServer.defineCommand(keyword, cmd)\n+\n+* `keyword` {String}\n+* `cmd` {Object|Function}\n+\n+Makes a command available in the REPL. In the REPL, the command is invoked by","path":"doc/api/repl.markdown","position":49,"original_position":49,"commit_id":"a7d042df9300ae156951efc71fc1e8781d72691d","original_commit_id":"a7d042df9300ae156951efc71fc1e8781d72691d","user":{"login":"Trott","id":718899,"avatar_url":"https://avatars.githubusercontent.com/u/718899?v=3","gravatar_id":"","url":"https://api.github.com/users/Trott","html_url":"https://github.com/Trott","followers_url":"https://api.github.com/users/Trott/followers","following_url":"https://api.github.com/users/Trott/following{/other_user}","gists_url":"https://api.github.com/users/Trott/gists{/gist_id}","starred_url":"https://api.github.com/users/Trott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Trott/subscriptions","organizations_url":"https://api.github.com/users/Trott/orgs","repos_url":"https://api.github.com/users/Trott/repos","events_url":"https://api.github.com/users/Trott/events{/privacy}","received_events_url":"https://api.github.com/users/Trott/received_events","type":"User","site_admin":false},"body":"Nit: No need to repeat \"in the REPL\" twice. Eliminate the second occurrence?","created_at":"2015-11-11T07:06:41Z","updated_at":"2015-11-11T07:06:41Z","html_url":"https://github.com/nodejs/node/pull/3765#discussion_r44506718","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/3765","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/44506718"},"html":{"href":"https://github.com/nodejs/node/pull/3765#discussion_r44506718"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/3765"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/3765","id":50353228,"html_url":"https://github.com/nodejs/node/pull/3765","diff_url":"https://github.com/nodejs/node/pull/3765.diff","patch_url":"https://github.com/nodejs/node/pull/3765.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/3765","number":3765,"state":"open","locked":false,"title":"doc: repl: add defineComand and displayPrompt","user":{"login":"bengl","id":110455,"avatar_url":"https://avatars.githubusercontent.com/u/110455?v=3","gravatar_id":"","url":"https://api.github.com/users/bengl","html_url":"https://github.com/bengl","followers_url":"https://api.github.com/users/bengl/followers","following_url":"https://api.github.com/users/bengl/following{/other_user}","gists_url":"https://api.github.com/users/bengl/gists{/gist_id}","starred_url":"https://api.github.com/users/bengl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bengl/subscriptions","organizations_url":"https://api.github.com/users/bengl/orgs","repos_url":"https://api.github.com/users/bengl/repos","events_url":"https://api.github.com/users/bengl/events{/privacy}","received_events_url":"https://api.github.com/users/bengl/received_events","type":"User","site_admin":false},"body":"Also some minor edits so the additions make sense.\r\n\r\nI've used `defineCommand` several times now, figuring out how to use it by viewing the source. I figured it probably should be documented.","created_at":"2015-11-11T06:46:58Z","updated_at":"2015-11-11T07:06:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5704a957061a814beb64035f3f14636cffb3a210","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/3765/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/3765/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/3765/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/a7d042df9300ae156951efc71fc1e8781d72691d","head":{"label":"bengl:definecommanddocs","ref":"definecommanddocs","sha":"a7d042df9300ae156951efc71fc1e8781d72691d","user":{"login":"bengl","id":110455,"avatar_url":"https://avatars.githubusercontent.com/u/110455?v=3","gravatar_id":"","url":"https://api.github.com/users/bengl","html_url":"https://github.com/bengl","followers_url":"https://api.github.com/users/bengl/followers","following_url":"https://api.github.com/users/bengl/following{/other_user}","gists_url":"https://api.github.com/users/bengl/gists{/gist_id}","starred_url":"https://api.github.com/users/bengl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bengl/subscriptions","organizations_url":"https://api.github.com/users/bengl/orgs","repos_url":"https://api.github.com/users/bengl/repos","events_url":"https://api.github.com/users/bengl/events{/privacy}","received_events_url":"https://api.github.com/users/bengl/received_events","type":"User","site_admin":false},"repo":{"id":45964268,"name":"node","full_name":"bengl/node","owner":{"login":"bengl","id":110455,"avatar_url":"https://avatars.githubusercontent.com/u/110455?v=3","gravatar_id":"","url":"https://api.github.com/users/bengl","html_url":"https://github.com/bengl","followers_url":"https://api.github.com/users/bengl/followers","following_url":"https://api.github.com/users/bengl/following{/other_user}","gists_url":"https://api.github.com/users/bengl/gists{/gist_id}","starred_url":"https://api.github.com/users/bengl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bengl/subscriptions","organizations_url":"https://api.github.com/users/bengl/orgs","repos_url":"https://api.github.com/users/bengl/repos","events_url":"https://api.github.com/users/bengl/events{/privacy}","received_events_url":"https://api.github.com/users/bengl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bengl/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":true,"url":"https://api.github.com/repos/bengl/node","forks_url":"https://api.github.com/repos/bengl/node/forks","keys_url":"https://api.github.com/repos/bengl/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bengl/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bengl/node/teams","hooks_url":"https://api.github.com/repos/bengl/node/hooks","issue_events_url":"https://api.github.com/repos/bengl/node/issues/events{/number}","events_url":"https://api.github.com/repos/bengl/node/events","assignees_url":"https://api.github.com/repos/bengl/node/assignees{/user}","branches_url":"https://api.github.com/repos/bengl/node/branches{/branch}","tags_url":"https://api.github.com/repos/bengl/node/tags","blobs_url":"https://api.github.com/repos/bengl/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bengl/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bengl/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/bengl/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bengl/node/statuses/{sha}","languages_url":"https://api.github.com/repos/bengl/node/languages","stargazers_url":"https://api.github.com/repos/bengl/node/stargazers","contributors_url":"https://api.github.com/repos/bengl/node/contributors","subscribers_url":"https://api.github.com/repos/bengl/node/subscribers","subscription_url":"https://api.github.com/repos/bengl/node/subscription","commits_url":"https://api.github.com/repos/bengl/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/bengl/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/bengl/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/bengl/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/bengl/node/contents/{+path}","compare_url":"https://api.github.com/repos/bengl/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bengl/node/merges","archive_url":"https://api.github.com/repos/bengl/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bengl/node/downloads","issues_url":"https://api.github.com/repos/bengl/node/issues{/number}","pulls_url":"https://api.github.com/repos/bengl/node/pulls{/number}","milestones_url":"https://api.github.com/repos/bengl/node/milestones{/number}","notifications_url":"https://api.github.com/repos/bengl/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bengl/node/labels{/name}","releases_url":"https://api.github.com/repos/bengl/node/releases{/id}","created_at":"2015-11-11T06:37:09Z","updated_at":"2015-11-11T06:37:30Z","pushed_at":"2015-11-11T06:40:13Z","git_url":"git://github.com/bengl/node.git","ssh_url":"git@github.com:bengl/node.git","clone_url":"https://github.com/bengl/node.git","svn_url":"https://github.com/bengl/node","homepage":"https://nodejs.org","size":386108,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"nodejs:master","ref":"master","sha":"25cd455407e78a77eaf96f4057e480451f84bd46","user":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"name":"node","full_name":"nodejs/node","owner":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodejs/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":false,"url":"https://api.github.com/repos/nodejs/node","forks_url":"https://api.github.com/repos/nodejs/node/forks","keys_url":"https://api.github.com/repos/nodejs/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/node/teams","hooks_url":"https://api.github.com/repos/nodejs/node/hooks","issue_events_url":"https://api.github.com/repos/nodejs/node/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/node/events","assignees_url":"https://api.github.com/repos/nodejs/node/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/node/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/node/tags","blobs_url":"https://api.github.com/repos/nodejs/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/node/languages","stargazers_url":"https://api.github.com/repos/nodejs/node/stargazers","contributors_url":"https://api.github.com/repos/nodejs/node/contributors","subscribers_url":"https://api.github.com/repos/nodejs/node/subscribers","subscription_url":"https://api.github.com/repos/nodejs/node/subscription","commits_url":"https://api.github.com/repos/nodejs/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/node/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/node/merges","archive_url":"https://api.github.com/repos/nodejs/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/node/downloads","issues_url":"https://api.github.com/repos/nodejs/node/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/node/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/node/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/node/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/node/releases{/id}","created_at":"2014-11-26T19:57:11Z","updated_at":"2015-11-11T06:30:34Z","pushed_at":"2015-11-11T06:46:58Z","git_url":"git://github.com/nodejs/node.git","ssh_url":"git@github.com:nodejs/node.git","clone_url":"https://github.com/nodejs/node.git","svn_url":"https://github.com/nodejs/node","homepage":"https://nodejs.org","size":386108,"stargazers_count":17223,"watchers_count":17223,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1751,"mirror_url":null,"open_issues_count":565,"forks":1751,"open_issues":565,"watchers":17223,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/3765"},"html":{"href":"https://github.com/nodejs/node/pull/3765"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/3765"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/3765/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/3765/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/3765/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/a7d042df9300ae156951efc71fc1e8781d72691d"}}}}