{"action":"created","comment":{"url":"https://api.github.com/repos/ambiata/mismi/pulls/comments/92929867","pull_request_review_id":13453752,"id":92929867,"diff_hunk":"@@ -132,6 +134,37 @@ getSize :: Address -> AWS (Maybe Int)\n getSize a =\n   headObject a >>= pure . maybe Nothing (^. A.horsContentLength)\n \n+getSizeRecursively :: Address -> AWS [Sized Address]\n+getSizeRecursively prefix =\n+  getSizeRecursively' prefix $$ DC.consume\n+\n+getSizeRecursively' :: Address -> Source AWS (Sized Address)\n+getSizeRecursively' prefix@(Address (Bucket b) (Key k)) =\n+  let\n+    cmd =\n+      A.listObjects (BucketName b)\n+        & A.loPrefix .~ Just k\n+  in\n+    paginate cmd =$=\n+    DC.mapFoldable (takeObjectSizes prefix)\n+\n+takeObjectSizes :: Address -> ListObjectsResponse -> [Sized Address]\n+takeObjectSizes prefix lors =","path":"mismi-s3/src/Mismi/S3/Commands.hs","position":28,"original_position":28,"commit_id":"d4e872ab13503c430375b13669f6801124043f61","original_commit_id":"d4e872ab13503c430375b13669f6801124043f61","user":{"login":"jystic","id":134805,"avatar_url":"https://avatars.githubusercontent.com/u/134805?v=3","gravatar_id":"","url":"https://api.github.com/users/jystic","html_url":"https://github.com/jystic","followers_url":"https://api.github.com/users/jystic/followers","following_url":"https://api.github.com/users/jystic/following{/other_user}","gists_url":"https://api.github.com/users/jystic/gists{/gist_id}","starred_url":"https://api.github.com/users/jystic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jystic/subscriptions","organizations_url":"https://api.github.com/users/jystic/orgs","repos_url":"https://api.github.com/users/jystic/repos","events_url":"https://api.github.com/users/jystic/events{/privacy}","received_events_url":"https://api.github.com/users/jystic/received_events","type":"User","site_admin":false},"body":"Yeah good point","created_at":"2016-12-17T22:01:43Z","updated_at":"2016-12-17T22:01:43Z","html_url":"https://github.com/ambiata/mismi/pull/342#discussion_r92929867","pull_request_url":"https://api.github.com/repos/ambiata/mismi/pulls/342","_links":{"self":{"href":"https://api.github.com/repos/ambiata/mismi/pulls/comments/92929867"},"html":{"href":"https://github.com/ambiata/mismi/pull/342#discussion_r92929867"},"pull_request":{"href":"https://api.github.com/repos/ambiata/mismi/pulls/342"}}},"pull_request":{"url":"https://api.github.com/repos/ambiata/mismi/pulls/342","id":98436037,"html_url":"https://github.com/ambiata/mismi/pull/342","diff_url":"https://github.com/ambiata/mismi/pull/342.diff","patch_url":"https://github.com/ambiata/mismi/pull/342.patch","issue_url":"https://api.github.com/repos/ambiata/mismi/issues/342","number":342,"state":"open","locked":false,"title":"Add support for s3 size --recursive --summary --iec --metric","user":{"login":"jystic","id":134805,"avatar_url":"https://avatars.githubusercontent.com/u/134805?v=3","gravatar_id":"","url":"https://api.github.com/users/jystic","html_url":"https://github.com/jystic","followers_url":"https://api.github.com/users/jystic/followers","following_url":"https://api.github.com/users/jystic/following{/other_user}","gists_url":"https://api.github.com/users/jystic/gists{/gist_id}","starred_url":"https://api.github.com/users/jystic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jystic/subscriptions","organizations_url":"https://api.github.com/users/jystic/orgs","repos_url":"https://api.github.com/users/jystic/repos","events_url":"https://api.github.com/users/jystic/events{/privacy}","received_events_url":"https://api.github.com/users/jystic/received_events","type":"User","site_admin":false},"body":"Some example usages:\r\n```\r\n$ s3 size --help\r\nUsage: s3 size S3URI [-r|--recursive] [-s|--summary] ([-h|--iec] |\r\n               [-m|--metric])\r\n  Get the size of an address.\r\n\r\nAvailable options:\r\n  S3URI                    An s3 uri, i.e. s3://bucket/prefix/key\r\n  -r,--recursive           Recursively list\r\n  -s,--summary             Display only the combined total for a prefix.\r\n  -h,--iec                 Human-readable output, using IEC unit prefixes, i.e.\r\n                           1024^n\r\n  -m,--metric              Human-readable output, using metric unit prefixes,\r\n                           i.e. 1000^n\r\n  -h,--help                Show this help text\r\n```\r\n```\r\n$ s3 size s3://bucket/foo/part-00000\r\n42114\r\n```\r\n```\r\n$ s3 size --iec s3://bucket/foo/part-00000\r\n 41 KiB\r\n```\r\n```\r\n$ s3 size --metric s3://bucket/foo/part-00000\r\n 42 kB\r\n```\r\n```\r\n$ s3 size --recursive s3://bucket/foo\r\n42114\ts3://bucket/foo/part-00000\r\n35122\ts3://bucket/foo/part-00001\r\n44855\ts3://bucket/foo/part-00002\r\n68891\ts3://bucket/foo/part-00003\r\n```\r\n```\r\n$ s3 size --recursive --iec s3://bucket/foo\r\n 41 KiB  s3://bucket/foo/part-00000\r\n 34 KiB  s3://bucket/foo/part-00001\r\n 44 KiB  s3://bucket/foo/part-00002\r\n 67 KiB  s3://bucket/foo/part-00003\r\n```\r\n```\r\n$ s3 size --recursive --metric s3://bucket/foo\r\n 42 kB  s3://bucket/foo/part-00000\r\n 35 kB  s3://bucket/foo/part-00001\r\n 45 kB  s3://bucket/foo/part-00002\r\n 69 kB  s3://bucket/foo/part-00003\r\n```\r\n```\r\n$ s3 size --recursive --summary s3://bucket/foo\r\n179982\ts3://bucket/foo\r\n```\r\n```\r\n$ s3 size --recursive --summary --iec s3://bucket/foo\r\n176 KiB  s3://bucket/foo\r\n```\r\n```\r\n$ s3 size --recursive --summary --metric s3://bucket/foo\r\n180 kB  s3://bucket/foo\r\n```\r\n\r\n! @nhibberd ","created_at":"2016-12-17T07:07:27Z","updated_at":"2016-12-17T22:01:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cd44963af9e797e5a4e272fec6de1e34442bffb5","assignee":{"login":"nhibberd","id":447873,"avatar_url":"https://avatars.githubusercontent.com/u/447873?v=3","gravatar_id":"","url":"https://api.github.com/users/nhibberd","html_url":"https://github.com/nhibberd","followers_url":"https://api.github.com/users/nhibberd/followers","following_url":"https://api.github.com/users/nhibberd/following{/other_user}","gists_url":"https://api.github.com/users/nhibberd/gists{/gist_id}","starred_url":"https://api.github.com/users/nhibberd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhibberd/subscriptions","organizations_url":"https://api.github.com/users/nhibberd/orgs","repos_url":"https://api.github.com/users/nhibberd/repos","events_url":"https://api.github.com/users/nhibberd/events{/privacy}","received_events_url":"https://api.github.com/users/nhibberd/received_events","type":"User","site_admin":false},"assignees":[{"login":"nhibberd","id":447873,"avatar_url":"https://avatars.githubusercontent.com/u/447873?v=3","gravatar_id":"","url":"https://api.github.com/users/nhibberd","html_url":"https://github.com/nhibberd","followers_url":"https://api.github.com/users/nhibberd/followers","following_url":"https://api.github.com/users/nhibberd/following{/other_user}","gists_url":"https://api.github.com/users/nhibberd/gists{/gist_id}","starred_url":"https://api.github.com/users/nhibberd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhibberd/subscriptions","organizations_url":"https://api.github.com/users/nhibberd/orgs","repos_url":"https://api.github.com/users/nhibberd/repos","events_url":"https://api.github.com/users/nhibberd/events{/privacy}","received_events_url":"https://api.github.com/users/nhibberd/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ambiata/mismi/pulls/342/commits","review_comments_url":"https://api.github.com/repos/ambiata/mismi/pulls/342/comments","review_comment_url":"https://api.github.com/repos/ambiata/mismi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ambiata/mismi/issues/342/comments","statuses_url":"https://api.github.com/repos/ambiata/mismi/statuses/d4e872ab13503c430375b13669f6801124043f61","head":{"label":"ambiata:topic/size-recursive","ref":"topic/size-recursive","sha":"d4e872ab13503c430375b13669f6801124043f61","user":{"login":"ambiata","id":1691023,"avatar_url":"https://avatars.githubusercontent.com/u/1691023?v=3","gravatar_id":"","url":"https://api.github.com/users/ambiata","html_url":"https://github.com/ambiata","followers_url":"https://api.github.com/users/ambiata/followers","following_url":"https://api.github.com/users/ambiata/following{/other_user}","gists_url":"https://api.github.com/users/ambiata/gists{/gist_id}","starred_url":"https://api.github.com/users/ambiata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambiata/subscriptions","organizations_url":"https://api.github.com/users/ambiata/orgs","repos_url":"https://api.github.com/users/ambiata/repos","events_url":"https://api.github.com/users/ambiata/events{/privacy}","received_events_url":"https://api.github.com/users/ambiata/received_events","type":"Organization","site_admin":false},"repo":{"id":30991371,"name":"mismi","full_name":"ambiata/mismi","owner":{"login":"ambiata","id":1691023,"avatar_url":"https://avatars.githubusercontent.com/u/1691023?v=3","gravatar_id":"","url":"https://api.github.com/users/ambiata","html_url":"https://github.com/ambiata","followers_url":"https://api.github.com/users/ambiata/followers","following_url":"https://api.github.com/users/ambiata/following{/other_user}","gists_url":"https://api.github.com/users/ambiata/gists{/gist_id}","starred_url":"https://api.github.com/users/ambiata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambiata/subscriptions","organizations_url":"https://api.github.com/users/ambiata/orgs","repos_url":"https://api.github.com/users/ambiata/repos","events_url":"https://api.github.com/users/ambiata/events{/privacy}","received_events_url":"https://api.github.com/users/ambiata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ambiata/mismi","description":"Haskell library for AWS","fork":false,"url":"https://api.github.com/repos/ambiata/mismi","forks_url":"https://api.github.com/repos/ambiata/mismi/forks","keys_url":"https://api.github.com/repos/ambiata/mismi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ambiata/mismi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ambiata/mismi/teams","hooks_url":"https://api.github.com/repos/ambiata/mismi/hooks","issue_events_url":"https://api.github.com/repos/ambiata/mismi/issues/events{/number}","events_url":"https://api.github.com/repos/ambiata/mismi/events","assignees_url":"https://api.github.com/repos/ambiata/mismi/assignees{/user}","branches_url":"https://api.github.com/repos/ambiata/mismi/branches{/branch}","tags_url":"https://api.github.com/repos/ambiata/mismi/tags","blobs_url":"https://api.github.com/repos/ambiata/mismi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ambiata/mismi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ambiata/mismi/git/refs{/sha}","trees_url":"https://api.github.com/repos/ambiata/mismi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ambiata/mismi/statuses/{sha}","languages_url":"https://api.github.com/repos/ambiata/mismi/languages","stargazers_url":"https://api.github.com/repos/ambiata/mismi/stargazers","contributors_url":"https://api.github.com/repos/ambiata/mismi/contributors","subscribers_url":"https://api.github.com/repos/ambiata/mismi/subscribers","subscription_url":"https://api.github.com/repos/ambiata/mismi/subscription","commits_url":"https://api.github.com/repos/ambiata/mismi/commits{/sha}","git_commits_url":"https://api.github.com/repos/ambiata/mismi/git/commits{/sha}","comments_url":"https://api.github.com/repos/ambiata/mismi/comments{/number}","issue_comment_url":"https://api.github.com/repos/ambiata/mismi/issues/comments{/number}","contents_url":"https://api.github.com/repos/ambiata/mismi/contents/{+path}","compare_url":"https://api.github.com/repos/ambiata/mismi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ambiata/mismi/merges","archive_url":"https://api.github.com/repos/ambiata/mismi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ambiata/mismi/downloads","issues_url":"https://api.github.com/repos/ambiata/mismi/issues{/number}","pulls_url":"https://api.github.com/repos/ambiata/mismi/pulls{/number}","milestones_url":"https://api.github.com/repos/ambiata/mismi/milestones{/number}","notifications_url":"https://api.github.com/repos/ambiata/mismi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ambiata/mismi/labels{/name}","releases_url":"https://api.github.com/repos/ambiata/mismi/releases{/id}","deployments_url":"https://api.github.com/repos/ambiata/mismi/deployments","created_at":"2015-02-18T22:50:24Z","updated_at":"2016-10-30T22:21:13Z","pushed_at":"2016-12-17T07:54:11Z","git_url":"git://github.com/ambiata/mismi.git","ssh_url":"git@github.com:ambiata/mismi.git","clone_url":"https://github.com/ambiata/mismi.git","svn_url":"https://github.com/ambiata/mismi","homepage":null,"size":698,"stargazers_count":5,"watchers_count":5,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":24,"forks":0,"open_issues":24,"watchers":5,"default_branch":"master"}},"base":{"label":"ambiata:master","ref":"master","sha":"e19c817a687cb6062b1c2de8fc4943b0ec48d673","user":{"login":"ambiata","id":1691023,"avatar_url":"https://avatars.githubusercontent.com/u/1691023?v=3","gravatar_id":"","url":"https://api.github.com/users/ambiata","html_url":"https://github.com/ambiata","followers_url":"https://api.github.com/users/ambiata/followers","following_url":"https://api.github.com/users/ambiata/following{/other_user}","gists_url":"https://api.github.com/users/ambiata/gists{/gist_id}","starred_url":"https://api.github.com/users/ambiata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambiata/subscriptions","organizations_url":"https://api.github.com/users/ambiata/orgs","repos_url":"https://api.github.com/users/ambiata/repos","events_url":"https://api.github.com/users/ambiata/events{/privacy}","received_events_url":"https://api.github.com/users/ambiata/received_events","type":"Organization","site_admin":false},"repo":{"id":30991371,"name":"mismi","full_name":"ambiata/mismi","owner":{"login":"ambiata","id":1691023,"avatar_url":"https://avatars.githubusercontent.com/u/1691023?v=3","gravatar_id":"","url":"https://api.github.com/users/ambiata","html_url":"https://github.com/ambiata","followers_url":"https://api.github.com/users/ambiata/followers","following_url":"https://api.github.com/users/ambiata/following{/other_user}","gists_url":"https://api.github.com/users/ambiata/gists{/gist_id}","starred_url":"https://api.github.com/users/ambiata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambiata/subscriptions","organizations_url":"https://api.github.com/users/ambiata/orgs","repos_url":"https://api.github.com/users/ambiata/repos","events_url":"https://api.github.com/users/ambiata/events{/privacy}","received_events_url":"https://api.github.com/users/ambiata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ambiata/mismi","description":"Haskell library for AWS","fork":false,"url":"https://api.github.com/repos/ambiata/mismi","forks_url":"https://api.github.com/repos/ambiata/mismi/forks","keys_url":"https://api.github.com/repos/ambiata/mismi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ambiata/mismi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ambiata/mismi/teams","hooks_url":"https://api.github.com/repos/ambiata/mismi/hooks","issue_events_url":"https://api.github.com/repos/ambiata/mismi/issues/events{/number}","events_url":"https://api.github.com/repos/ambiata/mismi/events","assignees_url":"https://api.github.com/repos/ambiata/mismi/assignees{/user}","branches_url":"https://api.github.com/repos/ambiata/mismi/branches{/branch}","tags_url":"https://api.github.com/repos/ambiata/mismi/tags","blobs_url":"https://api.github.com/repos/ambiata/mismi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ambiata/mismi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ambiata/mismi/git/refs{/sha}","trees_url":"https://api.github.com/repos/ambiata/mismi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ambiata/mismi/statuses/{sha}","languages_url":"https://api.github.com/repos/ambiata/mismi/languages","stargazers_url":"https://api.github.com/repos/ambiata/mismi/stargazers","contributors_url":"https://api.github.com/repos/ambiata/mismi/contributors","subscribers_url":"https://api.github.com/repos/ambiata/mismi/subscribers","subscription_url":"https://api.github.com/repos/ambiata/mismi/subscription","commits_url":"https://api.github.com/repos/ambiata/mismi/commits{/sha}","git_commits_url":"https://api.github.com/repos/ambiata/mismi/git/commits{/sha}","comments_url":"https://api.github.com/repos/ambiata/mismi/comments{/number}","issue_comment_url":"https://api.github.com/repos/ambiata/mismi/issues/comments{/number}","contents_url":"https://api.github.com/repos/ambiata/mismi/contents/{+path}","compare_url":"https://api.github.com/repos/ambiata/mismi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ambiata/mismi/merges","archive_url":"https://api.github.com/repos/ambiata/mismi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ambiata/mismi/downloads","issues_url":"https://api.github.com/repos/ambiata/mismi/issues{/number}","pulls_url":"https://api.github.com/repos/ambiata/mismi/pulls{/number}","milestones_url":"https://api.github.com/repos/ambiata/mismi/milestones{/number}","notifications_url":"https://api.github.com/repos/ambiata/mismi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ambiata/mismi/labels{/name}","releases_url":"https://api.github.com/repos/ambiata/mismi/releases{/id}","deployments_url":"https://api.github.com/repos/ambiata/mismi/deployments","created_at":"2015-02-18T22:50:24Z","updated_at":"2016-10-30T22:21:13Z","pushed_at":"2016-12-17T07:54:11Z","git_url":"git://github.com/ambiata/mismi.git","ssh_url":"git@github.com:ambiata/mismi.git","clone_url":"https://github.com/ambiata/mismi.git","svn_url":"https://github.com/ambiata/mismi","homepage":null,"size":698,"stargazers_count":5,"watchers_count":5,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":24,"forks":0,"open_issues":24,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ambiata/mismi/pulls/342"},"html":{"href":"https://github.com/ambiata/mismi/pull/342"},"issue":{"href":"https://api.github.com/repos/ambiata/mismi/issues/342"},"comments":{"href":"https://api.github.com/repos/ambiata/mismi/issues/342/comments"},"review_comments":{"href":"https://api.github.com/repos/ambiata/mismi/pulls/342/comments"},"review_comment":{"href":"https://api.github.com/repos/ambiata/mismi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ambiata/mismi/pulls/342/commits"},"statuses":{"href":"https://api.github.com/repos/ambiata/mismi/statuses/d4e872ab13503c430375b13669f6801124043f61"}}}}
{"actor":{"display_login":"jystic"}}