{"action":"created","comment":{"url":"https://api.github.com/repos/tfausak/autoexporter/pulls/comments/127213112","pull_request_review_id":49773159,"id":127213112,"diff_hunk":"@@ -16,17 +20,35 @@ main = do\n mainWithArgs :: [String] -> IO ()\n mainWithArgs args =\n   case args of\n-    [name, inputFile, outputFile] -> autoexport name inputFile outputFile\n+    [name, inputFile, outputFile, \"--deep\"] ->\n+      autoexport ExportScope'Deep name inputFile outputFile\n+    [name, inputFile, outputFile] ->\n+      autoexport ExportScope'Shallow name inputFile outputFile\n     _ -> fail (\"unexpected arguments: \" ++ show args)\n \n-autoexport :: String -> FilePath -> FilePath -> IO ()\n-autoexport name inputFile outputFile = do\n+autoexport :: ExportScope -> String -> FilePath -> FilePath -> IO ()\n+autoexport exportScope name inputFile outputFile = do\n   let moduleName = makeModuleName name\n   let directory = FilePath.dropExtension inputFile\n-  files <- Directory.getDirectoryContents directory\n+  files <- findFiles exportScope directory\n   let output = makeOutput moduleName directory files\n   writeFile outputFile output\n \n+findFiles :: ExportScope -> FilePath -> IO [FilePath]\n+findFiles ExportScope'Shallow dir = filter isHaskellFile <$> findRootFiles dir\n+findFiles ExportScope'Deep dir = do\n+  rootItems <- findRootFiles dir\n+  childItems <- Traversable.for rootItems $ \\item -> do\n+    let path = dir FilePath.</> item\n+    dirExists <- Directory.doesDirectoryExist path\n+    if dirExists\n+      then fmap (item FilePath.</>) <$> findFiles ExportScope'Deep path\n+      else pure []\n+  pure $ mconcat (filter isHaskellFile rootItems : childItems)\n+\n+findRootFiles :: FilePath -> IO [FilePath]\n+findRootFiles dir = filter isRootItem <$> Directory.getDirectoryContents dir","path":"source/library/Autoexporter.hs","position":52,"original_position":52,"commit_id":"1cd87016809fa8f3f967d88fb802393754181ca8","original_commit_id":"1cd87016809fa8f3f967d88fb802393754181ca8","user":{"login":"tfausak","id":408753,"avatar_url":"https://avatars2.githubusercontent.com/u/408753?v=3","gravatar_id":"","url":"https://api.github.com/users/tfausak","html_url":"https://github.com/tfausak","followers_url":"https://api.github.com/users/tfausak/followers","following_url":"https://api.github.com/users/tfausak/following{/other_user}","gists_url":"https://api.github.com/users/tfausak/gists{/gist_id}","starred_url":"https://api.github.com/users/tfausak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfausak/subscriptions","organizations_url":"https://api.github.com/users/tfausak/orgs","repos_url":"https://api.github.com/users/tfausak/repos","events_url":"https://api.github.com/users/tfausak/events{/privacy}","received_events_url":"https://api.github.com/users/tfausak/received_events","type":"User","site_admin":false},"body":"Can you use [`listDirectory`](https://www.stackage.org/haddock/lts-8.22/directory-1.3.0.0/System-Directory.html#v:listDirectory) instead? It is like `getDirectoryContents` except that it avoids `.` and `..`. ","created_at":"2017-07-13T13:18:15Z","updated_at":"2017-07-13T13:24:11Z","html_url":"https://github.com/tfausak/autoexporter/pull/6#discussion_r127213112","pull_request_url":"https://api.github.com/repos/tfausak/autoexporter/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/tfausak/autoexporter/pulls/comments/127213112"},"html":{"href":"https://github.com/tfausak/autoexporter/pull/6#discussion_r127213112"},"pull_request":{"href":"https://api.github.com/repos/tfausak/autoexporter/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/tfausak/autoexporter/pulls/6","id":130354296,"html_url":"https://github.com/tfausak/autoexporter/pull/6","diff_url":"https://github.com/tfausak/autoexporter/pull/6.diff","patch_url":"https://github.com/tfausak/autoexporter/pull/6.patch","issue_url":"https://api.github.com/repos/tfausak/autoexporter/issues/6","number":6,"state":"open","locked":false,"title":"Support deep export via optional '--deep' argument","user":{"login":"jship","id":1744045,"avatar_url":"https://avatars1.githubusercontent.com/u/1744045?v=3","gravatar_id":"","url":"https://api.github.com/users/jship","html_url":"https://github.com/jship","followers_url":"https://api.github.com/users/jship/followers","following_url":"https://api.github.com/users/jship/following{/other_user}","gists_url":"https://api.github.com/users/jship/gists{/gist_id}","starred_url":"https://api.github.com/users/jship/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jship/subscriptions","organizations_url":"https://api.github.com/users/jship/orgs","repos_url":"https://api.github.com/users/jship/repos","events_url":"https://api.github.com/users/jship/events{/privacy}","received_events_url":"https://api.github.com/users/jship/received_events","type":"User","site_admin":false},"body":"This closes #5.\r\n\r\nThe new behavior is optional.  The standard way to use `autoexporter` is via\r\n`{-# OPTIONS_GHC -F -pgmF autoexporter #-}`\r\nand this does shallow re-exporting.\r\n\r\nIf a user wants deep re-exporting, they can do\r\n`{-# OPTIONS_GHC -F -pgmF autoexporter -optF --deep #-}`.","created_at":"2017-07-13T12:08:06Z","updated_at":"2017-07-13T13:24:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a2db27d3bff4a8b66af36fcd88e18aeda693147d","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/tfausak/autoexporter/pulls/6/commits","review_comments_url":"https://api.github.com/repos/tfausak/autoexporter/pulls/6/comments","review_comment_url":"https://api.github.com/repos/tfausak/autoexporter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tfausak/autoexporter/issues/6/comments","statuses_url":"https://api.github.com/repos/tfausak/autoexporter/statuses/1cd87016809fa8f3f967d88fb802393754181ca8","head":{"label":"jship:DEEP_EXPORT","ref":"DEEP_EXPORT","sha":"1cd87016809fa8f3f967d88fb802393754181ca8","user":{"login":"jship","id":1744045,"avatar_url":"https://avatars1.githubusercontent.com/u/1744045?v=3","gravatar_id":"","url":"https://api.github.com/users/jship","html_url":"https://github.com/jship","followers_url":"https://api.github.com/users/jship/followers","following_url":"https://api.github.com/users/jship/following{/other_user}","gists_url":"https://api.github.com/users/jship/gists{/gist_id}","starred_url":"https://api.github.com/users/jship/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jship/subscriptions","organizations_url":"https://api.github.com/users/jship/orgs","repos_url":"https://api.github.com/users/jship/repos","events_url":"https://api.github.com/users/jship/events{/privacy}","received_events_url":"https://api.github.com/users/jship/received_events","type":"User","site_admin":false},"repo":{"id":96955033,"name":"autoexporter","full_name":"jship/autoexporter","owner":{"login":"jship","id":1744045,"avatar_url":"https://avatars1.githubusercontent.com/u/1744045?v=3","gravatar_id":"","url":"https://api.github.com/users/jship","html_url":"https://github.com/jship","followers_url":"https://api.github.com/users/jship/followers","following_url":"https://api.github.com/users/jship/following{/other_user}","gists_url":"https://api.github.com/users/jship/gists{/gist_id}","starred_url":"https://api.github.com/users/jship/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jship/subscriptions","organizations_url":"https://api.github.com/users/jship/orgs","repos_url":"https://api.github.com/users/jship/repos","events_url":"https://api.github.com/users/jship/events{/privacy}","received_events_url":"https://api.github.com/users/jship/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jship/autoexporter","description":":outbox_tray: Automatically re-export Haskell modules.","fork":true,"url":"https://api.github.com/repos/jship/autoexporter","forks_url":"https://api.github.com/repos/jship/autoexporter/forks","keys_url":"https://api.github.com/repos/jship/autoexporter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jship/autoexporter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jship/autoexporter/teams","hooks_url":"https://api.github.com/repos/jship/autoexporter/hooks","issue_events_url":"https://api.github.com/repos/jship/autoexporter/issues/events{/number}","events_url":"https://api.github.com/repos/jship/autoexporter/events","assignees_url":"https://api.github.com/repos/jship/autoexporter/assignees{/user}","branches_url":"https://api.github.com/repos/jship/autoexporter/branches{/branch}","tags_url":"https://api.github.com/repos/jship/autoexporter/tags","blobs_url":"https://api.github.com/repos/jship/autoexporter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jship/autoexporter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jship/autoexporter/git/refs{/sha}","trees_url":"https://api.github.com/repos/jship/autoexporter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jship/autoexporter/statuses/{sha}","languages_url":"https://api.github.com/repos/jship/autoexporter/languages","stargazers_url":"https://api.github.com/repos/jship/autoexporter/stargazers","contributors_url":"https://api.github.com/repos/jship/autoexporter/contributors","subscribers_url":"https://api.github.com/repos/jship/autoexporter/subscribers","subscription_url":"https://api.github.com/repos/jship/autoexporter/subscription","commits_url":"https://api.github.com/repos/jship/autoexporter/commits{/sha}","git_commits_url":"https://api.github.com/repos/jship/autoexporter/git/commits{/sha}","comments_url":"https://api.github.com/repos/jship/autoexporter/comments{/number}","issue_comment_url":"https://api.github.com/repos/jship/autoexporter/issues/comments{/number}","contents_url":"https://api.github.com/repos/jship/autoexporter/contents/{+path}","compare_url":"https://api.github.com/repos/jship/autoexporter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jship/autoexporter/merges","archive_url":"https://api.github.com/repos/jship/autoexporter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jship/autoexporter/downloads","issues_url":"https://api.github.com/repos/jship/autoexporter/issues{/number}","pulls_url":"https://api.github.com/repos/jship/autoexporter/pulls{/number}","milestones_url":"https://api.github.com/repos/jship/autoexporter/milestones{/number}","notifications_url":"https://api.github.com/repos/jship/autoexporter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jship/autoexporter/labels{/name}","releases_url":"https://api.github.com/repos/jship/autoexporter/releases{/id}","deployments_url":"https://api.github.com/repos/jship/autoexporter/deployments","created_at":"2017-07-12T02:06:20Z","updated_at":"2017-07-12T02:06:22Z","pushed_at":"2017-07-13T12:06:26Z","git_url":"git://github.com/jship/autoexporter.git","ssh_url":"git@github.com:jship/autoexporter.git","clone_url":"https://github.com/jship/autoexporter.git","svn_url":"https://github.com/jship/autoexporter","homepage":"https://www.stackage.org/nightly/package/autoexporter","size":22,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"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":"tfausak:master","ref":"master","sha":"32890349aeb2f228ef22c2b0eba09e8aaf2f5e37","user":{"login":"tfausak","id":408753,"avatar_url":"https://avatars2.githubusercontent.com/u/408753?v=3","gravatar_id":"","url":"https://api.github.com/users/tfausak","html_url":"https://github.com/tfausak","followers_url":"https://api.github.com/users/tfausak/followers","following_url":"https://api.github.com/users/tfausak/following{/other_user}","gists_url":"https://api.github.com/users/tfausak/gists{/gist_id}","starred_url":"https://api.github.com/users/tfausak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfausak/subscriptions","organizations_url":"https://api.github.com/users/tfausak/orgs","repos_url":"https://api.github.com/users/tfausak/repos","events_url":"https://api.github.com/users/tfausak/events{/privacy}","received_events_url":"https://api.github.com/users/tfausak/received_events","type":"User","site_admin":false},"repo":{"id":52222779,"name":"autoexporter","full_name":"tfausak/autoexporter","owner":{"login":"tfausak","id":408753,"avatar_url":"https://avatars2.githubusercontent.com/u/408753?v=3","gravatar_id":"","url":"https://api.github.com/users/tfausak","html_url":"https://github.com/tfausak","followers_url":"https://api.github.com/users/tfausak/followers","following_url":"https://api.github.com/users/tfausak/following{/other_user}","gists_url":"https://api.github.com/users/tfausak/gists{/gist_id}","starred_url":"https://api.github.com/users/tfausak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfausak/subscriptions","organizations_url":"https://api.github.com/users/tfausak/orgs","repos_url":"https://api.github.com/users/tfausak/repos","events_url":"https://api.github.com/users/tfausak/events{/privacy}","received_events_url":"https://api.github.com/users/tfausak/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tfausak/autoexporter","description":":outbox_tray: Automatically re-export Haskell modules.","fork":false,"url":"https://api.github.com/repos/tfausak/autoexporter","forks_url":"https://api.github.com/repos/tfausak/autoexporter/forks","keys_url":"https://api.github.com/repos/tfausak/autoexporter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tfausak/autoexporter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tfausak/autoexporter/teams","hooks_url":"https://api.github.com/repos/tfausak/autoexporter/hooks","issue_events_url":"https://api.github.com/repos/tfausak/autoexporter/issues/events{/number}","events_url":"https://api.github.com/repos/tfausak/autoexporter/events","assignees_url":"https://api.github.com/repos/tfausak/autoexporter/assignees{/user}","branches_url":"https://api.github.com/repos/tfausak/autoexporter/branches{/branch}","tags_url":"https://api.github.com/repos/tfausak/autoexporter/tags","blobs_url":"https://api.github.com/repos/tfausak/autoexporter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tfausak/autoexporter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tfausak/autoexporter/git/refs{/sha}","trees_url":"https://api.github.com/repos/tfausak/autoexporter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tfausak/autoexporter/statuses/{sha}","languages_url":"https://api.github.com/repos/tfausak/autoexporter/languages","stargazers_url":"https://api.github.com/repos/tfausak/autoexporter/stargazers","contributors_url":"https://api.github.com/repos/tfausak/autoexporter/contributors","subscribers_url":"https://api.github.com/repos/tfausak/autoexporter/subscribers","subscription_url":"https://api.github.com/repos/tfausak/autoexporter/subscription","commits_url":"https://api.github.com/repos/tfausak/autoexporter/commits{/sha}","git_commits_url":"https://api.github.com/repos/tfausak/autoexporter/git/commits{/sha}","comments_url":"https://api.github.com/repos/tfausak/autoexporter/comments{/number}","issue_comment_url":"https://api.github.com/repos/tfausak/autoexporter/issues/comments{/number}","contents_url":"https://api.github.com/repos/tfausak/autoexporter/contents/{+path}","compare_url":"https://api.github.com/repos/tfausak/autoexporter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tfausak/autoexporter/merges","archive_url":"https://api.github.com/repos/tfausak/autoexporter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tfausak/autoexporter/downloads","issues_url":"https://api.github.com/repos/tfausak/autoexporter/issues{/number}","pulls_url":"https://api.github.com/repos/tfausak/autoexporter/pulls{/number}","milestones_url":"https://api.github.com/repos/tfausak/autoexporter/milestones{/number}","notifications_url":"https://api.github.com/repos/tfausak/autoexporter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tfausak/autoexporter/labels{/name}","releases_url":"https://api.github.com/repos/tfausak/autoexporter/releases{/id}","deployments_url":"https://api.github.com/repos/tfausak/autoexporter/deployments","created_at":"2016-02-21T19:07:07Z","updated_at":"2017-03-25T19:44:13Z","pushed_at":"2017-07-13T12:08:06Z","git_url":"git://github.com/tfausak/autoexporter.git","ssh_url":"git@github.com:tfausak/autoexporter.git","clone_url":"https://github.com/tfausak/autoexporter.git","svn_url":"https://github.com/tfausak/autoexporter","homepage":"https://www.stackage.org/nightly/package/autoexporter","size":21,"stargazers_count":16,"watchers_count":16,"language":"Haskell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tfausak/autoexporter/pulls/6"},"html":{"href":"https://github.com/tfausak/autoexporter/pull/6"},"issue":{"href":"https://api.github.com/repos/tfausak/autoexporter/issues/6"},"comments":{"href":"https://api.github.com/repos/tfausak/autoexporter/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/tfausak/autoexporter/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/tfausak/autoexporter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tfausak/autoexporter/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/tfausak/autoexporter/statuses/1cd87016809fa8f3f967d88fb802393754181ca8"}}}}
{"actor":{"display_login":"tfausak"}}