2011-04-22 22:47:57 +04:00
|
|
|
#!/usr/bin/env runhaskell
|
|
|
|
{-
|
|
|
|
Display the current darcs repository's last tag and the number of days since.
|
|
|
|
Similar to:
|
|
|
|
$ darcs changes --to-tag . --from-tag .|head -n 1 |cut -d' ' -f-7 |xargs -I {} date -d "{}" +%s |xargs -I {} expr \( $(date +%s) - {} \) / 60 / 60 / 24
|
|
|
|
-}
|
|
|
|
import Data.Time
|
2011-09-25 22:29:23 +04:00
|
|
|
import System.Environment
|
2011-04-22 22:47:57 +04:00
|
|
|
import System.Locale
|
|
|
|
import System.Process
|
|
|
|
|
|
|
|
main = do
|
2011-09-25 22:29:23 +04:00
|
|
|
tag:_ <- getArgs
|
|
|
|
s <- readProcess "darcs" ["changes","--from-tag",tag,"--to-tag",tag] ""
|
2011-04-22 22:47:57 +04:00
|
|
|
let datestr = unwords $ take 6 $ words $ head $ lines s
|
|
|
|
date = readTime defaultTimeLocale "%a %b %e %H:%M:%S %Z %Y" datestr :: Day
|
|
|
|
today <- getCurrentDay
|
2011-09-25 22:29:23 +04:00
|
|
|
putStrLn $ show (diffDays today date) ++ " days since tag "++tag++":\n"
|
2011-04-22 22:47:57 +04:00
|
|
|
putStr s
|
|
|
|
|
2021-08-16 07:49:40 +03:00
|
|
|
getCurrentDay = localDay . zonedTimeToLocalTime <$> getZonedTime
|