|
| 1 | +{-# LANGUAGE OverloadedStrings #-} |
| 2 | +module Main where |
| 3 | + |
| 4 | +import qualified Github.Issues as Github |
| 5 | +import qualified Data.ByteString as B |
| 6 | +import Report |
| 7 | +import Text.PrettyPrint.Leijen |
| 8 | + |
| 9 | +auth :: Maybe (B.ByteString, B.ByteString) |
| 10 | +auth = Just ("yourgithub id", "somepassword") |
| 11 | + |
| 12 | +mkIssue :: ReportedIssue -> Doc |
| 13 | +mkIssue (Issue n t h) = hsep [ |
| 14 | + fill 5 (text ("#" ++ (show n))), |
| 15 | + fill 50 (text t), |
| 16 | + fill 5 (text (show h))] |
| 17 | + |
| 18 | +vissues :: ([Doc], [Doc], [Doc]) -> Doc |
| 19 | +vissues (x, y, z) = hsep [(vcat x), align (vcat y), align (vcat z)] |
| 20 | + |
| 21 | +mkDoc :: Report -> Doc |
| 22 | +mkDoc (Report issues total) = vsep [ |
| 23 | + text "Report for the milestone", |
| 24 | + (vsep . map mkIssue) issues, |
| 25 | + text ("Total hours : " ++ (show total) ++" hours") |
| 26 | + ] |
| 27 | + |
| 28 | +mkFullDoc :: [Github.Issue] -> Doc |
| 29 | +mkFullDoc = mkDoc . prepareReport |
| 30 | + |
| 31 | +-- The public repo is used as private are quite sensitive for this report |
| 32 | +-- |
| 33 | +-- The main idea is to use labels like 1h, 2h etc for man-hour estimation of issues |
| 34 | +-- on private repos for development "on hire" |
| 35 | +-- |
| 36 | +-- This tool is used to generate report on work done for the customer |
| 37 | +-- |
| 38 | +main :: IO () |
| 39 | +main = do |
| 40 | + let limitations = [Github.OnlyClosed, Github.MilestoneId 4] |
| 41 | + possibleIssues <- Github.issuesForRepo' auth "paulrzcz" "hquantlib" limitations |
| 42 | + case possibleIssues of |
| 43 | + (Left err) -> putStrLn $ "Error: " ++ show err |
| 44 | + (Right issues) -> putDoc $ mkFullDoc issues |
0 commit comments