{"action":"created","comment":{"url":"https://api.github.com/repos/jawher/mow.cli/pulls/comments/89194656","pull_request_review_id":9738314,"id":89194656,"diff_hunk":"@@ -571,3 +571,59 @@ func TestArgSetByUser(t *testing.T) {\n \t}\n \n }\n+\n+func TestCommandAliases(t *testing.T) {\n+\tapp := App(\"say\", \"\")\n+\tapp.ErrorHandling = flag.ContinueOnError\n+\n+\tcallCount := 0\n+\n+\tapp.Command(\"hello, hi\", \"\", func(cmd *Cmd) {\n+\t\tcmd.Action = func() {\n+\t\t\tcallCount++\n+\t\t}\n+\t})\n+\n+\terr := app.Run([]string{\"say\", \"hello\"})\n+\trequire.NoError(t, err, \"should have returned without an error\")\n+\terr = app.Run([]string{\"say\", \"hi\"})\n+\trequire.NoError(t, err, \"should have returned without an error\")\n+\terr = app.Run([]string{\"say\", \"hello, hi\"})\n+\trequire.Equal(t, callCount, 2, \"command should have been invoked twice\")","path":"cli_test.go","position":22,"original_position":22,"commit_id":"1f17f99294e81ebb207881bb401da66a2aa266c2","original_commit_id":"1f17f99294e81ebb207881bb401da66a2aa266c2","user":{"login":"jawher","id":96384,"avatar_url":"https://avatars.githubusercontent.com/u/96384?v=3","gravatar_id":"","url":"https://api.github.com/users/jawher","html_url":"https://github.com/jawher","followers_url":"https://api.github.com/users/jawher/followers","following_url":"https://api.github.com/users/jawher/following{/other_user}","gists_url":"https://api.github.com/users/jawher/gists{/gist_id}","starred_url":"https://api.github.com/users/jawher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jawher/subscriptions","organizations_url":"https://api.github.com/users/jawher/orgs","repos_url":"https://api.github.com/users/jawher/repos","events_url":"https://api.github.com/users/jawher/events{/privacy}","received_events_url":"https://api.github.com/users/jawher/received_events","type":"User","site_admin":false},"body":"this is not very readable IMHO: I had to re-read the code and debug the test because I thought this call executed the action twice.\r\n\r\nOnce easy fix is to do a table driven test with an expected err field set to false for the first 2  and to true for the last one, and have the app and command initialization done inside the for loop, this way they won't reuse the same callCount var (even better, a count is not needed anymore, a boolean is enough).","created_at":"2016-11-22T19:41:11Z","updated_at":"2016-11-22T19:42:27Z","html_url":"https://github.com/jawher/mow.cli/pull/40#discussion_r89194656","pull_request_url":"https://api.github.com/repos/jawher/mow.cli/pulls/40","_links":{"self":{"href":"https://api.github.com/repos/jawher/mow.cli/pulls/comments/89194656"},"html":{"href":"https://github.com/jawher/mow.cli/pull/40#discussion_r89194656"},"pull_request":{"href":"https://api.github.com/repos/jawher/mow.cli/pulls/40"}}},"pull_request":{"url":"https://api.github.com/repos/jawher/mow.cli/pulls/40","id":94776002,"html_url":"https://github.com/jawher/mow.cli/pull/40","diff_url":"https://github.com/jawher/mow.cli/pull/40.diff","patch_url":"https://github.com/jawher/mow.cli/pull/40.patch","issue_url":"https://api.github.com/repos/jawher/mow.cli/issues/40","number":40,"state":"open","locked":false,"title":"Add support for command aliases","user":{"login":"codykrieger","id":131179,"avatar_url":"https://avatars.githubusercontent.com/u/131179?v=3","gravatar_id":"","url":"https://api.github.com/users/codykrieger","html_url":"https://github.com/codykrieger","followers_url":"https://api.github.com/users/codykrieger/followers","following_url":"https://api.github.com/users/codykrieger/following{/other_user}","gists_url":"https://api.github.com/users/codykrieger/gists{/gist_id}","starred_url":"https://api.github.com/users/codykrieger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codykrieger/subscriptions","organizations_url":"https://api.github.com/users/codykrieger/orgs","repos_url":"https://api.github.com/users/codykrieger/repos","events_url":"https://api.github.com/users/codykrieger/events{/privacy}","received_events_url":"https://api.github.com/users/codykrieger/received_events","type":"User","site_admin":false},"body":"Fixes jawher/mow.cli#37.\n\nTests + README + godocs updated to show some example usage.\n\nCheers! 🍻","created_at":"2016-11-22T09:27:53Z","updated_at":"2016-11-22T19:42:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5ac4b92ad22b61442cd85464ccb9dc4c1f31153e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/jawher/mow.cli/pulls/40/commits","review_comments_url":"https://api.github.com/repos/jawher/mow.cli/pulls/40/comments","review_comment_url":"https://api.github.com/repos/jawher/mow.cli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jawher/mow.cli/issues/40/comments","statuses_url":"https://api.github.com/repos/jawher/mow.cli/statuses/1f17f99294e81ebb207881bb401da66a2aa266c2","head":{"label":"codykrieger:add-command-aliases","ref":"add-command-aliases","sha":"1f17f99294e81ebb207881bb401da66a2aa266c2","user":{"login":"codykrieger","id":131179,"avatar_url":"https://avatars.githubusercontent.com/u/131179?v=3","gravatar_id":"","url":"https://api.github.com/users/codykrieger","html_url":"https://github.com/codykrieger","followers_url":"https://api.github.com/users/codykrieger/followers","following_url":"https://api.github.com/users/codykrieger/following{/other_user}","gists_url":"https://api.github.com/users/codykrieger/gists{/gist_id}","starred_url":"https://api.github.com/users/codykrieger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codykrieger/subscriptions","organizations_url":"https://api.github.com/users/codykrieger/orgs","repos_url":"https://api.github.com/users/codykrieger/repos","events_url":"https://api.github.com/users/codykrieger/events{/privacy}","received_events_url":"https://api.github.com/users/codykrieger/received_events","type":"User","site_admin":false},"repo":{"id":74450861,"name":"mow.cli","full_name":"codykrieger/mow.cli","owner":{"login":"codykrieger","id":131179,"avatar_url":"https://avatars.githubusercontent.com/u/131179?v=3","gravatar_id":"","url":"https://api.github.com/users/codykrieger","html_url":"https://github.com/codykrieger","followers_url":"https://api.github.com/users/codykrieger/followers","following_url":"https://api.github.com/users/codykrieger/following{/other_user}","gists_url":"https://api.github.com/users/codykrieger/gists{/gist_id}","starred_url":"https://api.github.com/users/codykrieger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codykrieger/subscriptions","organizations_url":"https://api.github.com/users/codykrieger/orgs","repos_url":"https://api.github.com/users/codykrieger/repos","events_url":"https://api.github.com/users/codykrieger/events{/privacy}","received_events_url":"https://api.github.com/users/codykrieger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/codykrieger/mow.cli","description":"A versatile library for building CLI applications in Go","fork":true,"url":"https://api.github.com/repos/codykrieger/mow.cli","forks_url":"https://api.github.com/repos/codykrieger/mow.cli/forks","keys_url":"https://api.github.com/repos/codykrieger/mow.cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codykrieger/mow.cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codykrieger/mow.cli/teams","hooks_url":"https://api.github.com/repos/codykrieger/mow.cli/hooks","issue_events_url":"https://api.github.com/repos/codykrieger/mow.cli/issues/events{/number}","events_url":"https://api.github.com/repos/codykrieger/mow.cli/events","assignees_url":"https://api.github.com/repos/codykrieger/mow.cli/assignees{/user}","branches_url":"https://api.github.com/repos/codykrieger/mow.cli/branches{/branch}","tags_url":"https://api.github.com/repos/codykrieger/mow.cli/tags","blobs_url":"https://api.github.com/repos/codykrieger/mow.cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codykrieger/mow.cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codykrieger/mow.cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/codykrieger/mow.cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codykrieger/mow.cli/statuses/{sha}","languages_url":"https://api.github.com/repos/codykrieger/mow.cli/languages","stargazers_url":"https://api.github.com/repos/codykrieger/mow.cli/stargazers","contributors_url":"https://api.github.com/repos/codykrieger/mow.cli/contributors","subscribers_url":"https://api.github.com/repos/codykrieger/mow.cli/subscribers","subscription_url":"https://api.github.com/repos/codykrieger/mow.cli/subscription","commits_url":"https://api.github.com/repos/codykrieger/mow.cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/codykrieger/mow.cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/codykrieger/mow.cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/codykrieger/mow.cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/codykrieger/mow.cli/contents/{+path}","compare_url":"https://api.github.com/repos/codykrieger/mow.cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codykrieger/mow.cli/merges","archive_url":"https://api.github.com/repos/codykrieger/mow.cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codykrieger/mow.cli/downloads","issues_url":"https://api.github.com/repos/codykrieger/mow.cli/issues{/number}","pulls_url":"https://api.github.com/repos/codykrieger/mow.cli/pulls{/number}","milestones_url":"https://api.github.com/repos/codykrieger/mow.cli/milestones{/number}","notifications_url":"https://api.github.com/repos/codykrieger/mow.cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codykrieger/mow.cli/labels{/name}","releases_url":"https://api.github.com/repos/codykrieger/mow.cli/releases{/id}","deployments_url":"https://api.github.com/repos/codykrieger/mow.cli/deployments","created_at":"2016-11-22T08:28:36Z","updated_at":"2016-11-22T08:28:37Z","pushed_at":"2016-11-22T09:26:28Z","git_url":"git://github.com/codykrieger/mow.cli.git","ssh_url":"git@github.com:codykrieger/mow.cli.git","clone_url":"https://github.com/codykrieger/mow.cli.git","svn_url":"https://github.com/codykrieger/mow.cli","homepage":"","size":161,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"jawher:master","ref":"master","sha":"660b9261e2c80bb92e5a0eaa581596084656140e","user":{"login":"jawher","id":96384,"avatar_url":"https://avatars.githubusercontent.com/u/96384?v=3","gravatar_id":"","url":"https://api.github.com/users/jawher","html_url":"https://github.com/jawher","followers_url":"https://api.github.com/users/jawher/followers","following_url":"https://api.github.com/users/jawher/following{/other_user}","gists_url":"https://api.github.com/users/jawher/gists{/gist_id}","starred_url":"https://api.github.com/users/jawher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jawher/subscriptions","organizations_url":"https://api.github.com/users/jawher/orgs","repos_url":"https://api.github.com/users/jawher/repos","events_url":"https://api.github.com/users/jawher/events{/privacy}","received_events_url":"https://api.github.com/users/jawher/received_events","type":"User","site_admin":false},"repo":{"id":28198414,"name":"mow.cli","full_name":"jawher/mow.cli","owner":{"login":"jawher","id":96384,"avatar_url":"https://avatars.githubusercontent.com/u/96384?v=3","gravatar_id":"","url":"https://api.github.com/users/jawher","html_url":"https://github.com/jawher","followers_url":"https://api.github.com/users/jawher/followers","following_url":"https://api.github.com/users/jawher/following{/other_user}","gists_url":"https://api.github.com/users/jawher/gists{/gist_id}","starred_url":"https://api.github.com/users/jawher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jawher/subscriptions","organizations_url":"https://api.github.com/users/jawher/orgs","repos_url":"https://api.github.com/users/jawher/repos","events_url":"https://api.github.com/users/jawher/events{/privacy}","received_events_url":"https://api.github.com/users/jawher/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jawher/mow.cli","description":"A versatile library for building CLI applications in Go","fork":false,"url":"https://api.github.com/repos/jawher/mow.cli","forks_url":"https://api.github.com/repos/jawher/mow.cli/forks","keys_url":"https://api.github.com/repos/jawher/mow.cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jawher/mow.cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jawher/mow.cli/teams","hooks_url":"https://api.github.com/repos/jawher/mow.cli/hooks","issue_events_url":"https://api.github.com/repos/jawher/mow.cli/issues/events{/number}","events_url":"https://api.github.com/repos/jawher/mow.cli/events","assignees_url":"https://api.github.com/repos/jawher/mow.cli/assignees{/user}","branches_url":"https://api.github.com/repos/jawher/mow.cli/branches{/branch}","tags_url":"https://api.github.com/repos/jawher/mow.cli/tags","blobs_url":"https://api.github.com/repos/jawher/mow.cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jawher/mow.cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jawher/mow.cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/jawher/mow.cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jawher/mow.cli/statuses/{sha}","languages_url":"https://api.github.com/repos/jawher/mow.cli/languages","stargazers_url":"https://api.github.com/repos/jawher/mow.cli/stargazers","contributors_url":"https://api.github.com/repos/jawher/mow.cli/contributors","subscribers_url":"https://api.github.com/repos/jawher/mow.cli/subscribers","subscription_url":"https://api.github.com/repos/jawher/mow.cli/subscription","commits_url":"https://api.github.com/repos/jawher/mow.cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/jawher/mow.cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/jawher/mow.cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/jawher/mow.cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/jawher/mow.cli/contents/{+path}","compare_url":"https://api.github.com/repos/jawher/mow.cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jawher/mow.cli/merges","archive_url":"https://api.github.com/repos/jawher/mow.cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jawher/mow.cli/downloads","issues_url":"https://api.github.com/repos/jawher/mow.cli/issues{/number}","pulls_url":"https://api.github.com/repos/jawher/mow.cli/pulls{/number}","milestones_url":"https://api.github.com/repos/jawher/mow.cli/milestones{/number}","notifications_url":"https://api.github.com/repos/jawher/mow.cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jawher/mow.cli/labels{/name}","releases_url":"https://api.github.com/repos/jawher/mow.cli/releases{/id}","deployments_url":"https://api.github.com/repos/jawher/mow.cli/deployments","created_at":"2014-12-18T19:34:20Z","updated_at":"2016-11-22T08:42:40Z","pushed_at":"2016-11-22T09:27:53Z","git_url":"git://github.com/jawher/mow.cli.git","ssh_url":"git@github.com:jawher/mow.cli.git","clone_url":"https://github.com/jawher/mow.cli.git","svn_url":"https://github.com/jawher/mow.cli","homepage":"","size":152,"stargazers_count":379,"watchers_count":379,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":24,"mirror_url":null,"open_issues_count":7,"forks":24,"open_issues":7,"watchers":379,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jawher/mow.cli/pulls/40"},"html":{"href":"https://github.com/jawher/mow.cli/pull/40"},"issue":{"href":"https://api.github.com/repos/jawher/mow.cli/issues/40"},"comments":{"href":"https://api.github.com/repos/jawher/mow.cli/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/jawher/mow.cli/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/jawher/mow.cli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jawher/mow.cli/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/jawher/mow.cli/statuses/1f17f99294e81ebb207881bb401da66a2aa266c2"}}}}
{"actor":{"display_login":"jawher"}}