{"action":"closed","number":2667,"pull_request":{"url":"https://api.github.com/repos/balderdashy/sails/pulls/2667","id":29571518,"html_url":"https://github.com/balderdashy/sails/pull/2667","diff_url":"https://github.com/balderdashy/sails/pull/2667.diff","patch_url":"https://github.com/balderdashy/sails/pull/2667.patch","issue_url":"https://api.github.com/repos/balderdashy/sails/issues/2667","number":2667,"state":"closed","locked":false,"title":"Added ability to create custom sails commands","user":{"login":"brooklynDev","id":995470,"avatar_url":"https://avatars.githubusercontent.com/u/995470?v=3","gravatar_id":"","url":"https://api.github.com/users/brooklynDev","html_url":"https://github.com/brooklynDev","followers_url":"https://api.github.com/users/brooklynDev/followers","following_url":"https://api.github.com/users/brooklynDev/following{/other_user}","gists_url":"https://api.github.com/users/brooklynDev/gists{/gist_id}","starred_url":"https://api.github.com/users/brooklynDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brooklynDev/subscriptions","organizations_url":"https://api.github.com/users/brooklynDev/orgs","repos_url":"https://api.github.com/users/brooklynDev/repos","events_url":"https://api.github.com/users/brooklynDev/events{/privacy}","received_events_url":"https://api.github.com/users/brooklynDev/received_events","type":"User","site_admin":false},"body":"Currently `sails` does not have the ability to create custom commands at the `sails` command line. This PR adds that ability with the following rules:\r\n\r\n- A command hook needs to specify `sails: { isCommand: true}` in the `package.json`\r\n- A command hook needs to export an object with 2 properties `command` and `execute`.\r\n  - the `command` property should be a string representing the command name\r\n  - the `execute` property should be a function that will be called with the additional arguments.\r\n\r\nFor example a module like this will add an `azure` command that can be used like this `sails azure deploy`\r\n```javascript\r\nmodule.exports = {\r\n  command: 'azure',\r\n   execute: function(args) {\r\n     console.log(args) // will log ['deploy']\r\n  }\r\n}\r\n```\r\n\r\nThe motivation behind this PR was https://github.com/balderdashy/sails/pull/2663. The way that is currently set up is that if you do `sails deploy` it defaults to publishing to Azure. I think it would be a much nicer experience if the command would be `sails azure deploy` and in the future perhaps a `sails heroku deploy` etc. Additionally, this would allow the `azure` functionality to be wrapped up into it's own (opt-in) module.","created_at":"2015-02-18T22:49:48Z","updated_at":"2015-03-26T16:30:04Z","closed_at":"2015-03-26T16:30:04Z","merged_at":null,"merge_commit_sha":"c400019c0c02b76448de1591b5c20656be9017f0","assignee":{"login":"mikermcneil","id":618009,"avatar_url":"https://avatars.githubusercontent.com/u/618009?v=3","gravatar_id":"","url":"https://api.github.com/users/mikermcneil","html_url":"https://github.com/mikermcneil","followers_url":"https://api.github.com/users/mikermcneil/followers","following_url":"https://api.github.com/users/mikermcneil/following{/other_user}","gists_url":"https://api.github.com/users/mikermcneil/gists{/gist_id}","starred_url":"https://api.github.com/users/mikermcneil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikermcneil/subscriptions","organizations_url":"https://api.github.com/users/mikermcneil/orgs","repos_url":"https://api.github.com/users/mikermcneil/repos","events_url":"https://api.github.com/users/mikermcneil/events{/privacy}","received_events_url":"https://api.github.com/users/mikermcneil/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/balderdashy/sails/pulls/2667/commits","review_comments_url":"https://api.github.com/repos/balderdashy/sails/pulls/2667/comments","review_comment_url":"https://api.github.com/repos/balderdashy/sails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/balderdashy/sails/issues/2667/comments","statuses_url":"https://api.github.com/repos/balderdashy/sails/statuses/70a1f8169bf3d9a24fb23c44a26d1563796e7c3c","head":{"label":"brooklynDev:add-command-hook","ref":"add-command-hook","sha":"70a1f8169bf3d9a24fb23c44a26d1563796e7c3c","user":{"login":"brooklynDev","id":995470,"avatar_url":"https://avatars.githubusercontent.com/u/995470?v=3","gravatar_id":"","url":"https://api.github.com/users/brooklynDev","html_url":"https://github.com/brooklynDev","followers_url":"https://api.github.com/users/brooklynDev/followers","following_url":"https://api.github.com/users/brooklynDev/following{/other_user}","gists_url":"https://api.github.com/users/brooklynDev/gists{/gist_id}","starred_url":"https://api.github.com/users/brooklynDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brooklynDev/subscriptions","organizations_url":"https://api.github.com/users/brooklynDev/orgs","repos_url":"https://api.github.com/users/brooklynDev/repos","events_url":"https://api.github.com/users/brooklynDev/events{/privacy}","received_events_url":"https://api.github.com/users/brooklynDev/received_events","type":"User","site_admin":false},"repo":{"id":30984822,"name":"sails","full_name":"brooklynDev/sails","owner":{"login":"brooklynDev","id":995470,"avatar_url":"https://avatars.githubusercontent.com/u/995470?v=3","gravatar_id":"","url":"https://api.github.com/users/brooklynDev","html_url":"https://github.com/brooklynDev","followers_url":"https://api.github.com/users/brooklynDev/followers","following_url":"https://api.github.com/users/brooklynDev/following{/other_user}","gists_url":"https://api.github.com/users/brooklynDev/gists{/gist_id}","starred_url":"https://api.github.com/users/brooklynDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brooklynDev/subscriptions","organizations_url":"https://api.github.com/users/brooklynDev/orgs","repos_url":"https://api.github.com/users/brooklynDev/repos","events_url":"https://api.github.com/users/brooklynDev/events{/privacy}","received_events_url":"https://api.github.com/users/brooklynDev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brooklynDev/sails","description":"Realtime MVC Framework for Node.js","fork":true,"url":"https://api.github.com/repos/brooklynDev/sails","forks_url":"https://api.github.com/repos/brooklynDev/sails/forks","keys_url":"https://api.github.com/repos/brooklynDev/sails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brooklynDev/sails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brooklynDev/sails/teams","hooks_url":"https://api.github.com/repos/brooklynDev/sails/hooks","issue_events_url":"https://api.github.com/repos/brooklynDev/sails/issues/events{/number}","events_url":"https://api.github.com/repos/brooklynDev/sails/events","assignees_url":"https://api.github.com/repos/brooklynDev/sails/assignees{/user}","branches_url":"https://api.github.com/repos/brooklynDev/sails/branches{/branch}","tags_url":"https://api.github.com/repos/brooklynDev/sails/tags","blobs_url":"https://api.github.com/repos/brooklynDev/sails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brooklynDev/sails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brooklynDev/sails/git/refs{/sha}","trees_url":"https://api.github.com/repos/brooklynDev/sails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brooklynDev/sails/statuses/{sha}","languages_url":"https://api.github.com/repos/brooklynDev/sails/languages","stargazers_url":"https://api.github.com/repos/brooklynDev/sails/stargazers","contributors_url":"https://api.github.com/repos/brooklynDev/sails/contributors","subscribers_url":"https://api.github.com/repos/brooklynDev/sails/subscribers","subscription_url":"https://api.github.com/repos/brooklynDev/sails/subscription","commits_url":"https://api.github.com/repos/brooklynDev/sails/commits{/sha}","git_commits_url":"https://api.github.com/repos/brooklynDev/sails/git/commits{/sha}","comments_url":"https://api.github.com/repos/brooklynDev/sails/comments{/number}","issue_comment_url":"https://api.github.com/repos/brooklynDev/sails/issues/comments{/number}","contents_url":"https://api.github.com/repos/brooklynDev/sails/contents/{+path}","compare_url":"https://api.github.com/repos/brooklynDev/sails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brooklynDev/sails/merges","archive_url":"https://api.github.com/repos/brooklynDev/sails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brooklynDev/sails/downloads","issues_url":"https://api.github.com/repos/brooklynDev/sails/issues{/number}","pulls_url":"https://api.github.com/repos/brooklynDev/sails/pulls{/number}","milestones_url":"https://api.github.com/repos/brooklynDev/sails/milestones{/number}","notifications_url":"https://api.github.com/repos/brooklynDev/sails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brooklynDev/sails/labels{/name}","releases_url":"https://api.github.com/repos/brooklynDev/sails/releases{/id}","created_at":"2015-02-18T20:19:02Z","updated_at":"2015-02-18T20:19:08Z","pushed_at":"2015-02-18T22:36:32Z","git_url":"git://github.com/brooklynDev/sails.git","ssh_url":"git@github.com:brooklynDev/sails.git","clone_url":"https://github.com/brooklynDev/sails.git","svn_url":"https://github.com/brooklynDev/sails","homepage":"http://sailsjs.org","size":10612,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"balderdashy:master","ref":"master","sha":"0990fc10709520a9f6c55923b991708d5eaf8aa0","user":{"login":"balderdashy","id":1445252,"avatar_url":"https://avatars.githubusercontent.com/u/1445252?v=3","gravatar_id":"","url":"https://api.github.com/users/balderdashy","html_url":"https://github.com/balderdashy","followers_url":"https://api.github.com/users/balderdashy/followers","following_url":"https://api.github.com/users/balderdashy/following{/other_user}","gists_url":"https://api.github.com/users/balderdashy/gists{/gist_id}","starred_url":"https://api.github.com/users/balderdashy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balderdashy/subscriptions","organizations_url":"https://api.github.com/users/balderdashy/orgs","repos_url":"https://api.github.com/users/balderdashy/repos","events_url":"https://api.github.com/users/balderdashy/events{/privacy}","received_events_url":"https://api.github.com/users/balderdashy/received_events","type":"Organization","site_admin":false},"repo":{"id":3757512,"name":"sails","full_name":"balderdashy/sails","owner":{"login":"balderdashy","id":1445252,"avatar_url":"https://avatars.githubusercontent.com/u/1445252?v=3","gravatar_id":"","url":"https://api.github.com/users/balderdashy","html_url":"https://github.com/balderdashy","followers_url":"https://api.github.com/users/balderdashy/followers","following_url":"https://api.github.com/users/balderdashy/following{/other_user}","gists_url":"https://api.github.com/users/balderdashy/gists{/gist_id}","starred_url":"https://api.github.com/users/balderdashy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balderdashy/subscriptions","organizations_url":"https://api.github.com/users/balderdashy/orgs","repos_url":"https://api.github.com/users/balderdashy/repos","events_url":"https://api.github.com/users/balderdashy/events{/privacy}","received_events_url":"https://api.github.com/users/balderdashy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/balderdashy/sails","description":"Realtime MVC Framework for Node.js","fork":false,"url":"https://api.github.com/repos/balderdashy/sails","forks_url":"https://api.github.com/repos/balderdashy/sails/forks","keys_url":"https://api.github.com/repos/balderdashy/sails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/balderdashy/sails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/balderdashy/sails/teams","hooks_url":"https://api.github.com/repos/balderdashy/sails/hooks","issue_events_url":"https://api.github.com/repos/balderdashy/sails/issues/events{/number}","events_url":"https://api.github.com/repos/balderdashy/sails/events","assignees_url":"https://api.github.com/repos/balderdashy/sails/assignees{/user}","branches_url":"https://api.github.com/repos/balderdashy/sails/branches{/branch}","tags_url":"https://api.github.com/repos/balderdashy/sails/tags","blobs_url":"https://api.github.com/repos/balderdashy/sails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/balderdashy/sails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/balderdashy/sails/git/refs{/sha}","trees_url":"https://api.github.com/repos/balderdashy/sails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/balderdashy/sails/statuses/{sha}","languages_url":"https://api.github.com/repos/balderdashy/sails/languages","stargazers_url":"https://api.github.com/repos/balderdashy/sails/stargazers","contributors_url":"https://api.github.com/repos/balderdashy/sails/contributors","subscribers_url":"https://api.github.com/repos/balderdashy/sails/subscribers","subscription_url":"https://api.github.com/repos/balderdashy/sails/subscription","commits_url":"https://api.github.com/repos/balderdashy/sails/commits{/sha}","git_commits_url":"https://api.github.com/repos/balderdashy/sails/git/commits{/sha}","comments_url":"https://api.github.com/repos/balderdashy/sails/comments{/number}","issue_comment_url":"https://api.github.com/repos/balderdashy/sails/issues/comments{/number}","contents_url":"https://api.github.com/repos/balderdashy/sails/contents/{+path}","compare_url":"https://api.github.com/repos/balderdashy/sails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/balderdashy/sails/merges","archive_url":"https://api.github.com/repos/balderdashy/sails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/balderdashy/sails/downloads","issues_url":"https://api.github.com/repos/balderdashy/sails/issues{/number}","pulls_url":"https://api.github.com/repos/balderdashy/sails/pulls{/number}","milestones_url":"https://api.github.com/repos/balderdashy/sails/milestones{/number}","notifications_url":"https://api.github.com/repos/balderdashy/sails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/balderdashy/sails/labels{/name}","releases_url":"https://api.github.com/repos/balderdashy/sails/releases{/id}","created_at":"2012-03-18T19:46:15Z","updated_at":"2015-03-26T15:51:01Z","pushed_at":"2015-03-26T08:51:46Z","git_url":"git://github.com/balderdashy/sails.git","ssh_url":"git@github.com:balderdashy/sails.git","clone_url":"https://github.com/balderdashy/sails.git","svn_url":"https://github.com/balderdashy/sails","homepage":"http://sailsjs.org","size":23869,"stargazers_count":9967,"watchers_count":9967,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1079,"mirror_url":null,"open_issues_count":284,"forks":1079,"open_issues":284,"watchers":9967,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/balderdashy/sails/pulls/2667"},"html":{"href":"https://github.com/balderdashy/sails/pull/2667"},"issue":{"href":"https://api.github.com/repos/balderdashy/sails/issues/2667"},"comments":{"href":"https://api.github.com/repos/balderdashy/sails/issues/2667/comments"},"review_comments":{"href":"https://api.github.com/repos/balderdashy/sails/pulls/2667/comments"},"review_comment":{"href":"https://api.github.com/repos/balderdashy/sails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/balderdashy/sails/pulls/2667/commits"},"statuses":{"href":"https://api.github.com/repos/balderdashy/sails/statuses/70a1f8169bf3d9a24fb23c44a26d1563796e7c3c"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":15,"review_comments":0,"commits":1,"additions":40,"deletions":1,"changed_files":2}}