{"action":"created","comment":{"url":"https://api.github.com/repos/runtimejs/runtime/pulls/comments/32888882","id":32888882,"diff_hunk":"@@ -44,3 +44,20 @@ exports.setCommand = function(name, cb) {\n   assert(typeutils.isFunction(cb));\n   commands.set(name, cb);\n };\n+\n+exports.runCommand = function(name, args, cb) {\n+  var capture = require('./captureio.js');\n+\n+  assert(typeutils.isString(name));\n+\n+  args = args || \"\";\n+\n+  commands.get(name)(args, capture.io, function() { capture.events.emit('end'); });\n+\n+  if (cb) {\n+    capture.events.redrawPrompt = inputBox.done;\n+    cb(capture.events);\n+  }","path":"js/service/shell/index.js","position":26,"original_position":26,"commit_id":"c0fa106f28bb07300a55a973952baa8084f54eef","original_commit_id":"c0fa106f28bb07300a55a973952baa8084f54eef","user":{"login":"ArielAbreu","id":11756574,"avatar_url":"https://avatars.githubusercontent.com/u/11756574?v=3","gravatar_id":"","url":"https://api.github.com/users/ArielAbreu","html_url":"https://github.com/ArielAbreu","followers_url":"https://api.github.com/users/ArielAbreu/followers","following_url":"https://api.github.com/users/ArielAbreu/following{/other_user}","gists_url":"https://api.github.com/users/ArielAbreu/gists{/gist_id}","starred_url":"https://api.github.com/users/ArielAbreu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArielAbreu/subscriptions","organizations_url":"https://api.github.com/users/ArielAbreu/orgs","repos_url":"https://api.github.com/users/ArielAbreu/repos","events_url":"https://api.github.com/users/ArielAbreu/events{/privacy}","received_events_url":"https://api.github.com/users/ArielAbreu/received_events","type":"User","site_admin":false},"body":"1: The callback is `socket.io` style, where it gives you an EventEmitter that allows you emit events and receive events.\r\n2: The callback isn't required, you probably saw that it returns the EE as well, so it can be set to a variable and used from there.","created_at":"2015-06-20T22:46:00Z","updated_at":"2015-06-20T22:46:00Z","html_url":"https://github.com/runtimejs/runtime/pull/60#discussion_r32888882","pull_request_url":"https://api.github.com/repos/runtimejs/runtime/pulls/60","_links":{"self":{"href":"https://api.github.com/repos/runtimejs/runtime/pulls/comments/32888882"},"html":{"href":"https://github.com/runtimejs/runtime/pull/60#discussion_r32888882"},"pull_request":{"href":"https://api.github.com/repos/runtimejs/runtime/pulls/60"}}},"pull_request":{"url":"https://api.github.com/repos/runtimejs/runtime/pulls/60","id":38106594,"html_url":"https://github.com/runtimejs/runtime/pull/60","diff_url":"https://github.com/runtimejs/runtime/pull/60.diff","patch_url":"https://github.com/runtimejs/runtime/pull/60.patch","issue_url":"https://api.github.com/repos/runtimejs/runtime/issues/60","number":60,"state":"open","locked":false,"title":"Add run command and get features","user":{"login":"ArielAbreu","id":11756574,"avatar_url":"https://avatars.githubusercontent.com/u/11756574?v=3","gravatar_id":"","url":"https://api.github.com/users/ArielAbreu","html_url":"https://github.com/ArielAbreu","followers_url":"https://api.github.com/users/ArielAbreu/followers","following_url":"https://api.github.com/users/ArielAbreu/following{/other_user}","gists_url":"https://api.github.com/users/ArielAbreu/gists{/gist_id}","starred_url":"https://api.github.com/users/ArielAbreu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArielAbreu/subscriptions","organizations_url":"https://api.github.com/users/ArielAbreu/orgs","repos_url":"https://api.github.com/users/ArielAbreu/repos","events_url":"https://api.github.com/users/ArielAbreu/events{/privacy}","received_events_url":"https://api.github.com/users/ArielAbreu/received_events","type":"User","site_admin":false},"body":"This adds a run commands feature to `runtime.shell`. If you get an error with the `args` parameter, add a space at the beginning of the string.\r\nUsage:\r\n```javascript\r\nruntime.shell.runCommand(commandName, [arguments]);\r\n// Example:\r\nruntime.shell.runCommand(\"echo\", \" hey\");\r\n```\r\n\r\nUPDATE:\r\nI just added a `get` function to `runtime.tty`, which allows you to get text from the user easily.\r\nIt returns an `EventController` object that you can listen to.\r\nUsage:\r\n```javascript\r\nvar foo = runtime.tty.get();\r\nfoo.add(function(text) {\r\n  runtime.tty.print(text);\r\n  // or whatever you want to do with `text`\r\n});\r\n```","created_at":"2015-06-19T13:20:52Z","updated_at":"2015-06-20T22:46:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b201859d9c0dd1f7f35e34059ad78317dc73dbc4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/runtimejs/runtime/pulls/60/commits","review_comments_url":"https://api.github.com/repos/runtimejs/runtime/pulls/60/comments","review_comment_url":"https://api.github.com/repos/runtimejs/runtime/pulls/comments{/number}","comments_url":"https://api.github.com/repos/runtimejs/runtime/issues/60/comments","statuses_url":"https://api.github.com/repos/runtimejs/runtime/statuses/c0fa106f28bb07300a55a973952baa8084f54eef","head":{"label":"ArielAbreu:easy-input","ref":"easy-input","sha":"c0fa106f28bb07300a55a973952baa8084f54eef","user":{"login":"ArielAbreu","id":11756574,"avatar_url":"https://avatars.githubusercontent.com/u/11756574?v=3","gravatar_id":"","url":"https://api.github.com/users/ArielAbreu","html_url":"https://github.com/ArielAbreu","followers_url":"https://api.github.com/users/ArielAbreu/followers","following_url":"https://api.github.com/users/ArielAbreu/following{/other_user}","gists_url":"https://api.github.com/users/ArielAbreu/gists{/gist_id}","starred_url":"https://api.github.com/users/ArielAbreu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArielAbreu/subscriptions","organizations_url":"https://api.github.com/users/ArielAbreu/orgs","repos_url":"https://api.github.com/users/ArielAbreu/repos","events_url":"https://api.github.com/users/ArielAbreu/events{/privacy}","received_events_url":"https://api.github.com/users/ArielAbreu/received_events","type":"User","site_admin":false},"repo":{"id":37623417,"name":"runtime","full_name":"ArielAbreu/runtime","owner":{"login":"ArielAbreu","id":11756574,"avatar_url":"https://avatars.githubusercontent.com/u/11756574?v=3","gravatar_id":"","url":"https://api.github.com/users/ArielAbreu","html_url":"https://github.com/ArielAbreu","followers_url":"https://api.github.com/users/ArielAbreu/followers","following_url":"https://api.github.com/users/ArielAbreu/following{/other_user}","gists_url":"https://api.github.com/users/ArielAbreu/gists{/gist_id}","starred_url":"https://api.github.com/users/ArielAbreu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArielAbreu/subscriptions","organizations_url":"https://api.github.com/users/ArielAbreu/orgs","repos_url":"https://api.github.com/users/ArielAbreu/repos","events_url":"https://api.github.com/users/ArielAbreu/events{/privacy}","received_events_url":"https://api.github.com/users/ArielAbreu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ArielAbreu/runtime","description":"JavaScript library operating system for the cloud","fork":true,"url":"https://api.github.com/repos/ArielAbreu/runtime","forks_url":"https://api.github.com/repos/ArielAbreu/runtime/forks","keys_url":"https://api.github.com/repos/ArielAbreu/runtime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ArielAbreu/runtime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ArielAbreu/runtime/teams","hooks_url":"https://api.github.com/repos/ArielAbreu/runtime/hooks","issue_events_url":"https://api.github.com/repos/ArielAbreu/runtime/issues/events{/number}","events_url":"https://api.github.com/repos/ArielAbreu/runtime/events","assignees_url":"https://api.github.com/repos/ArielAbreu/runtime/assignees{/user}","branches_url":"https://api.github.com/repos/ArielAbreu/runtime/branches{/branch}","tags_url":"https://api.github.com/repos/ArielAbreu/runtime/tags","blobs_url":"https://api.github.com/repos/ArielAbreu/runtime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ArielAbreu/runtime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ArielAbreu/runtime/git/refs{/sha}","trees_url":"https://api.github.com/repos/ArielAbreu/runtime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ArielAbreu/runtime/statuses/{sha}","languages_url":"https://api.github.com/repos/ArielAbreu/runtime/languages","stargazers_url":"https://api.github.com/repos/ArielAbreu/runtime/stargazers","contributors_url":"https://api.github.com/repos/ArielAbreu/runtime/contributors","subscribers_url":"https://api.github.com/repos/ArielAbreu/runtime/subscribers","subscription_url":"https://api.github.com/repos/ArielAbreu/runtime/subscription","commits_url":"https://api.github.com/repos/ArielAbreu/runtime/commits{/sha}","git_commits_url":"https://api.github.com/repos/ArielAbreu/runtime/git/commits{/sha}","comments_url":"https://api.github.com/repos/ArielAbreu/runtime/comments{/number}","issue_comment_url":"https://api.github.com/repos/ArielAbreu/runtime/issues/comments{/number}","contents_url":"https://api.github.com/repos/ArielAbreu/runtime/contents/{+path}","compare_url":"https://api.github.com/repos/ArielAbreu/runtime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ArielAbreu/runtime/merges","archive_url":"https://api.github.com/repos/ArielAbreu/runtime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ArielAbreu/runtime/downloads","issues_url":"https://api.github.com/repos/ArielAbreu/runtime/issues{/number}","pulls_url":"https://api.github.com/repos/ArielAbreu/runtime/pulls{/number}","milestones_url":"https://api.github.com/repos/ArielAbreu/runtime/milestones{/number}","notifications_url":"https://api.github.com/repos/ArielAbreu/runtime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ArielAbreu/runtime/labels{/name}","releases_url":"https://api.github.com/repos/ArielAbreu/runtime/releases{/id}","created_at":"2015-06-17T22:03:58Z","updated_at":"2015-06-17T22:04:00Z","pushed_at":"2015-06-20T22:34:54Z","git_url":"git://github.com/ArielAbreu/runtime.git","ssh_url":"git@github.com:ArielAbreu/runtime.git","clone_url":"https://github.com/ArielAbreu/runtime.git","svn_url":"https://github.com/ArielAbreu/runtime","homepage":"http://runtimejs.org","size":61223,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"runtimejs:master","ref":"master","sha":"975e1b30ab477eecbf6d30ed2025e7853ef89dce","user":{"login":"runtimejs","id":7094989,"avatar_url":"https://avatars.githubusercontent.com/u/7094989?v=3","gravatar_id":"","url":"https://api.github.com/users/runtimejs","html_url":"https://github.com/runtimejs","followers_url":"https://api.github.com/users/runtimejs/followers","following_url":"https://api.github.com/users/runtimejs/following{/other_user}","gists_url":"https://api.github.com/users/runtimejs/gists{/gist_id}","starred_url":"https://api.github.com/users/runtimejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/runtimejs/subscriptions","organizations_url":"https://api.github.com/users/runtimejs/orgs","repos_url":"https://api.github.com/users/runtimejs/repos","events_url":"https://api.github.com/users/runtimejs/events{/privacy}","received_events_url":"https://api.github.com/users/runtimejs/received_events","type":"Organization","site_admin":false},"repo":{"id":20153919,"name":"runtime","full_name":"runtimejs/runtime","owner":{"login":"runtimejs","id":7094989,"avatar_url":"https://avatars.githubusercontent.com/u/7094989?v=3","gravatar_id":"","url":"https://api.github.com/users/runtimejs","html_url":"https://github.com/runtimejs","followers_url":"https://api.github.com/users/runtimejs/followers","following_url":"https://api.github.com/users/runtimejs/following{/other_user}","gists_url":"https://api.github.com/users/runtimejs/gists{/gist_id}","starred_url":"https://api.github.com/users/runtimejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/runtimejs/subscriptions","organizations_url":"https://api.github.com/users/runtimejs/orgs","repos_url":"https://api.github.com/users/runtimejs/repos","events_url":"https://api.github.com/users/runtimejs/events{/privacy}","received_events_url":"https://api.github.com/users/runtimejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/runtimejs/runtime","description":"JavaScript library operating system for the cloud","fork":false,"url":"https://api.github.com/repos/runtimejs/runtime","forks_url":"https://api.github.com/repos/runtimejs/runtime/forks","keys_url":"https://api.github.com/repos/runtimejs/runtime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/runtimejs/runtime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/runtimejs/runtime/teams","hooks_url":"https://api.github.com/repos/runtimejs/runtime/hooks","issue_events_url":"https://api.github.com/repos/runtimejs/runtime/issues/events{/number}","events_url":"https://api.github.com/repos/runtimejs/runtime/events","assignees_url":"https://api.github.com/repos/runtimejs/runtime/assignees{/user}","branches_url":"https://api.github.com/repos/runtimejs/runtime/branches{/branch}","tags_url":"https://api.github.com/repos/runtimejs/runtime/tags","blobs_url":"https://api.github.com/repos/runtimejs/runtime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/runtimejs/runtime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/runtimejs/runtime/git/refs{/sha}","trees_url":"https://api.github.com/repos/runtimejs/runtime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/runtimejs/runtime/statuses/{sha}","languages_url":"https://api.github.com/repos/runtimejs/runtime/languages","stargazers_url":"https://api.github.com/repos/runtimejs/runtime/stargazers","contributors_url":"https://api.github.com/repos/runtimejs/runtime/contributors","subscribers_url":"https://api.github.com/repos/runtimejs/runtime/subscribers","subscription_url":"https://api.github.com/repos/runtimejs/runtime/subscription","commits_url":"https://api.github.com/repos/runtimejs/runtime/commits{/sha}","git_commits_url":"https://api.github.com/repos/runtimejs/runtime/git/commits{/sha}","comments_url":"https://api.github.com/repos/runtimejs/runtime/comments{/number}","issue_comment_url":"https://api.github.com/repos/runtimejs/runtime/issues/comments{/number}","contents_url":"https://api.github.com/repos/runtimejs/runtime/contents/{+path}","compare_url":"https://api.github.com/repos/runtimejs/runtime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/runtimejs/runtime/merges","archive_url":"https://api.github.com/repos/runtimejs/runtime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/runtimejs/runtime/downloads","issues_url":"https://api.github.com/repos/runtimejs/runtime/issues{/number}","pulls_url":"https://api.github.com/repos/runtimejs/runtime/pulls{/number}","milestones_url":"https://api.github.com/repos/runtimejs/runtime/milestones{/number}","notifications_url":"https://api.github.com/repos/runtimejs/runtime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/runtimejs/runtime/labels{/name}","releases_url":"https://api.github.com/repos/runtimejs/runtime/releases{/id}","created_at":"2014-05-25T12:26:29Z","updated_at":"2015-06-20T18:17:36Z","pushed_at":"2015-06-20T22:34:54Z","git_url":"git://github.com/runtimejs/runtime.git","ssh_url":"git@github.com:runtimejs/runtime.git","clone_url":"https://github.com/runtimejs/runtime.git","svn_url":"https://github.com/runtimejs/runtime","homepage":"http://runtimejs.org","size":63973,"stargazers_count":1083,"watchers_count":1083,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":58,"mirror_url":null,"open_issues_count":17,"forks":58,"open_issues":17,"watchers":1083,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/runtimejs/runtime/pulls/60"},"html":{"href":"https://github.com/runtimejs/runtime/pull/60"},"issue":{"href":"https://api.github.com/repos/runtimejs/runtime/issues/60"},"comments":{"href":"https://api.github.com/repos/runtimejs/runtime/issues/60/comments"},"review_comments":{"href":"https://api.github.com/repos/runtimejs/runtime/pulls/60/comments"},"review_comment":{"href":"https://api.github.com/repos/runtimejs/runtime/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/runtimejs/runtime/pulls/60/commits"},"statuses":{"href":"https://api.github.com/repos/runtimejs/runtime/statuses/c0fa106f28bb07300a55a973952baa8084f54eef"}}}}