#!/usr/bin/env runhaskell import System.Directory.Tree import Data.List main :: IO () main = readDirectory "." >>= putStrLn . genHostFile genHostFile :: AnchoredDirTree String -> String genHostFile (_ :/ (Dir _ contents)) = "{\n" ++ entries ++ "\n}\n" where entries = concat [ genEntry name content | (File name content) <- contents, name `notElem` hidden ] genEntry fileName fileContent = unlines . indent $ [ "\"" ++ fileName ++ "\" = ''" ] ++ indent (lines fileContent) ++ [ "'';" ] hidden = [ "to_nix.sh" , "signup.sh" ] indent :: [String] -> [String] indent = map (" " ++)