File: GitLsTreeRecursively.hs

package info (click to toggle)
haskell-github 0.8-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 444 kB
  • sloc: haskell: 2,572; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 631 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module GitLsTreeRecursively where

import qualified Github.GitData.Trees as Github
import Data.List (intercalate)

main = do
  possibleTree <- Github.nestedTree "thoughtbot" "paperclip" "fe114451f7d066d367a1646ca7ac10e689b46844"
  case possibleTree of
       (Left error)  -> putStrLn $ "Error: " ++ show error
       (Right tree) -> putStrLn $ formatTree tree

formatTree tree =
  intercalate "\n" $ map formatGitTree $ Github.treeGitTrees tree

formatGitTree gitTree =
  (Github.gitTreeMode gitTree) ++ " " ++
    (Github.gitTreeType gitTree) ++ " " ++
    (Github.gitTreeSha gitTree) ++ "\t" ++
    (Github.gitTreePath gitTree)