diff options
author | Łukasz Hanuszczak <lukasz.hanuszczak@gmail.com> | 2015-07-01 01:14:59 +0200 |
---|---|---|
committer | Łukasz Hanuszczak <lukasz.hanuszczak@gmail.com> | 2015-07-01 01:14:59 +0200 |
commit | 767569881732c59378fb577d1a2b57b51bc454d0 (patch) | |
tree | 40587aab863894ebd583003f11f0c42f61ce04cc /hypsrc-test/accept.hs | |
parent | 395a9c3941f8b8891cffa5c17e1f6ae414edaa79 (diff) |
Create simple script for accepting hyperlinker test case references.
Diffstat (limited to 'hypsrc-test/accept.hs')
-rwxr-xr-x | hypsrc-test/accept.hs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/hypsrc-test/accept.hs b/hypsrc-test/accept.hs new file mode 100755 index 00000000..4606b2df --- /dev/null +++ b/hypsrc-test/accept.hs @@ -0,0 +1,27 @@ +#!/usr/bin/env runhaskell +{-# LANGUAGE CPP #-} + + +import System.Directory +import System.FilePath +import System.Environment + +import Utils + + +main :: IO () +main = do + args <- getArgs + files <- filter isHtmlFile <$> getDirectoryContents outDir' + let files' = if args == ["--all"] || args == ["-a"] + then files + else filter ((`elem` args) . takeBaseName) files + mapM_ copy files' + where + isHtmlFile = (== ".html") . takeExtension + + +copy :: FilePath -> IO () +copy file = do + content <- stripLocalReferences <$> readFile (outDir' </> file) + writeFile (refDir' </> file) content |