{"action":"created","comment":{"url":"https://api.github.com/repos/googlegenomics/pipelines-tools/pulls/comments/190982418","pull_request_review_id":123479649,"id":190982418,"diff_hunk":"@@ -37,13 +38,28 @@ func Invoke(ctx context.Context, service *genomics.Service, project string, argu\n \tif *filter != \"\" {\n \t\tcall = call.Filter(*filter)\n \t}\n-\tresp, err := call.Do()\n-\tif err != nil {\n-\t\treturn err\n+\n+\tif *limit == 0 {\n+\t\treturn nil\n \t}\n \n-\tfor _, operation := range resp.Operations {\n-\t\tfmt.Println(operation.Name)\n+\tpageToken := \"\"\n+\tlisted := uint(0)\n+\tfor {\n+\t\tresp, err := call.PageToken(pageToken).Do()\n+\t\tif err != nil {\n+\t\t\treturn err\n+\t\t}\n+\n+\t\tfor _, operation := range resp.Operations {\n+\t\t\tfmt.Println(operation.Name)\n+\t\t\tif listed++; listed == *limit {\n+\t\t\t\treturn nil\n+\t\t\t}\n+\t\t}\n+\n+\t\tif pageToken = resp.NextPageToken; pageToken == \"\" {","path":"pipelines/internal/commands/query/query.go","position":37,"original_position":37,"commit_id":"c583f0c6e4f2ecbb0ecafceca578ff1c2a858a14","original_commit_id":"c583f0c6e4f2ecbb0ecafceca578ff1c2a858a14","user":{"login":"kemp-google","id":28713279,"avatar_url":"https://avatars3.githubusercontent.com/u/28713279?v=4","gravatar_id":"","url":"https://api.github.com/users/kemp-google","html_url":"https://github.com/kemp-google","followers_url":"https://api.github.com/users/kemp-google/followers","following_url":"https://api.github.com/users/kemp-google/following{/other_user}","gists_url":"https://api.github.com/users/kemp-google/gists{/gist_id}","starred_url":"https://api.github.com/users/kemp-google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kemp-google/subscriptions","organizations_url":"https://api.github.com/users/kemp-google/orgs","repos_url":"https://api.github.com/users/kemp-google/repos","events_url":"https://api.github.com/users/kemp-google/events{/privacy}","received_events_url":"https://api.github.com/users/kemp-google/received_events","type":"User","site_admin":false},"body":"It's odd to write side effects inside the conditionals like this.\r\n\r\nif resp.NextPageToken == \"\" {\r\n  return nil\r\n}\r\npageToken = resp.NextPageToken\r\n\r\nis more idiomatic and clear","created_at":"2018-05-25T18:55:41Z","updated_at":"2018-05-25T18:56:42Z","html_url":"https://github.com/googlegenomics/pipelines-tools/pull/45#discussion_r190982418","pull_request_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/pulls/45","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/googlegenomics/pipelines-tools/pulls/comments/190982418"},"html":{"href":"https://github.com/googlegenomics/pipelines-tools/pull/45#discussion_r190982418"},"pull_request":{"href":"https://api.github.com/repos/googlegenomics/pipelines-tools/pulls/45"}}},"pull_request":{"url":"https://api.github.com/repos/googlegenomics/pipelines-tools/pulls/45","id":190396381,"html_url":"https://github.com/googlegenomics/pipelines-tools/pull/45","diff_url":"https://github.com/googlegenomics/pipelines-tools/pull/45.diff","patch_url":"https://github.com/googlegenomics/pipelines-tools/pull/45.patch","issue_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/issues/45","number":45,"state":"open","locked":false,"title":"Added --limit flag to pipelines query","user":{"login":"anamanolache","id":23612578,"avatar_url":"https://avatars1.githubusercontent.com/u/23612578?v=4","gravatar_id":"","url":"https://api.github.com/users/anamanolache","html_url":"https://github.com/anamanolache","followers_url":"https://api.github.com/users/anamanolache/followers","following_url":"https://api.github.com/users/anamanolache/following{/other_user}","gists_url":"https://api.github.com/users/anamanolache/gists{/gist_id}","starred_url":"https://api.github.com/users/anamanolache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anamanolache/subscriptions","organizations_url":"https://api.github.com/users/anamanolache/orgs","repos_url":"https://api.github.com/users/anamanolache/repos","events_url":"https://api.github.com/users/anamanolache/events{/privacy}","received_events_url":"https://api.github.com/users/anamanolache/received_events","type":"User","site_admin":false},"body":"This fixes #44","created_at":"2018-05-24T19:31:28Z","updated_at":"2018-05-25T18:56:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"32f8501035257466f7195016b0f4019055e690db","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/pulls/45/commits","review_comments_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/pulls/45/comments","review_comment_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/issues/45/comments","statuses_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/statuses/c583f0c6e4f2ecbb0ecafceca578ff1c2a858a14","head":{"label":"anamanolache:master","ref":"master","sha":"c583f0c6e4f2ecbb0ecafceca578ff1c2a858a14","user":{"login":"anamanolache","id":23612578,"avatar_url":"https://avatars1.githubusercontent.com/u/23612578?v=4","gravatar_id":"","url":"https://api.github.com/users/anamanolache","html_url":"https://github.com/anamanolache","followers_url":"https://api.github.com/users/anamanolache/followers","following_url":"https://api.github.com/users/anamanolache/following{/other_user}","gists_url":"https://api.github.com/users/anamanolache/gists{/gist_id}","starred_url":"https://api.github.com/users/anamanolache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anamanolache/subscriptions","organizations_url":"https://api.github.com/users/anamanolache/orgs","repos_url":"https://api.github.com/users/anamanolache/repos","events_url":"https://api.github.com/users/anamanolache/events{/privacy}","received_events_url":"https://api.github.com/users/anamanolache/received_events","type":"User","site_admin":false},"repo":{"id":130226215,"name":"pipelines-tools","full_name":"anamanolache/pipelines-tools","owner":{"login":"anamanolache","id":23612578,"avatar_url":"https://avatars1.githubusercontent.com/u/23612578?v=4","gravatar_id":"","url":"https://api.github.com/users/anamanolache","html_url":"https://github.com/anamanolache","followers_url":"https://api.github.com/users/anamanolache/followers","following_url":"https://api.github.com/users/anamanolache/following{/other_user}","gists_url":"https://api.github.com/users/anamanolache/gists{/gist_id}","starred_url":"https://api.github.com/users/anamanolache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anamanolache/subscriptions","organizations_url":"https://api.github.com/users/anamanolache/orgs","repos_url":"https://api.github.com/users/anamanolache/repos","events_url":"https://api.github.com/users/anamanolache/events{/privacy}","received_events_url":"https://api.github.com/users/anamanolache/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/anamanolache/pipelines-tools","description":"Tools for developing and running pipelines with the Genomics API","fork":true,"url":"https://api.github.com/repos/anamanolache/pipelines-tools","forks_url":"https://api.github.com/repos/anamanolache/pipelines-tools/forks","keys_url":"https://api.github.com/repos/anamanolache/pipelines-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/anamanolache/pipelines-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/anamanolache/pipelines-tools/teams","hooks_url":"https://api.github.com/repos/anamanolache/pipelines-tools/hooks","issue_events_url":"https://api.github.com/repos/anamanolache/pipelines-tools/issues/events{/number}","events_url":"https://api.github.com/repos/anamanolache/pipelines-tools/events","assignees_url":"https://api.github.com/repos/anamanolache/pipelines-tools/assignees{/user}","branches_url":"https://api.github.com/repos/anamanolache/pipelines-tools/branches{/branch}","tags_url":"https://api.github.com/repos/anamanolache/pipelines-tools/tags","blobs_url":"https://api.github.com/repos/anamanolache/pipelines-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/anamanolache/pipelines-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/anamanolache/pipelines-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/anamanolache/pipelines-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/anamanolache/pipelines-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/anamanolache/pipelines-tools/languages","stargazers_url":"https://api.github.com/repos/anamanolache/pipelines-tools/stargazers","contributors_url":"https://api.github.com/repos/anamanolache/pipelines-tools/contributors","subscribers_url":"https://api.github.com/repos/anamanolache/pipelines-tools/subscribers","subscription_url":"https://api.github.com/repos/anamanolache/pipelines-tools/subscription","commits_url":"https://api.github.com/repos/anamanolache/pipelines-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/anamanolache/pipelines-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/anamanolache/pipelines-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/anamanolache/pipelines-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/anamanolache/pipelines-tools/contents/{+path}","compare_url":"https://api.github.com/repos/anamanolache/pipelines-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/anamanolache/pipelines-tools/merges","archive_url":"https://api.github.com/repos/anamanolache/pipelines-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/anamanolache/pipelines-tools/downloads","issues_url":"https://api.github.com/repos/anamanolache/pipelines-tools/issues{/number}","pulls_url":"https://api.github.com/repos/anamanolache/pipelines-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/anamanolache/pipelines-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/anamanolache/pipelines-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/anamanolache/pipelines-tools/labels{/name}","releases_url":"https://api.github.com/repos/anamanolache/pipelines-tools/releases{/id}","deployments_url":"https://api.github.com/repos/anamanolache/pipelines-tools/deployments","created_at":"2018-04-19T14:15:14Z","updated_at":"2018-05-24T19:30:43Z","pushed_at":"2018-05-24T19:30:42Z","git_url":"git://github.com/anamanolache/pipelines-tools.git","ssh_url":"git@github.com:anamanolache/pipelines-tools.git","clone_url":"https://github.com/anamanolache/pipelines-tools.git","svn_url":"https://github.com/anamanolache/pipelines-tools","homepage":null,"size":72,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"googlegenomics:master","ref":"master","sha":"aa0c6147baf87b378a97014845484df65d70167c","user":{"login":"googlegenomics","id":7434120,"avatar_url":"https://avatars2.githubusercontent.com/u/7434120?v=4","gravatar_id":"","url":"https://api.github.com/users/googlegenomics","html_url":"https://github.com/googlegenomics","followers_url":"https://api.github.com/users/googlegenomics/followers","following_url":"https://api.github.com/users/googlegenomics/following{/other_user}","gists_url":"https://api.github.com/users/googlegenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/googlegenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlegenomics/subscriptions","organizations_url":"https://api.github.com/users/googlegenomics/orgs","repos_url":"https://api.github.com/users/googlegenomics/repos","events_url":"https://api.github.com/users/googlegenomics/events{/privacy}","received_events_url":"https://api.github.com/users/googlegenomics/received_events","type":"Organization","site_admin":false},"repo":{"id":123620762,"name":"pipelines-tools","full_name":"googlegenomics/pipelines-tools","owner":{"login":"googlegenomics","id":7434120,"avatar_url":"https://avatars2.githubusercontent.com/u/7434120?v=4","gravatar_id":"","url":"https://api.github.com/users/googlegenomics","html_url":"https://github.com/googlegenomics","followers_url":"https://api.github.com/users/googlegenomics/followers","following_url":"https://api.github.com/users/googlegenomics/following{/other_user}","gists_url":"https://api.github.com/users/googlegenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/googlegenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlegenomics/subscriptions","organizations_url":"https://api.github.com/users/googlegenomics/orgs","repos_url":"https://api.github.com/users/googlegenomics/repos","events_url":"https://api.github.com/users/googlegenomics/events{/privacy}","received_events_url":"https://api.github.com/users/googlegenomics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/googlegenomics/pipelines-tools","description":"Tools for developing and running pipelines with the Genomics API","fork":false,"url":"https://api.github.com/repos/googlegenomics/pipelines-tools","forks_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/forks","keys_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/teams","hooks_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/hooks","issue_events_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/issues/events{/number}","events_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/events","assignees_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/assignees{/user}","branches_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/branches{/branch}","tags_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/tags","blobs_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/languages","stargazers_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/stargazers","contributors_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/contributors","subscribers_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/subscribers","subscription_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/subscription","commits_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/contents/{+path}","compare_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/merges","archive_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/downloads","issues_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/issues{/number}","pulls_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/labels{/name}","releases_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/releases{/id}","deployments_url":"https://api.github.com/repos/googlegenomics/pipelines-tools/deployments","created_at":"2018-03-02T19:20:13Z","updated_at":"2018-05-22T19:31:59Z","pushed_at":"2018-05-24T19:31:28Z","git_url":"git://github.com/googlegenomics/pipelines-tools.git","ssh_url":"git@github.com:googlegenomics/pipelines-tools.git","clone_url":"https://github.com/googlegenomics/pipelines-tools.git","svn_url":"https://github.com/googlegenomics/pipelines-tools","homepage":null,"size":70,"stargazers_count":5,"watchers_count":5,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":5,"open_issues":6,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/googlegenomics/pipelines-tools/pulls/45"},"html":{"href":"https://github.com/googlegenomics/pipelines-tools/pull/45"},"issue":{"href":"https://api.github.com/repos/googlegenomics/pipelines-tools/issues/45"},"comments":{"href":"https://api.github.com/repos/googlegenomics/pipelines-tools/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/googlegenomics/pipelines-tools/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/googlegenomics/pipelines-tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/googlegenomics/pipelines-tools/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/googlegenomics/pipelines-tools/statuses/c583f0c6e4f2ecbb0ecafceca578ff1c2a858a14"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"kemp-google"}}